mirror of
https://github.com/Genshin-bots/gsuid_core.git
synced 2025-05-12 06:55:49 +08:00
🐛 将Mardown和按钮类型分离
This commit is contained in:
parent
eb5b2aa134
commit
f499e446ce
@ -190,10 +190,13 @@ class Bot:
|
||||
_buttons.append(option)
|
||||
else:
|
||||
_buttons.append(Button(option, option, option))
|
||||
|
||||
await self.send(
|
||||
await to_markdown(_reply, _buttons, self.bot_id)
|
||||
)
|
||||
if self.ev.real_bot_id in enable_markdown_platform:
|
||||
await self.send(
|
||||
await to_markdown(_reply, _buttons, self.bot_id)
|
||||
)
|
||||
else:
|
||||
_reply.append(MessageSegment.buttons(_buttons))
|
||||
await self.send(_reply)
|
||||
else:
|
||||
if unsuported_platform:
|
||||
_options: List[str] = []
|
||||
|
@ -80,6 +80,12 @@ class MessageSegment:
|
||||
def text(content: str) -> Message:
|
||||
return Message(type='text', data=content)
|
||||
|
||||
@staticmethod
|
||||
def buttons(
|
||||
buttons: Optional[Union[List[Button], List[List[Button]]]] = None,
|
||||
) -> Message:
|
||||
return Message(type='buttons', data=msgspec.to_builtins(buttons))
|
||||
|
||||
@staticmethod
|
||||
def markdown(
|
||||
content: str,
|
||||
@ -87,9 +93,7 @@ class MessageSegment:
|
||||
) -> List[Message]:
|
||||
data = [Message(type='markdown', data=content)]
|
||||
if buttons:
|
||||
data.append(
|
||||
Message(type='buttons', data=msgspec.to_builtins(buttons))
|
||||
)
|
||||
data.append(MessageSegment.buttons(buttons))
|
||||
|
||||
return data
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user