From 8b0111a6e23745f6c51e2037564a2c8972bf84e9 Mon Sep 17 00:00:00 2001 From: Kyomotoi <0w0@imki.moe> Date: Sun, 17 Jul 2022 21:20:23 +0800 Subject: =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20=E4=BF=AE=E5=A4=8D=E8=AF=8D?= =?UTF-8?q?=E5=BA=93=E5=8C=B9=E9=85=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/thesaurus/listener.py | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'ATRI') diff --git a/ATRI/plugins/thesaurus/listener.py b/ATRI/plugins/thesaurus/listener.py index a05965c..5cf0baa 100644 --- a/ATRI/plugins/thesaurus/listener.py +++ b/ATRI/plugins/thesaurus/listener.py @@ -127,3 +127,44 @@ async def _tl_listener(event: MessageEvent): return else: await main_listener.finish(Message(choice(item_info.result))) + + query_result = await tl.get_item_list(int()) + if not query_result: + return + + shuffle(query_result) + + for item in query_result: + item_info: ThesaurusStoragor = item + + if not item_info.result: + continue + + if item_info.m_type == 1: + if item_info.matcher in msg: + if item_info.need_at: + if event.is_tome(): + await main_listener.finish(Message(choice(item_info.result))) + else: + return + else: + await main_listener.finish(Message(choice(item_info.result))) + elif item_info.m_type == 2: + patt = item_info.matcher + if re.findall(patt, msg): + if item_info.need_at: + if event.is_tome(): + await main_listener.finish(Message(choice(item_info.result))) + else: + return + else: + await main_listener.finish(Message(choice(item_info.result))) + else: + if item_info.matcher == msg: + if item_info.need_at: + if event.is_tome(): + await main_listener.finish(Message(choice(item_info.result))) + else: + return + else: + await main_listener.finish(Message(choice(item_info.result))) -- cgit v1.2.3