From 5520493edcc4542b326a4650f723daa1ea451973 Mon Sep 17 00:00:00 2001 From: Kyomotoi <0w0@imki.moe> Date: Sun, 20 Nov 2022 19:15:36 +0800 Subject: =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/setu/__init__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'ATRI/plugins/setu/__init__.py') diff --git a/ATRI/plugins/setu/__init__.py b/ATRI/plugins/setu/__init__.py index 1dea9b4..b7dc5f4 100644 --- a/ATRI/plugins/setu/__init__.py +++ b/ATRI/plugins/setu/__init__.py @@ -37,9 +37,11 @@ async def _random_setu(bot: Bot, event: MessageEvent): except Exception: await random_setu.finish("hso(发不出") - event_id = msg_1["message_id"] - loop.create_task(Setu.async_recall(bot, event_id)) - loop.close() + msg_id = msg_1["message_id"] + loop.call_later( + 60, + lambda: loop.create_task(bot.delete_msg(message_id=msg_id)) + ) @random_setu.got("r_rush_after_think", prompt="看完不来点感想么-w-") @@ -72,9 +74,11 @@ async def _tag_setu(bot: Bot, event: MessageEvent): except Exception: await random_setu.finish("hso(发不出") - event_id = msg_1["message_id"] - loop.create_task(Setu.async_recall(bot, event_id)) - loop.close() + msg_id = msg_1["message_id"] + loop.call_later( + 60, + lambda: loop.create_task(bot.delete_msg(message_id=msg_id)) + ) @tag_setu.got("t_rush_after_think", prompt="看完不来点感想么-w-") -- cgit v1.2.3 From cf506e1463c5b7e6ac5b5eed6271978515494af9 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Sun, 20 Nov 2022 11:16:56 +0000 Subject: =?UTF-8?q?:rotating=5Flight:=20=E8=87=AA=E5=8A=A8=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/setu/__init__.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'ATRI/plugins/setu/__init__.py') diff --git a/ATRI/plugins/setu/__init__.py b/ATRI/plugins/setu/__init__.py index b7dc5f4..46675fc 100644 --- a/ATRI/plugins/setu/__init__.py +++ b/ATRI/plugins/setu/__init__.py @@ -38,10 +38,7 @@ async def _random_setu(bot: Bot, event: MessageEvent): await random_setu.finish("hso(发不出") msg_id = msg_1["message_id"] - loop.call_later( - 60, - lambda: loop.create_task(bot.delete_msg(message_id=msg_id)) - ) + loop.call_later(60, lambda: loop.create_task(bot.delete_msg(message_id=msg_id))) @random_setu.got("r_rush_after_think", prompt="看完不来点感想么-w-") @@ -75,10 +72,7 @@ async def _tag_setu(bot: Bot, event: MessageEvent): await random_setu.finish("hso(发不出") msg_id = msg_1["message_id"] - loop.call_later( - 60, - lambda: loop.create_task(bot.delete_msg(message_id=msg_id)) - ) + loop.call_later(60, lambda: loop.create_task(bot.delete_msg(message_id=msg_id))) @tag_setu.got("t_rush_after_think", prompt="看完不来点感想么-w-") -- cgit v1.2.3 From 1ee2eae499b79bf0d22212184bffd57d873826cc Mon Sep 17 00:00:00 2001 From: Kyomotoi <0w0@imki.moe> Date: Fri, 2 Dec 2022 08:52:19 +0800 Subject: =?UTF-8?q?=F0=9F=8E=A8=20=E9=87=8D=E6=9E=84=E6=B6=A9=E5=9B=BE?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/setu/__init__.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'ATRI/plugins/setu/__init__.py') diff --git a/ATRI/plugins/setu/__init__.py b/ATRI/plugins/setu/__init__.py index b7dc5f4..4a9c6a6 100644 --- a/ATRI/plugins/setu/__init__.py +++ b/ATRI/plugins/setu/__init__.py @@ -29,13 +29,14 @@ async def _(): async def _random_setu(bot: Bot, event: MessageEvent): loop = asyncio.get_running_loop() - repo, se = await Setu.random_setu() - await bot.send(event, repo) + setu, setu_data = await Setu.new() + setu_info = f"Title: {setu_data.title}\nPid: {setu_data.pid}" + await bot.send(event, setu_info) try: - msg_1 = await bot.send(event, Message(se)) + msg_1 = await bot.send(event, setu) except Exception: - await random_setu.finish("hso(发不出") + await random_setu.finish("hso (发不出") msg_id = msg_1["message_id"] loop.call_later( @@ -56,23 +57,21 @@ async def _(think: str = ArgPlainText("r_rush_after_think")): tag_setu = plugin.on_regex(r"来[张点丶份](.*?)的[涩色🐍]图", "根据提供的tag查找涩图,冷却2分钟") -@tag_setu.handle([Cooldown(120, prompt="慢...慢一..点❤")]) +@tag_setu.handle([Cooldown(120, prompt="")]) async def _tag_setu(bot: Bot, event: MessageEvent): loop = asyncio.get_running_loop() msg = str(event.get_message()).strip() pattern = r"来[张点丶份](.*?)的[涩色🐍]图" tag = re.findall(pattern, msg)[0] - repo, se = await Setu.tag_setu(tag) - if not plugin: - await tag_setu.finish(repo) - - await bot.send(event, repo) + setu, setu_data = await Setu.new(tag) + setu_info = f"Title: {setu_data.title}\nPid: {setu_data.pid}" + await bot.send(event, setu_info) try: - msg_1 = await bot.send(event, Message(se)) + msg_1 = await bot.send(event, setu) except Exception: - await random_setu.finish("hso(发不出") + await random_setu.finish("hso (发不出") msg_id = msg_1["message_id"] loop.call_later( @@ -105,7 +104,7 @@ async def _setu_catcher(bot: Bot, event: MessageEvent): hso = list() for i in args: try: - data = await Setu.detecter(i, _catcher_max_file_size) + data = await Setu(i).detecter(_catcher_max_file_size) except Exception: return if data > 0.7: @@ -144,7 +143,7 @@ async def _deal_check(bot: Bot, event: MessageEvent): if not args: await nsfw_checker.reject("请发送图片而不是其他东西!!") - hso = await Setu.detecter(args[0], _catcher_max_file_size) + hso = await Setu(args[0]).detecter(_catcher_max_file_size) if not hso: await nsfw_checker.finish("图太小了!不测!") -- cgit v1.2.3