Skip to content

Commit edbb8ba

Browse files
committed
fix(progress): skip duplicate status updates to avoid Telegram 400 error
1 parent 30f09c9 commit edbb8ba

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

TelegramBot/MediaGet.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public class MediaGet
7171
overrideOptions.Cookies = Config.cookiesFile;
7272

7373
DateTime lastProgressUpdate = DateTime.MinValue;
74+
string lastStatusText = "";
7475
var progress = new Progress<DownloadProgress>(p =>
7576
{
7677
if (DateTime.UtcNow - lastProgressUpdate < TimeSpan.FromMilliseconds(Config.videoGetDelay))
@@ -84,6 +85,9 @@ public class MediaGet
8485
if (!string.IsNullOrEmpty(p.ETA))
8586
statusText += $" ETA {p.ETA}";
8687

88+
if (statusText == lastStatusText) return;
89+
lastStatusText = statusText;
90+
8791
if (Config.showVideoDownloadProgress)
8892
Log.Debug($"Video download progress: {statusText}");
8993

0 commit comments

Comments
 (0)