fix switch_rule

This commit is contained in:
Cinte 2022-11-22 11:06:48 +08:00 committed by GitHub
parent 5de5667f80
commit 08609bdf53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,7 @@ def switch_rule(event: Event) -> bool:
参数:
:param event: pass
"""
global cmd
global cmd, v
try:
if not cmd or time.time() - v > 60 * 60:
cmd = ["关闭全部被动", "开启全部被动", "开启全部功能", "关闭全部功能"]
@ -42,6 +42,7 @@ def switch_rule(event: Event) -> bool:
cmd.append(f"关闭 {key}")
except KeyError:
pass
v = time.time()
msg = get_message_text(event.json()).split()
msg = msg[0] if msg else ""
return msg in cmd