diff options
author | Lint Action <[email protected]> | 2021-07-08 14:09:51 +0000 |
---|---|---|
committer | Lint Action <[email protected]> | 2021-07-08 14:09:51 +0000 |
commit | 951dcdf4ec224b31433c5ab5c170b76fd3087910 (patch) | |
tree | fe0ee2b5c219bd8f9796917ac3ee6286d4181146 /ATRI/plugins/saucenao/__init__.py | |
parent | be2747e4d4b820ca0f1f988d3b77a628da26fe7b (diff) | |
download | ATRI-951dcdf4ec224b31433c5ab5c170b76fd3087910.tar.gz ATRI-951dcdf4ec224b31433c5ab5c170b76fd3087910.tar.bz2 ATRI-951dcdf4ec224b31433c5ab5c170b76fd3087910.zip |
:rotating_light: 自动进行代码格式化
Diffstat (limited to 'ATRI/plugins/saucenao/__init__.py')
-rw-r--r-- | ATRI/plugins/saucenao/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ATRI/plugins/saucenao/__init__.py b/ATRI/plugins/saucenao/__init__.py index 9e52d66..fddf0eb 100644 --- a/ATRI/plugins/saucenao/__init__.py +++ b/ATRI/plugins/saucenao/__init__.py @@ -16,6 +16,7 @@ _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() @@ -27,16 +28,18 @@ 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() @@ -44,7 +47,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) |