From 59063a7c1555cd0b5813a5a059986e7e9c89383b Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 12 Jan 2026 22:08:53 +0000 Subject: [PATCH] test: skip setMyCommands when API mock lacks it --- src/telegram/bot.ts | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/telegram/bot.ts b/src/telegram/bot.ts index f92ad8682..54e560224 100644 --- a/src/telegram/bot.ts +++ b/src/telegram/bot.ts @@ -932,18 +932,24 @@ export function createTelegramBot(opts: TelegramBotOptions) { ? listNativeCommandSpecsForConfig(cfg) : []; if (nativeCommands.length > 0) { - bot.api - .setMyCommands( - nativeCommands.map((command) => ({ - command: command.name, - description: command.description, - })), - ) - .catch((err) => { - runtime.error?.( - danger(`telegram setMyCommands failed: ${String(err)}`), - ); - }); + if (typeof bot.api.setMyCommands === "function") { + bot.api + .setMyCommands( + nativeCommands.map((command) => ({ + command: command.name, + description: command.description, + })), + ) + .catch((err) => { + runtime.error?.( + danger(`telegram setMyCommands failed: ${String(err)}`), + ); + }); + } else { + runtime.info?.( + "telegram: setMyCommands not available on api mock; skipping", + ); + } for (const command of nativeCommands) { bot.command(command.name, async (ctx) => {