mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-29 09:07:13 +00:00
✨ 添加速率限制器
This commit is contained in:
parent
3ec99cc3b8
commit
0e81321ff2
12
main.py
12
main.py
@ -2,7 +2,7 @@ import asyncio
|
|||||||
from warnings import filterwarnings
|
from warnings import filterwarnings
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
from telegram.ext import Application, Defaults
|
from telegram.ext import Application, Defaults, AIORateLimiter
|
||||||
from telegram.warnings import PTBUserWarning
|
from telegram.warnings import PTBUserWarning
|
||||||
|
|
||||||
from config import config
|
from config import config
|
||||||
@ -46,11 +46,13 @@ def main() -> None:
|
|||||||
Log.info("构建BOT")
|
Log.info("构建BOT")
|
||||||
|
|
||||||
defaults = Defaults(tzinfo=pytz.timezone("Asia/Shanghai"))
|
defaults = Defaults(tzinfo=pytz.timezone("Asia/Shanghai"))
|
||||||
|
rate_limiter = AIORateLimiter()
|
||||||
|
|
||||||
application = Application\
|
application = Application \
|
||||||
.builder()\
|
.builder() \
|
||||||
.token(config.bot_token)\
|
.token(config.bot_token) \
|
||||||
.defaults(defaults)\
|
.defaults(defaults) \
|
||||||
|
.rate_limiter(rate_limiter) \
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
register_plugin_handlers(application)
|
register_plugin_handlers(application)
|
||||||
|
Loading…
Reference in New Issue
Block a user