Telegram: remove @ts-nocheck from bot.ts, fix duplicate error handler, harden sticker caching (#9077)

* Telegram: remove @ts-nocheck from bot.ts and bot-message-dispatch.ts

- bot/types.ts: TelegramContext.me uses UserFromGetMe (Grammy) instead of manual inline type
- bot.ts: remove 6 unsafe casts (as any, as unknown, as object), use Grammy types directly
- bot.ts: remove dead message_thread_id access on reactions (not in Telegram Bot API)
- bot.ts: remove resolveThreadSessionKeys import (no longer needed for reactions)
- bot-message-dispatch.ts: replace ': any' with DispatchTelegramMessageParams type
- bot-message-dispatch.ts: add sticker.fileId guard before cache access
- bot.test.ts: update reaction tests, remove dead DM thread-reaction test

* Telegram: remove duplicate bot.catch handler (only the last one runs in Grammy)

* Telegram: remove @ts-nocheck from bot.ts, fix duplicate error handler, harden sticker caching (#9077)
This commit is contained in:
Christian Klotz
2026-02-04 22:35:51 +00:00
committed by GitHub
parent 38e6da1fe0
commit 96abc1c864
5 changed files with 28 additions and 84 deletions

View File

@@ -1,4 +1,4 @@
import type { Message } from "@grammyjs/types";
import type { Message, UserFromGetMe } from "@grammyjs/types";
/** App-specific stream mode for Telegram draft streaming. */
export type TelegramStreamMode = "off" | "partial" | "block";
@@ -10,7 +10,7 @@ export type TelegramStreamMode = "off" | "partial" | "block";
*/
export type TelegramContext = {
message: Message;
me?: { id?: number; username?: string };
me?: UserFromGetMe;
getFile: () => Promise<{ file_path?: string }>;
};