diff options
author | Kyomotoi <[email protected]> | 2021-07-31 16:16:47 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2021-07-31 16:16:47 +0800 |
commit | 336eb9d9e98b0bee952c27a50820dbdb350bcc03 (patch) | |
tree | 718d5349232bce0d06cc901707bdd8f478c43314 /ATRI/plugins/saucenao/__init__.py | |
parent | c485985d3be687d17168512de44ea7b744fea7cc (diff) | |
download | ATRI-336eb9d9e98b0bee952c27a50820dbdb350bcc03.tar.gz ATRI-336eb9d9e98b0bee952c27a50820dbdb350bcc03.tar.bz2 ATRI-336eb9d9e98b0bee952c27a50820dbdb350bcc03.zip |
🔥🚚✨
- 移除:laugh.txt,需要时再拉取
- 移动控制台文件至plugins/console目录下
- 新增:
- 和管理贴贴w
- 正式的可视化前端单页
Diffstat (limited to 'ATRI/plugins/saucenao/__init__.py')
-rw-r--r-- | ATRI/plugins/saucenao/__init__.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/ATRI/plugins/saucenao/__init__.py b/ATRI/plugins/saucenao/__init__.py index fddf0eb..468b001 100644 --- a/ATRI/plugins/saucenao/__init__.py +++ b/ATRI/plugins/saucenao/__init__.py @@ -10,13 +10,12 @@ from ATRI.utils.limit import FreqLimiter from .data_source import SaouceNao -_search_flmt = FreqLimiter(5) +_search_flmt = FreqLimiter(10) _search_flmt_notice = choice(["慢...慢一..点❤", "冷静1下", "歇会歇会~~"]) saucenao = SaouceNao().on_command("以图搜图", "透过一张图搜索可能的来源") - @saucenao.args_parser # type: ignore async def _get_img(bot: Bot, event: MessageEvent, state: T_State): msg = str(event.message).strip() @@ -28,18 +27,16 @@ async def _get_img(bot: Bot, event: MessageEvent, state: T_State): else: state["img"] = msg - @saucenao.handle() async def _ready_search(bot: Bot, event: MessageEvent, state: T_State): user_id = event.get_user_id() if not _search_flmt.check(user_id): await saucenao.finish(_search_flmt_notice) - + msg = str(event.message).strip() if msg: state["img"] = msg - @saucenao.got("img", "图呢?") async def _deal_search(bot: Bot, event: MessageEvent, state: T_State): user_id = event.get_user_id() @@ -47,7 +44,7 @@ async def _deal_search(bot: Bot, event: MessageEvent, state: T_State): img = findall(r"url=(.*?)]", msg) if not img: await saucenao.reject("请发送图片而不是其他东西!!") - + a = SaouceNao(SauceNAO.key) result = f"> {MessageSegment.at(user_id)}" + await a.search(img[0]) _search_flmt.start_cd(user_id) |