mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-19 22:10:51 +00:00
fix: keep Telegram status reactions enabled when getChat lookup fails
This commit is contained in:
@@ -562,7 +562,7 @@ export const buildTelegramMessageContext = async ({
|
||||
logVerbose(
|
||||
`telegram status-reaction available_reactions lookup failed for chat ${chatId}: ${String(err)}`,
|
||||
);
|
||||
return new Set<string>();
|
||||
return null;
|
||||
});
|
||||
}
|
||||
const allowedStatusReactionEmojis = await allowedStatusReactionEmojisPromise;
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user