🎨 Improve restrict and lower the restriction time

This commit is contained in:
洛水居室 2022-12-02 14:53:41 +08:00
parent 3c5ab10621
commit bfab1ec213
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -78,7 +78,7 @@ def restricts(
# 洪水防御 # 洪水防御
if restrict_since: if restrict_since:
if (time.time() - restrict_since) >= 60 * 5: if (time.time() - restrict_since) >= 60:
del context.user_data["restrict_since"] del context.user_data["restrict_since"]
del context.user_data["usage_count"] del context.user_data["usage_count"]
else: else:
@ -86,8 +86,11 @@ def restricts(
else: else:
if count >= 6: if count >= 6:
context.user_data["restrict_since"] = time.time() context.user_data["restrict_since"] = time.time()
await message.reply_text("你已经触发洪水防御请等待5分钟") if update.callback_query:
logger.warning(f"用户 {user.full_name}[{user.id}] 触发洪水限制 已被限制5分钟") await update.callback_query.answer("你已经触发洪水防御请等待60秒", show_alert=True)
else:
await message.reply_text("你已经触发洪水防御请等待60秒")
logger.warning(f"用户 {user.full_name}[{user.id}] 触发洪水限制 已被限制60秒")
return return_data return return_data
# 单次使用限制 # 单次使用限制
if command_time: if command_time: