From 03d8b3aafdf7b26f017158625c6e136a87ec40b0 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Wed, 20 Nov 2024 09:17:57 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E5=85=81=E8=AE=B8=E8=B6=85?= =?UTF-8?q?=E7=BA=A7=E7=94=A8=E6=88=B7=E6=92=A4=E5=9B=9E=E4=BB=BB=E6=84=8F?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/builtin_plugins/withdraw.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/zhenxun/builtin_plugins/withdraw.py b/zhenxun/builtin_plugins/withdraw.py index 8186cfbc..81056e2c 100644 --- a/zhenxun/builtin_plugins/withdraw.py +++ b/zhenxun/builtin_plugins/withdraw.py @@ -46,10 +46,13 @@ _matcher = on_alconna(Alconna("撤回"), priority=5, block=True, rule=reply_chec @_matcher.handle() async def _(bot: Bot, event: Event, session: Uninfo, arparma: Arparma): if reply := await reply_fetch(event, bot): - if ( - MessageManager.check(session.user.id, reply.id) - or session.user.id in bot.config.superusers - ): + if session.user.id in bot.config.superusers: + try: + await bot.delete_msg(message_id=reply.id) + logger.info("撤回消息", arparma.header_result, session=session) + except Exception: + await MessageUtils.build_message("撤回失败,可能消息已过期...").send() + elif MessageManager.check(session.user.id, reply.id): try: await bot.delete_msg(message_id=reply.id) logger.info("撤回消息", arparma.header_result, session=session)