diff --git a/extensions/telegram/src/bot.ts b/extensions/telegram/src/bot.ts index 554d5f185b3..ecec8b2f47f 100644 --- a/extensions/telegram/src/bot.ts +++ b/extensions/telegram/src/bot.ts @@ -491,11 +491,7 @@ export function createTelegramBot(opts: TelegramBotOptions) { // from ANY chat are tracked together — prevents infinite retry storms. const sendChatActionHandler = createTelegramSendChatActionHandler({ sendChatActionFn: (chatId, action, threadParams) => - bot.api.sendChatAction( - chatId, - action, - threadParams as Parameters[2], - ), + bot.api.sendChatAction(chatId, action, threadParams), logger: (message) => logVerbose(`telegram: ${message}`), }); diff --git a/extensions/telegram/src/sendchataction-401-backoff.ts b/extensions/telegram/src/sendchataction-401-backoff.ts index 1db03e2ac22..d8b08492674 100644 --- a/extensions/telegram/src/sendchataction-401-backoff.ts +++ b/extensions/telegram/src/sendchataction-401-backoff.ts @@ -1,3 +1,4 @@ +import type { Bot } from "grammy"; import { computeBackoff, sleepWithAbort, @@ -19,11 +20,13 @@ type ChatAction = | "upload_video_note" | "choose_sticker"; +type TelegramSendChatActionParams = Parameters[2]; + type SendChatActionFn = ( chatId: number | string, action: ChatAction, - threadParams?: unknown, -) => Promise; + threadParams?: TelegramSendChatActionParams, +) => Promise; export type TelegramSendChatActionHandler = { /** @@ -33,7 +36,7 @@ export type TelegramSendChatActionHandler = { sendChatAction: ( chatId: number | string, action: ChatAction, - threadParams?: unknown, + threadParams?: TelegramSendChatActionParams, ) => Promise; isSuspended: () => boolean; reset: () => void; @@ -85,7 +88,7 @@ export function createTelegramSendChatActionHandler({ const sendChatAction = async ( chatId: number | string, action: ChatAction, - threadParams?: unknown, + threadParams?: TelegramSendChatActionParams, ): Promise => { if (suspended) { return;