Skip to content

[Bug]钉钉适配器,输出的msg中,需要两个\n才能换行 #4456

Closed

Description

@k1ngr4m

What happened / 发生了什么

钉钉适配器中,如果yield event.plain_result(msg)中的msg只有一个换行符\n,那么在钉钉收到的消息中没有换航
需要输入\n\n才能换行。

Reproduce / 如何复现?

        msg = f"📜 【角色详情:{character.name_zh}】\n"
        msg += f"简介:{character.description}\n"
        yield event.plain_result(msg)
Image
        msg = f"📜 【角色详情:{character.name_zh}】\n\n"
        msg += f"简介:{character.description}\n\n"
        yield event.plain_result(msg)
Image

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

astrbot: v4.10.2

OS

macOS

Logs / 报错日志

无报错

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Activity

  1. dosubot commented on Jan 14, 2026

    @dosubot

    钉钉适配器需要两个 \n 才能换行,是因为 AstrBot 发送消息时用的是钉钉的 markdown 格式接口(client.reply_markdown),而在 Markdown 语法里,单个换行符不会显示为换行,只有两个换行(\n\n)或插入 <br/> 才能产生可见的段落分隔或换行效果。这不是 AstrBot 的 bug,而是钉钉平台对 Markdown 渲染的标准行为,AstrBot 只是原样传递文本,没有做特殊处理。相关代码实现

    建议:如果需要换行,直接用 \n\n 或 <br/>。这个行为目前没有在 AstrBot 文档里明确说明,后续可以考虑补充到 FAQ 或文档里,方便新用户快速了解。

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about AstrBot with Dosu Add Dosu to your team

  2. added
    area:platformThe bug / feature is about IM platform adapter, such as QQ, Lark, Telegram, WebChat and so on.
    on Jan 14, 2026
  3. locked and limited conversation to collaborators on Oct 15, 2026
  4. converted this issue into a discussion #10570 on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:platformThe bug / feature is about IM platform adapter, such as QQ, Lark, Telegram, WebChat and so on.bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions