summaryrefslogtreecommitdiff
path: root/ATRI/plugins/util
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2022-02-05 00:47:52 +0800
committerKyomotoi <[email protected]>2022-02-05 00:47:52 +0800
commitc38bab21b3c85e82250e3b82ebde31e2aca2db92 (patch)
treec0cee6ea72f8a8754a4c43927da6fe7954f54608 /ATRI/plugins/util
parent46b56e61866592f13a289064d56e1c1464353fdf (diff)
downloadATRI-c38bab21b3c85e82250e3b82ebde31e2aca2db92.tar.gz
ATRI-c38bab21b3c85e82250e3b82ebde31e2aca2db92.tar.bz2
ATRI-c38bab21b3c85e82250e3b82ebde31e2aca2db92.zip
🚑️🔒️🔧 大型修复工作
针对传回消息不同适配、外置限制改为nb内置限制
Diffstat (limited to 'ATRI/plugins/util')
-rw-r--r--ATRI/plugins/util/__init__.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/ATRI/plugins/util/__init__.py b/ATRI/plugins/util/__init__.py
index b67a988..e63870b 100644
--- a/ATRI/plugins/util/__init__.py
+++ b/ATRI/plugins/util/__init__.py
@@ -4,8 +4,8 @@ from random import choice, random
from nonebot.matcher import Matcher
from nonebot.params import CommandArg, ArgPlainText
from nonebot.adapters.onebot.v11 import MessageEvent, Message
+from nonebot.adapters.onebot.v11.helpers import Cooldown
-from ATRI.utils.limit import FreqLimiter
from .data_source import Encrypt, Utils, Yinglish
@@ -69,18 +69,14 @@ async def _deal_de(text: str = ArgPlainText("encr_de_text")):
sepi = Utils().on_command("涩批一下", "将正常的句子涩一涩~")
-_sepi_flmt = FreqLimiter(3)
-_sepi_flmt_notice = ["涩批爬", "✌🥵✌"]
+_sepi_flmt_notice = choice(["涩批爬", "✌🥵✌"])
+
[email protected]([Cooldown(3, prompt=_sepi_flmt_notice)])
async def _ready_sepi(
- matcher: Matcher, event: MessageEvent, args: Message = CommandArg()
+ matcher: Matcher, args: Message = CommandArg()
):
- user_id = event.get_user_id()
- if not _sepi_flmt.check(user_id):
- await sepi.finish(choice(_sepi_flmt_notice))
-
msg = args.extract_plain_text()
if msg:
matcher.set_arg("sepi_text", args)
@@ -93,5 +89,4 @@ async def _deal_sepi(event: MessageEvent, msg: str = ArgPlainText("sepi_text")):
await sepi.finish("这么短?涩不起来!")
result = Yinglish.deal(msg, random())
- _sepi_flmt.start_cd(user_id)
await sepi.finish(result)