Python telegram bot flood control exceeded
Asked Answered
L

2

5

I develop telegram bot using python-telegram-bot.

Despite the usage of MessageQueue (just as mentioned in the docs) I keep getting

telegram.error.RetryAfter: Flood control exceeded. Retry in N seconds

when I flooding from the client (by pressing reply keyboard buttons really-really quickly) to my bot and it answers me.

MessageQueue actually works, I can see the delay during sending big number of messages at once (with for loop). I've tried different values for message queue but none of those helped.

Seems like the bot gets ban from telegram regardless of number of messages it actually send.

Method threading (sync or async) does not change anything. How can I prevent users from flooding or avoid banning my bot when this is happening?

Lollygag answered 19/7, 2018 at 12:48 Comment(0)
L
6

The problem was in bot's replying message size: it was bigger than 512 bytes. Such messages are considered by Telegram API as large ones. So making bot's reply message shorter solved the problem.

You can learn more in the article.

Lollygag answered 20/7, 2018 at 18:33 Comment(0)
I
0

Right answer has link, which is not working. May be, such outside link, can be used for hacking, at a later point of time, by manipulating contents in that link.

Imperturbable answered 21/10 at 12:58 Comment(1)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewCallable

© 2022 - 2024 — McMap. All rights reserved.