y-young/nazurin

Regarding the issue of TG-Bot limit of 20 messages per minute in groups/channels (and more pictures count as more messages)

SagiriShiho opened this issue · 1 comments

-problem
"Also note that your bot will not be able to send more than 20 messages per minute to the same group."
https://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-this

Due to official restrictions, TG-Bot limits 20 messages per minute in groups/channels (and multiple pictures count as more information)
So when the limit is reached, there will be a failure to publish

2020-11-20T22:22:20.886923+00:00 app[web.1]: 2020-11-20 22:22:20,886-bot-INFO-BadRequest exception: Group send failed

So I recommend using userbot/pyrogram instead of TG-Bot
Or add delayed release / failed retransmission

Just a few notes here:

Still using python-telegram-bot:

  1. Wait when hitting flooding limit: blocks executing because this application is currently synchronous, although run_async may helps a bit
  2. Use MessageQueue: works but the usage of PTB's MQ is not so elegant, and they're considering refactoring it

Use asynchronous Bot API frameworks:

  1. aiogram
  2. python-telegram-bot v14: PTB will switch to asyncio in v14, but that is not due in the forseable future

Use asynchronous MtProto API frameworks:

  • Pros:
    • More control
    • Direct connection to Telegram server means faster response
  • Cons:
    • Users will need to apply for Telegram API ID & Hash
    • Webhooks are not available
    • If we abandon Bot API, some features will be unavailable, such as InlineQuery, InlineKeyboard...
  1. Telethon: seems that uploading documents is slow sometimes because of multiple chunks
  2. Pyrogram: network connection seems unstable on my side