mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 04:35:49 +00:00
🎨 Improve restrict and lower the restriction time
This commit is contained in:
parent
3c5ab10621
commit
bfab1ec213
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user