Skip to content
Discussion options

You must be logged in to vote

这个问题是钉钉 Markdown 接口的渲染行为,并不是 AstrBot 本身的 Bug。

AstrBot 的钉钉适配器使用 client.reply_markdown 发送消息,单个 \n 通常不会被渲染成可见的换行。

如果需要换行,可以使用:

  • \n\n:分隔段落
  • <br/>:插入换行

例如:

msg = "第一行\n\n第二行"
yield event.plain_result(msg)

相关实现:[dingtalk_event.py](

async def send_with_client(
self,
client: dingtalk_stream.ChatbotHandler,
message: MessageChain,
):
icm = cast(dingtalk_stream.ChatbotMessage, self.message_obj.raw_message)
ats = []
# fixes: #4218
# 钉钉 at 机器人需要使用 sender_staff_id 而不是 sender_id
for i in message.chain:
if isinstance(i, Comp.At):
print(i.qq, icm.send…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by anka-afk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working area:platform The bug / feature is about IM platform adapter, such as QQ, Lark, Telegram, WebChat and so on.
2 participants
Converted from issue

This discussion was converted from issue #4456 on October 15, 2026 09:22.