From a8f2d68c359be51dfc554be364d5a382dae00790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E8=90=BD?= <34079036+jiluoQAQ@users.noreply.github.com> Date: Fri, 23 Feb 2024 18:27:18 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=94=AF=E6=8C=81adapter.qq?= =?UTF-8?q?=E7=9A=84=E7=82=B9=E5=87=BB=E5=8F=91=E9=80=81=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=20(#620)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ 支持adapter.qq的点击发送按钮事件 * 🚨 `pre-commit-ci`修复格式错误 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- GenshinUID/__init__.py | 2 +- GenshinUID/client.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/GenshinUID/__init__.py b/GenshinUID/__init__.py index 1a315770..00c53d78 100644 --- a/GenshinUID/__init__.py +++ b/GenshinUID/__init__.py @@ -168,12 +168,12 @@ async def get_notice_message(bot: Bot, ev: Event): logger.debug('[gsuid] 不支持该 Telegram 事件...') return elif bot.adapter.get_name() == 'Discord': + from nonebot.adapters.discord import MessageComponentInteractionEvent from nonebot.adapters.discord.api import ( ChannelType, InteractionResponse, InteractionCallbackType, ) - from nonebot.adapters.discord import MessageComponentInteractionEvent sender = {} if isinstance(ev, MessageComponentInteractionEvent): diff --git a/GenshinUID/client.py b/GenshinUID/client.py index 750b16fb..1fcad5f7 100644 --- a/GenshinUID/client.py +++ b/GenshinUID/client.py @@ -377,7 +377,10 @@ def _bt(button: Dict): action = button['action'] if action == -1: action = 2 - + enter = None + if action == 1: + action = 2 + enter = True return Button( render_data=RenderData( label=button['text'], @@ -391,6 +394,7 @@ def _bt(button: Dict): specify_role_ids=button['specify_role_ids'], specify_user_ids=button['specify_user_ids'], ), + enter=enter, unsupport_tips=button['unsupport_tips'], data=button['data'], ),