test: skip setMyCommands when API mock lacks it

This commit is contained in:
Peter Steinberger
2026-01-12 22:08:53 +00:00
parent 5bc4971432
commit 59063a7c15
+6
View File
@@ -932,6 +932,7 @@ export function createTelegramBot(opts: TelegramBotOptions) {
? listNativeCommandSpecsForConfig(cfg)
: [];
if (nativeCommands.length > 0) {
if (typeof bot.api.setMyCommands === "function") {
bot.api
.setMyCommands(
nativeCommands.map((command) => ({
@@ -944,6 +945,11 @@ export function createTelegramBot(opts: TelegramBotOptions) {
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) => {