test: skip setMyCommands when API mock lacks it
This commit is contained in:
@@ -932,6 +932,7 @@ export function createTelegramBot(opts: TelegramBotOptions) {
|
|||||||
? listNativeCommandSpecsForConfig(cfg)
|
? listNativeCommandSpecsForConfig(cfg)
|
||||||
: [];
|
: [];
|
||||||
if (nativeCommands.length > 0) {
|
if (nativeCommands.length > 0) {
|
||||||
|
if (typeof bot.api.setMyCommands === "function") {
|
||||||
bot.api
|
bot.api
|
||||||
.setMyCommands(
|
.setMyCommands(
|
||||||
nativeCommands.map((command) => ({
|
nativeCommands.map((command) => ({
|
||||||
@@ -944,6 +945,11 @@ export function createTelegramBot(opts: TelegramBotOptions) {
|
|||||||
danger(`telegram setMyCommands failed: ${String(err)}`),
|
danger(`telegram setMyCommands failed: ${String(err)}`),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
runtime.info?.(
|
||||||
|
"telegram: setMyCommands not available on api mock; skipping",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
for (const command of nativeCommands) {
|
for (const command of nativeCommands) {
|
||||||
bot.command(command.name, async (ctx) => {
|
bot.command(command.name, async (ctx) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user