🐛 尝试修复多重发送

This commit is contained in:
‘KimigaiiWuyi’ 2023-12-13 13:20:51 +08:00
parent e9a3f85ffc
commit 1de7d77525
2 changed files with 15 additions and 3 deletions

View File

@ -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

View File

@ -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),
}