Skip to content

Commit a14d2bf

Browse files
author
abdoo9
authored
🤖 Merge PR DefinitelyTyped#73605 (node-telegram-bot-api): Add missing types and fix getMyCommands signature by @abdoo9
1 parent 8293269 commit a14d2bf

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

‎types/node-telegram-bot-api/index.d.ts‎

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,6 +1525,19 @@ declare namespace TelegramBot {
15251525
| BotCommandScopeChat
15261526
| BotCommandScopeChatAdministrators
15271527
| BotCommandScopeChatMember;
1528+
1529+
interface BotName {
1530+
name: string;
1531+
}
1532+
1533+
interface BotDescription {
1534+
description: string;
1535+
}
1536+
1537+
interface BotShortDescription {
1538+
short_description: string;
1539+
}
1540+
15281541
interface WebAppInfo {
15291542
url: string;
15301543
}
@@ -2177,16 +2190,37 @@ declare class TelegramBot extends TelegramBotEventEmitter<TelegramBot.TelegramEv
21772190

21782191
setChatAdministratorCustomTitle(chatId: TelegramBot.ChatId, userId: number, customTitle: string): Promise<boolean>;
21792192

2180-
getMyCommands(scope?: TelegramBot.BotCommandScope, language_code?: string): Promise<TelegramBot.BotCommand[]>;
2193+
getMyCommands(
2194+
form?: { scope?: TelegramBot.BotCommandScope; language_code?: string },
2195+
): Promise<TelegramBot.BotCommand[]>;
21812196

21822197
setMyCommands(
21832198
commands: TelegramBot.BotCommand[],
2184-
options?: {
2199+
form?: {
21852200
language_code?: string;
21862201
scope?: TelegramBot.BotCommandScope;
21872202
},
21882203
): Promise<boolean>;
21892204

2205+
deleteMyCommands(
2206+
form?: {
2207+
language_code?: string;
2208+
scope?: TelegramBot.BotCommandScope;
2209+
},
2210+
): Promise<boolean>;
2211+
2212+
setMyName(form?: { name?: string; language_code?: string }): Promise<boolean>;
2213+
2214+
getMyName(form?: { language_code?: string }): Promise<TelegramBot.BotName>;
2215+
2216+
setMyDescription(form?: { description?: string; language_code?: string }): Promise<boolean>;
2217+
2218+
getMyDescription(form?: { language_code?: string }): Promise<TelegramBot.BotDescription>;
2219+
2220+
setMyShortDescription(form?: { short_description?: string; language_code?: string }): Promise<boolean>;
2221+
2222+
getMyShortDescription(form?: { language_code?: string }): Promise<TelegramBot.BotShortDescription>;
2223+
21902224
setChatMenuButton(form: { chat_id?: number; menu_button?: TelegramBot.MenuButton }): Promise<boolean>;
21912225

21922226
getChatMenuButton(form: { chat_id?: number }): Promise<TelegramBot.MenuButton>;

‎types/node-telegram-bot-api/node-telegram-bot-api-tests.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,24 @@ MyTelegramBot.setMyCommands([{ command: "command", description: "description" }]
478478
// @ts-expect-error
479479
scope: { type: "default", chat_id: 1234 },
480480
});
481+
MyTelegramBot.setMyName({ name: "My Bot" });
482+
MyTelegramBot.setMyName({ name: "My Bot", language_code: "ru" });
483+
MyTelegramBot.setMyName({});
484+
MyTelegramBot.getMyName();
485+
MyTelegramBot.getMyName({ language_code: "en" });
486+
MyTelegramBot.getMyName({ language_code: "ru" });
487+
MyTelegramBot.setMyDescription({ description: "My Bot Description" });
488+
MyTelegramBot.setMyDescription({ description: "My Bot Description", language_code: "ru" });
489+
MyTelegramBot.setMyDescription({});
490+
MyTelegramBot.getMyDescription();
491+
MyTelegramBot.getMyDescription({ language_code: "en" });
492+
MyTelegramBot.getMyDescription({ language_code: "ru" });
493+
MyTelegramBot.setMyShortDescription({ short_description: "Short Description" });
494+
MyTelegramBot.setMyShortDescription({ short_description: "Short Description", language_code: "ru" });
495+
MyTelegramBot.setMyShortDescription({});
496+
MyTelegramBot.getMyShortDescription();
497+
MyTelegramBot.getMyShortDescription({ language_code: "en" });
498+
MyTelegramBot.getMyShortDescription({ language_code: "ru" });
481499
MyTelegramBot.banChatSenderChat(1234, 1234);
482500
MyTelegramBot.unbanChatSenderChat(1234, 1234);
483501
MyTelegramBot.setChatMenuButton({

0 commit comments

Comments
 (0)