fix: require thread specs for telegram sends

This commit is contained in:
Ayaan Zaidi
2026-02-02 09:05:36 +05:30
committed by Ayaan Zaidi
parent 19b8416a81
commit 1d7dd5f261
5 changed files with 22 additions and 20 deletions

View File

@@ -221,7 +221,9 @@ export async function sendMessageTelegram(
// Only include these if actually provided to keep API calls clean.
const messageThreadId =
opts.messageThreadId != null ? opts.messageThreadId : target.messageThreadId;
const threadIdParams = buildTelegramThreadParams(messageThreadId);
const threadSpec =
messageThreadId != null ? { id: messageThreadId, scope: "forum" as const } : undefined;
const threadIdParams = buildTelegramThreadParams(threadSpec);
const threadParams: Record<string, unknown> = threadIdParams ? { ...threadIdParams } : {};
const quoteText = opts.quoteText?.trim();
if (opts.replyToMessageId != null) {
@@ -694,7 +696,9 @@ export async function sendStickerTelegram(
const messageThreadId =
opts.messageThreadId != null ? opts.messageThreadId : target.messageThreadId;
const threadIdParams = buildTelegramThreadParams(messageThreadId);
const threadSpec =
messageThreadId != null ? { id: messageThreadId, scope: "forum" as const } : undefined;
const threadIdParams = buildTelegramThreadParams(threadSpec);
const threadParams: Record<string, number> = threadIdParams ? { ...threadIdParams } : {};
if (opts.replyToMessageId != null) {
threadParams.reply_to_message_id = Math.trunc(opts.replyToMessageId);