You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 called telegram.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 on BaseRateLimiter, 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?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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