Skip to content

Commit

Permalink
fix(message): Fixed rate limiter
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickelza committed Sep 16, 2023
1 parent 0628c94 commit e569712
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytz
from telegram import Update
from telegram.ext import Application, CommandHandler, MessageHandler, filters, Defaults, CallbackQueryHandler, \
ContextTypes, BaseRateLimiter
ContextTypes, AIORateLimiter

import constants as c
import resources.Environment as Env
Expand Down Expand Up @@ -51,6 +51,9 @@ def main() -> None:
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)

# Disable httpx logging info
logging.getLogger('httpx').setLevel(logging.WARNING)

logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO, stream=sys.stdout)

Expand All @@ -61,7 +64,7 @@ def main() -> None:
.token(Env.BOT_TOKEN.get())
.post_init(post_init)
.defaults(defaults)
.rate_limiter(BaseRateLimiter())
.rate_limiter(AIORateLimiter())
.build())

# Chat id handler
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
python-dotenv==1.0.0
python-telegram-bot==20.4
python-telegram-bot[rate-limiter]==20.4
peewee==3.16.3
asyncpraw~=7.7.1
APScheduler==3.10.4
Expand Down

0 comments on commit e569712

Please sign in to comment.