-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
Telegram reply context: missing type guard causes [object Object] in message content #27201
Copy link
Copy link
Closed
Description
Bug Description
When processing Telegram reply contexts, describeReplyTarget() in the send handler lacks a typeof check on replyLike.text / replyLike.caption, causing [object Object] to appear in the delivered message content.
Location
dist/send-Bwxyans7.js line ~508:
body = (replyLike.text ?? replyLike.caption ?? "").trim();If replyLike.text or replyLike.caption is not a string (e.g., an object from a Telegram API edge case), JavaScript coerces it to [object Object].
Contrast with existing pattern
Elsewhere in the same codebase, proper type guards are used:
const text = typeof msg.text === "string" ? msg.text : void 0; // ✅The reply context path is missing this protection. ❌
Steps to Reproduce
- Run OpenClaw with Telegram channel configured
- Receive a message that is a reply to another message
- If the replied-to message's
textorcaptionfield is not a plain string (Telegram API edge case), the agent receives[object Object]instead of actual content
Expected Behavior
Reply context should apply typeof === "string" guard before using text/caption, falling back gracefully if the value is not a string.
Suggested Fix
const rawText = replyLike.text ?? replyLike.caption ?? "";
body = (typeof rawText === "string" ? rawText : "").trim();Environment
- OpenClaw latest (npm)
- Telegram channel
- macOS / Node v24
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.