Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

The bot only parsed plain text messages (message_type: "text"), silently ignoring rich text messages (message_type: "post") sent with code blocks or formatting.

Changes

  • Added rich text message parsing: Implemented structures and logic to extract text from Lark's post message format, which contains language-specific content arrays with tagged elements
  • Unified message extraction: Created extractTextFromMessage() that handles both message types, preserving @mentions as @_user_N placeholders for regex matching
  • Updated command parsers: Both parseGroupCommand() and parsePrivateCommand() now use the new extraction function

Example

Rich text messages now parse correctly:

// Post message structure from Lark
{
  "zh_cn": {
    "content": [
      [
        {"tag": "at", "user_id": "ou_xxx"},
        {"tag": "text", "text": " /ask what is TiDB?"}
      ]
    ]
  }
}

// Extracts to: "@_user_1 /ask what is TiDB?"
// Bot now responds instead of silently ignoring
Original prompt

This section details on the original issue you should resolve

<issue_title>[chatops-lark] it did not response for rich format message.</issue_title>
<issue_description>I sent to the bot with the message but it has no feedback.

Image</issue_description>

<agent_instructions>please address the issue of chatops-lark project.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 2, 2025
- Added structures for parsing rich text (post) messages
- Implemented extractTextFromMessage function to handle both text and post message types
- Updated parseGroupCommand and parsePrivateCommand to use the new extraction function
- Added debug logging for message types
- Added comprehensive test coverage for text and post message parsing

Co-authored-by: wuhuizuo <2574558+wuhuizuo@users.noreply.github.com>
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 2, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from wuhuizuo. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 2, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from wuhuizuo. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added size/XL and removed size/XS labels Dec 2, 2025
Copilot AI and others added 3 commits December 2, 2025 04:25
Co-authored-by: wuhuizuo <2574558+wuhuizuo@users.noreply.github.com>
- Use counter for @mentions to handle multiple mentions properly
- Replace custom contains function with strings.Contains from stdlib
- Add fmt import for sprintf

Co-authored-by: wuhuizuo <2574558+wuhuizuo@users.noreply.github.com>
- Process lines properly to avoid trailing spaces
- More efficient string joining logic
- Better code structure

Co-authored-by: wuhuizuo <2574558+wuhuizuo@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix lack of response for rich format messages in chatops-lark Fix chatops-lark bot to handle rich text messages Dec 2, 2025
Copilot AI requested a review from wuhuizuo December 2, 2025 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[chatops-lark] it did not response for rich format message.

2 participants