fix(telegram): unify inbound handling for message-like updates (#20591)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 442a100071
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
Ayaan Zaidi
2026-02-19 09:54:47 +05:30
committed by GitHub
parent 6b05916c14
commit d17a1f387b
5 changed files with 181 additions and 161 deletions

View File

@@ -19,9 +19,13 @@ export type TelegramUpdateKeyContext = {
update_id?: number;
message?: Message;
edited_message?: Message;
channel_post?: Message;
edited_channel_post?: Message;
};
update_id?: number;
message?: Message;
channelPost?: Message;
editedChannelPost?: Message;
callbackQuery?: { id?: string; message?: Message };
};
@@ -38,7 +42,14 @@ export const buildTelegramUpdateKey = (ctx: TelegramUpdateKeyContext) => {
return `callback:${callbackId}`;
}
const msg =
ctx.message ?? ctx.update?.message ?? ctx.update?.edited_message ?? ctx.callbackQuery?.message;
ctx.message ??
ctx.channelPost ??
ctx.editedChannelPost ??
ctx.update?.message ??
ctx.update?.edited_message ??
ctx.update?.channel_post ??
ctx.update?.edited_channel_post ??
ctx.callbackQuery?.message;
const chatId = msg?.chat?.id;
const messageId = msg?.message_id;
if (typeof chatId !== "undefined" && typeof messageId === "number") {