Skip to content

Commit d264c76

Browse files
moltbot886claude
authored andcommitted
fix(telegram): add allow_sending_without_reply to prevent lost messages
When a Telegram message that OpenClaw is replying to gets deleted before delivery, the Telegram API rejects the entire sendMessage call with "message to be replied not found". This causes the bot's response to be silently lost and stuck in the failed delivery queue permanently. Setting allow_sending_without_reply: true tells Telegram to deliver the message as a standalone message if the reply target no longer exists, instead of failing the entire request. Applied to all 6 locations across 4 source files where reply_to_message_id is set: - send.ts: buildTelegramReplyParams (both reply_parameters and plain reply) - bot/delivery.send.ts: buildTelegramSendParams - draft-stream.ts: draft stream reply params - bot-handlers.runtime.ts: error reply messages (file too large, media download failed) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 3547b5f commit d264c76

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

extensions/telegram/src/bot-handlers.runtime.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,7 @@ export const registerTelegramHandlers = ({
10171017
fn: () =>
10181018
bot.api.sendMessage(chatId, `⚠️ File too large. Maximum size is ${limitMb}MB.`, {
10191019
reply_to_message_id: msg.message_id,
1020+
allow_sending_without_reply: true,
10201021
}),
10211022
}).catch(() => {});
10221023
}
@@ -1030,6 +1031,7 @@ export const registerTelegramHandlers = ({
10301031
fn: () =>
10311032
bot.api.sendMessage(chatId, "⚠️ Failed to download media. Please try again.", {
10321033
reply_to_message_id: msg.message_id,
1034+
allow_sending_without_reply: true,
10331035
}),
10341036
}).catch(() => {});
10351037
return;

extensions/telegram/src/bot/delivery.send.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export function buildTelegramSendParams(opts?: {
8282
const params: Record<string, unknown> = {};
8383
if (opts?.replyToMessageId) {
8484
params.reply_to_message_id = opts.replyToMessageId;
85+
params.allow_sending_without_reply = true;
8586
}
8687
if (threadParams) {
8788
params.message_thread_id = threadParams.message_thread_id;

extensions/telegram/src/draft-stream.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function createTelegramDraftStream(params: {
125125
const threadParams = buildTelegramThreadParams(params.thread);
126126
const replyParams =
127127
params.replyToMessageId != null
128-
? { ...threadParams, reply_to_message_id: params.replyToMessageId }
128+
? { ...threadParams, reply_to_message_id: params.replyToMessageId, allow_sending_without_reply: true }
129129
: threadParams;
130130
const resolvedDraftApi = prefersDraftTransport
131131
? resolveSendMessageDraftApi(params.api)

extensions/telegram/src/send.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,11 @@ function buildTelegramThreadReplyParams(params: {
394394
threadParams.reply_parameters = {
395395
message_id: replyToMessageId,
396396
quote: params.quoteText.trim(),
397+
allow_sending_without_reply: true,
397398
};
398399
} else {
399400
threadParams.reply_to_message_id = replyToMessageId;
401+
threadParams.allow_sending_without_reply = true;
400402
}
401403
}
402404
return threadParams;

0 commit comments

Comments
 (0)