diff --git a/src/telegram/bot-message-context.ts b/src/telegram/bot-message-context.ts index 8d9a722c927..951b381d216 100644 --- a/src/telegram/bot-message-context.ts +++ b/src/telegram/bot-message-context.ts @@ -562,7 +562,7 @@ export const buildTelegramMessageContext = async ({ logVerbose( `telegram status-reaction available_reactions lookup failed for chat ${chatId}: ${String(err)}`, ); - return new Set(); + return null; }); } const allowedStatusReactionEmojis = await allowedStatusReactionEmojisPromise; diff --git a/src/telegram/status-reaction-variants.test.ts b/src/telegram/status-reaction-variants.test.ts index 09f865a6348..53d13e60ca8 100644 --- a/src/telegram/status-reaction-variants.test.ts +++ b/src/telegram/status-reaction-variants.test.ts @@ -97,6 +97,20 @@ describe("resolveTelegramAllowedEmojiReactions", () => { expect(result ? Array.from(result) : null).toEqual(["👍"]); }); + + it("falls back to unrestricted reactions when getChat lookup fails", async () => { + const getChat = async () => { + throw new Error("lookup failed"); + }; + + const result = await resolveTelegramAllowedEmojiReactions({ + chat: { id: 1 }, + chatId: 1, + getChat, + }); + + expect(result).toBeNull(); + }); }); describe("resolveTelegramReactionVariant", () => { diff --git a/src/telegram/status-reaction-variants.ts b/src/telegram/status-reaction-variants.ts index fc189f200fa..5f79b1cbadb 100644 --- a/src/telegram/status-reaction-variants.ts +++ b/src/telegram/status-reaction-variants.ts @@ -200,10 +200,14 @@ export async function resolveTelegramAllowedEmojiReactions(params: { } if (params.getChat) { - const chatInfo = await params.getChat(params.chatId); - const fromLookup = extractTelegramAllowedEmojiReactions(chatInfo); - if (fromLookup !== undefined) { - return fromLookup; + try { + const chatInfo = await params.getChat(params.chatId); + const fromLookup = extractTelegramAllowedEmojiReactions(chatInfo); + if (fromLookup !== undefined) { + return fromLookup; + } + } catch { + return null; } }