mirror of
https://github.com/PaiGramTeam/MibooGram.git
synced 2024-11-16 12:51:45 +00:00
🎨 全部重签添加随机延迟
This commit is contained in:
parent
247606fbb9
commit
9f2fc56ea5
@ -1,5 +1,6 @@
|
||||
import asyncio
|
||||
import datetime
|
||||
import secrets
|
||||
|
||||
from aiohttp import ClientConnectorError
|
||||
from genshin import InvalidCookies, AlreadyClaimed, GenshinException
|
||||
@ -28,6 +29,7 @@ class SignAll(Plugin):
|
||||
self.sign_service = sign_service
|
||||
self.cookies_service = cookies_service
|
||||
self.user_service = user_service
|
||||
self.random = secrets.SystemRandom()
|
||||
|
||||
@handler(CommandHandler, command="sign_all", block=False)
|
||||
@bot_admins_rights_check
|
||||
@ -66,7 +68,7 @@ class SignAll(Plugin):
|
||||
try:
|
||||
if "今天旅行者已经签到过了~" not in text:
|
||||
await context.bot.send_message(sign_db.chat_id, text, parse_mode=ParseMode.HTML)
|
||||
await asyncio.sleep(5) # 回复延迟5S避免触发洪水防御
|
||||
await asyncio.sleep(10 + self.random.random() * 50) # 回复延迟 [10, 60) 避免触发洪水防御
|
||||
except BadRequest as exc:
|
||||
logger.error(f"执行自动签到时发生错误 用户UID[{user_id}]")
|
||||
logger.exception(exc)
|
||||
|
Loading…
Reference in New Issue
Block a user