Archived
1
0
Fork 0

Update message.py

This commit is contained in:
yzhh 2023-10-26 00:27:43 +08:00
parent 07413d4851
commit a5de7643bd

View file

@ -36,7 +36,7 @@ async def remove_temp_ban(msg: Bot.MessageSession):
async def tos_msg_counter(msg: Bot.MessageSession, command: str):
same = counter_same.get(msg.target.sender_id)
if same is None or datetime.now().timestamp() - same['ts'] > 300 or same['command'] != command:
# 检查是否滥用(重复使用同一命令)
# 检查是否滥用(5分钟内重复使用同一命令10条
counter_same[msg.target.sender_id] = {'command': command, 'count': 1,
'ts': datetime.now().timestamp()}
else:
@ -44,7 +44,7 @@ async def tos_msg_counter(msg: Bot.MessageSession, command: str):
if same['count'] > 10:
raise AbuseWarning(msg.locale.t("tos.reason.cooldown"))
all_ = counter_all.get(msg.target.sender_id)
if all_ is None or datetime.now().timestamp() - all_['ts'] > 300: # 检查是否滥用(重复使用同一命令)
if all_ is None or datetime.now().timestamp() - all_['ts'] > 300: # 检查是否滥用(5分钟内使用20条命令)
counter_all[msg.target.sender_id] = {'count': 1,
'ts': datetime.now().timestamp()}
else: