From 19cd7525f73a6f15474349ed1538441a1c0e66eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E8=90=BD?= <34079036+jiluoQAQ@users.noreply.github.com> Date: Wed, 28 Feb 2024 15:40:15 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=9B=9E=E8=B0=83=E6=B6=88=E6=81=AF=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E6=97=A0=E5=93=8D=E5=BA=94=E9=97=AE=E9=A2=98=20(#621)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ 修复按钮回调消息事件无响应问题 * 🚨 `pre-commit-ci`修复格式错误 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- GenshinUID/__init__.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/GenshinUID/__init__.py b/GenshinUID/__init__.py index 8b21010b..5c9694f7 100644 --- a/GenshinUID/__init__.py +++ b/GenshinUID/__init__.py @@ -47,12 +47,10 @@ else: async def get_notice_message(bot: Bot, ev: Event): if gsclient is None: return await connect() - try: await gsclient.ws.ping() except ConnectionClosed: return await connect() - raw_data = ev.dict() logger.debug(raw_data) @@ -209,7 +207,7 @@ async def get_notice_message(bot: Bot, ev: Event): else: logger.debug('[gsuid] 不支持该 Discord 事件...') return - elif bot.adapter.get_name() == 'qq': + elif bot.adapter.get_name() == 'QQ': from nonebot.adapters.qq.bot import Bot from nonebot.adapters.qq.event import InteractionCreateEvent @@ -233,15 +231,15 @@ async def get_notice_message(bot: Bot, ev: Event): user_type = 'direct' user_id = str(ev.user_openid) message = [Message('text', ev.data.resolved.button_data)] + await bot.put_interaction(interaction_id=ev.id, code=0) else: logger.debug('[gsuid] 不支持该 QQ 事件...') return else: return - msg = MessageReceive( - bot_id=bot_id, + bot_id=sp_bot_id if sp_bot_id else bot_id, bot_self_id=self_id, user_type=sp_user_type if sp_user_type else user_type, group_id=group_id, @@ -259,7 +257,6 @@ async def get_notice_message(bot: Bot, ev: Event): async def get_all_message(bot: Bot, ev: Event): if gsclient is None: return await connect() - try: await gsclient.ws.ping() except ConnectionClosed: @@ -643,7 +640,6 @@ async def get_all_message(bot: Bot, ev: Event): if not message: return - msg = MessageReceive( bot_id=bot_id, bot_self_id=self_id,