Repository navigation
fix(feishu): send Markdown Bot replies as native Markdown cards - #34
Merged
Merged
Conversation
Checked replies and checked group posts always went out as msg_type text, so Markdown from Bot mode showed raw asterisks, hashes and pipes in Lark. A reply that uses Markdown now goes out as the same schema 2.0 Markdown card that chat already uses. Plain replies and replies with a text-message <at user_id> mention stay text, because other Bots and own Echo confirmation only read text messages. Refs BotHarness/DeepSeekBot#2792 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lpx6qnuRKPyBQWbwohCfMZ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Vain · project thread
Fixes BotHarness/DeepSeekBot#2792.
What was wrong
In Bot mode, the Lark replies DeepSeekBot sends always went out as
msg_type: text. That covers bothreplyChecked(a reply to the source message) andpostConversationChecked(a post to a group). So bold, headings and tables showed up as raw**,#and|. DSH's own chat already renders Markdown through a schema 2.0 Markdown card.Change
checkedTextFormat(text)returnsmarkdownwhen the text uses Markdown syntax. That means headings, lists, quotes, code, tables, bold, strikethrough or links. Otherwise it returnsplain.interactivewith the same native Markdown element as chat.sendProactiveTextandreplyCheckednow build the message from one shared helper.<at user_id>mention.textmessages.normalizeOwnTextEcho) is only read fromtextmessages. That covers report echo confirmation and theLARK-SETUP-OKsetup check.Known trade-off: a group report posted with Markdown will no longer get an Echo confirmation, because the echo of an interactive card is not read back. Plain reports keep it as before.
Tests
replyCheckedtest that checks the interactive card payload and that a plain reply stays text.test/reachable-feishu.test.mjsnow also checks a Markdown group post.npm test: 3638 passed, 0 failed. Both this branch andmainshow the same pre-existing cancellations in this environment (215 vs 214; the one extra is the new test, which passes when run on its own).Generated by Claude Code