diff --git a/plugins/system/sign_all.py b/plugins/system/sign_all.py index 10cc5f7b..55e51126 100644 --- a/plugins/system/sign_all.py +++ b/plugins/system/sign_all.py @@ -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)