fix(telegram): also check caption for bot media replies

Address Greptile review feedback: bot media messages (photo/video) use
caption instead of text, so they would be incorrectly classified as
system messages.  Add !caption guard to the system message check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
scoootscooob
2026-03-02 15:01:53 -08:00
committed by Peter Steinberger
parent 8fdd1d2f05
commit dc2aa1e21d
2 changed files with 21 additions and 1 deletions

View File

@@ -478,7 +478,10 @@ export const buildTelegramMessageContext = async ({
const replyFromId = msg.reply_to_message?.from?.id;
const replyToBotMessage = botId != null && replyFromId === botId;
const isReplyToSystemMessage =
replyToBotMessage && msg.reply_to_message?.from?.is_bot === true && !msg.reply_to_message?.text;
replyToBotMessage &&
msg.reply_to_message?.from?.is_bot === true &&
!msg.reply_to_message?.text &&
!msg.reply_to_message?.caption;
const implicitMention = replyToBotMessage && !isReplyToSystemMessage;
const canDetectMention = Boolean(botUsername) || mentionRegexes.length > 0;
const mentionGate = resolveMentionGatingWithBypass({