alexander-akhmetov / python-telegram

Python client for the Telegram's tdlib
MIT License
610 stars 122 forks source link

handling flood_wait_ - example not working #35

Closed MalteToenjes closed 4 years ago

MalteToenjes commented 5 years ago

Hey I tried to handle the flooded error and followed this example](https://github.com/alexander-akhmetov/python-telegram/blob/91d577e75f7dbfe022fe9085f2a7bacef6712ee2/examples/send_message.py)

I tested it by looping the send_message function 300 times. I could sent 250 messages but than I got this error: "Error: 429 : Too Many Requests: retry after 19" But still all the time result.error was False.

alexander-akhmetov commented 5 years ago

Hi,

Yes, the library does not handle this type of situations. tdlib returns an update with @type: message and 'sending_state': {'@type': 'messageSendingStatePending'} inside. This means that the message will be sent after some time by the tdlib and is in the queue.

Probably, python-telegram should have different AsyncResult statuses, like PENDING and SUCCESS.