scmanjarrez / EdgeGPT-Telegram-Bot

Telegram bot using EdgeGPT unofficial API
MIT License
62 stars 22 forks source link

Flood control exceeded #83

Closed Eikosa closed 1 year ago

Eikosa commented 1 year ago

The problem

"Flood control exceeded" To avoid this problem, the editing frequency can be increased or it can be made to wait automatically when this error occurs. Another solution could be to automatically adjust the editing time for long messages. For example, for every first 4 edits, the editing time can increase by 0.4 seconds. 0.4 → 0.8 → 1.2.

Full log:

future: <Task finished name='Task-32' coro=<BingAI.run() done, defined at /root/EdgeGPT-Telegram-Bot/src/backend.py:70> exception=RetryAfter('Flood control exceeded. Retry in 222 seconds')>
Traceback (most recent call last):
  File "/root/EdgeGPT-Telegram-Bot/src/backend.py", line 109, in run
    await ut.edit(self.edit, text)
  File "/root/EdgeGPT-Telegram-Bot/src/utils.py", line 346, in edit
    await update_message.edit_text(
  File "/usr/local/lib/python3.10/dist-packages/telegram/_message.py", line 2526, in edit_text
    return await self.get_bot().edit_message_text(
  File "/usr/local/lib/python3.10/dist-packages/telegram/ext/_extbot.py", line 1482, in edit_message_text
    return await super().edit_message_text(
  File "/usr/local/lib/python3.10/dist-packages/telegram/_bot.py", line 381, in decorator
    result = await func(self, *args, **kwargs)  # skipcq: PYL-E1102
  File "/usr/local/lib/python3.10/dist-packages/telegram/_bot.py", line 3381, in edit_message_text
    return await self._send_message(
  File "/usr/local/lib/python3.10/dist-packages/telegram/ext/_extbot.py", line 507, in _send_message
    result = await super()._send_message(
  File "/usr/local/lib/python3.10/dist-packages/telegram/_bot.py", line 559, in _send_message
    result = await self._post(
  File "/usr/local/lib/python3.10/dist-packages/telegram/_bot.py", line 469, in _post
    return await self._do_post(
  File "/usr/local/lib/python3.10/dist-packages/telegram/ext/_extbot.py", line 325, in _do_post
    return await super()._do_post(
  File "/usr/local/lib/python3.10/dist-packages/telegram/_bot.py", line 497, in _do_post
    return await request.post(
  File "/usr/local/lib/python3.10/dist-packages/telegram/request/_baserequest.py", line 168, in post
    result = await self._request_wrapper(
  File "/usr/local/lib/python3.10/dist-packages/telegram/request/_baserequest.py", line 314, in _request_wrapper
    raise RetryAfter(retry_after)
telegram.error.RetryAfter: Flood control exceeded. Retry in 222 seconds