mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 15:38:25 +00:00
fix(telegram): surface REACTION_INVALID as non-fatal warning (#14340)
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -596,7 +596,7 @@ export async function reactMessageTelegram(
|
||||
messageIdInput: string | number,
|
||||
emoji: string,
|
||||
opts: TelegramReactionOpts = {},
|
||||
): Promise<{ ok: true }> {
|
||||
): Promise<{ ok: true } | { ok: false; warning: string }> {
|
||||
const cfg = loadConfig();
|
||||
const account = resolveTelegramAccount({
|
||||
cfg,
|
||||
@@ -633,7 +633,15 @@ export async function reactMessageTelegram(
|
||||
if (typeof api.setMessageReaction !== "function") {
|
||||
throw new Error("Telegram reactions are unavailable in this bot API.");
|
||||
}
|
||||
await requestWithDiag(() => api.setMessageReaction(chatId, messageId, reactions), "reaction");
|
||||
try {
|
||||
await requestWithDiag(() => api.setMessageReaction(chatId, messageId, reactions), "reaction");
|
||||
} catch (err: unknown) {
|
||||
const msg = err instanceof Error ? err.message : String(err);
|
||||
if (/REACTION_INVALID/i.test(msg)) {
|
||||
return { ok: false as const, warning: `Reaction unavailable: ${trimmedEmoji}` };
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
return { ok: true };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user