From 1de7d77525788eb921b20dc1df94a3254e4aeca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98KimigaiiWuyi=E2=80=99?= <444835641@qq.com> Date: Wed, 13 Dec 2023 13:20:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E5=B0=9D=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=A4=9A=E9=87=8D=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gsuid_core/bot.py | 13 ++++++++++--- gsuid_core/utils/plugins_config/config_default.py | 5 +++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gsuid_core/bot.py b/gsuid_core/bot.py index 87975f7..bba42b4 100644 --- a/gsuid_core/bot.py +++ b/gsuid_core/bot.py @@ -22,10 +22,12 @@ sp_msg_id: str = core_plugins_config.get_config('SpecificMsgId').data is_sp_msg_id: str = core_plugins_config.get_config('EnableSpecificMsgId').data ism: List = core_plugins_config.get_config('SendMDPlatform').data isb: List = core_plugins_config.get_config('SendButtonsPlatform').data +isc: List = core_plugins_config.get_config('SendTemplatePlatform').data istry: List = core_plugins_config.get_config('TryTemplateForQQ').data enable_buttons_platform = isb enable_markdown_platform = ism +enable_Template_platform = isc class _Bot: @@ -185,7 +187,9 @@ class Bot: _reply = await convert_message(reply, self.bot_id) success = False - if self.ev.real_bot_id in enable_buttons_platform or istry: + if self.ev.real_bot_id in enable_buttons_platform or ( + istry and self.ev.real_bot_id in enable_Template_platform + ): _buttons = [] for option in option_list: if isinstance(option, List): @@ -207,7 +211,7 @@ class Bot: await self.send(md) success = True - if istry: + if istry and not success and self.ev.bot_id in isc: md = await markdown_to_template_markdown(md) fake_buttons = parse_button(_buttons) for custom_template_id in button_templates: @@ -222,7 +226,10 @@ class Bot: await self.send(md) break - if not success: + if ( + not success + and self.ev.real_bot_id in enable_buttons_platform + ): _reply.append(MessageSegment.buttons(_buttons)) await self.send(_reply) success = True diff --git a/gsuid_core/utils/plugins_config/config_default.py b/gsuid_core/utils/plugins_config/config_default.py index c056869..2fd9bd4 100644 --- a/gsuid_core/utils/plugins_config/config_default.py +++ b/gsuid_core/utils/plugins_config/config_default.py @@ -70,6 +70,11 @@ CONIFG_DEFAULT: Dict[str, GSC] = { '发送按钮的平台列表', ["villa", "kaiheila", "dodo", "discord", "telegram"], ), + 'SendTemplatePlatform': GsListStrConfig( + '默认发送模板按钮/MD的平台列表(用:连接)', + '发送按钮的平台列表', + ["qqgroup", "qqguild"], + ), 'TryTemplateForQQ': GsBoolConfig('启用后尝试读取模板文件并发送', '发送MD和按钮模板', True), 'ForceSendMD': GsBoolConfig('强制使用MD发送图文', '强制使用MD发送图文', False), }