Built-in Rate Limiter - Questions #4145
Unanswered
maxelweb-vimar
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi to all in the community 😄
I have a few questions on the rate limiter functionality of the Python Telegram Bot!
Context
recently I've read about this wiki page on avoiding flood limits due to Telegram API usage policy. As reported in this page, PTB comes with a built-in implementation of
telegram.ext.BaseRateLimiter
calledtelegram.ext.AIORateLimiter
that is calibrated on the Telegram APIs flood limits.Question 1 - Is the rate limiter enabled by default without explicit rate-limiter dependency?
It is not clear to me whether this functionality is enabled by default in the basic package installation or if the optional pip dependency (
python-telegram-bot[rate-limiter]
) mentioned here must be made explicit so that the rate limiter is effective.From what I understand, the optional dependency should be added only if I plan to use it with different parameters when creating the
ApplicationBuilder
object or if I want to create a new class based onBaseRateLimiter
, otherwise it works by default. Is this correct?Question 2 - How does the evaluation period works in the rate limiter?
For example, I have 120 single users that I want to notify with my Telegram Bot. When I invoke the send message function, the Bot rate-limiter prepares 4 batches of 30 messages each and then it sends one batch every second. Is this correct or does it take other logic in consideration?
Thanks in advance to anyone helping me.
Beta Was this translation helpful? Give feedback.
All reactions