Skip to content

[Bug]: discord-app read returns empty Message for embed-only bot messages #2287

Description

@niyoh120

Summary

opencli discord-app read returns an empty Message field for embed-only messages (bot cards such as macro-news digest bots), while Author, Time, channel_id, and message_id are all populated correctly.

Adapter

  • Site: discord-app
  • Command: read
  • OpenCLI version: 1.8.6

Original failure

  • Error code: none — command exits 0 with EMPTY message text
[
  {
    "Author": "黄金蛙🐸APP",
    "Time": "2026-08-14T16:01:24.926Z",
    "Message": "",
    "channel_id": "1398004432406450248",
    "message_id": "1537853661856923669"
  }
]

The rendered message is a bot embed card with visible text ("24小时重要宏观事件…"), so the data is on screen but not captured.

Root cause

buildReadMessagesScript() in clis/discord-app/utils.js extracts text only from [id^="message-content-"], [class*="messageContent"]. For embed-only messages that element exists but is empty — the actual text lives in [class*="embedWrapper"] / article[class*="embed"].

Local fix summary

In the per-node loop: read textOf(contentEl) first; if empty, fall back to node.querySelector('[class*="embedWrapper"], article[class*="embed"]') and use its text for Message (keep dedup key and gating unchanged). Verified locally: plain-text channels and embed-only channels both return correct text; servers/channels/status unaffected.

Environment

  • opencli 1.8.6, Node 22.x, Debian 13 (trixie), headless Xvfb
  • Discord Desktop 1.0.153 (Electron 42.7.1, Chrome/148)

Issue filed after a verified local repair.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions