Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Telegram flood wait: what “A wait of X seconds is required” means, and how to stay under the limits

说明与用途

Telegram 返回 FLOOD_WAIT_X 错误,需要暂停。脚本应读取指定时间,暂停操作并重新调度,以避免重复错误。

问题

Telegram APIs return a FLOOD_WAIT_X error, causing scripts to pause or fail when sending messages or requests too frequently.

结果

By respecting the exact wait time specified in FLOOD_WAIT_X errors and rescheduling long waits, scripts avoid repeated retries, reduce overall wait time, and maintain compliance with Telegram’s rate limits.

工作流

  • Read the error name and number (e.g., FLOOD_WAIT_X or retry_after).
  • Pause the failed action for the entire wait period; do not send test requests during this time.
  • If the wait is short, let the library sleep; if long, record the end time and reschedule the job.
  • After the wait, retry the request once; if waits recur, reduce request frequency.
  • Log each wait with account, action, and X to identify patterns.
  • Adjust pacing based on logged patterns to avoid future waits.

证据

Telegram’s API error reference files it under error code 420 FLOOD: “The maximum allowed number of attempts to invoke the given method with the given input parameters has been exceeded.”

来源

In Telethon, a Python MTProto library, it arrives as FloodWaitError with the wait in .seconds. By default the library sleeps through flood waits shorter than 60 seconds on its own, so your code only sees the longer ones.

来源

Bots on the HTTP Bot API. The same idea comes back as a 429 Too Many Requests error. Its retry_after field is, in Telegram’s words, “the number of seconds left to wait before the request can be repeated.”

来源

  • 记录日期: 2026-10-25T15:26:15.550Z