telegram-bot-api-nodejs 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +34 -1
- package/index.js +8 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -46,6 +46,12 @@ export interface AnswerCallbackQueryOptions {
|
|
|
46
46
|
}
|
|
47
47
|
interface SetMyCommandsOptions {
|
|
48
48
|
commands: BotCommand[];
|
|
49
|
+
scope: BotCommandScope;
|
|
50
|
+
language_code: string | undefined;
|
|
51
|
+
}
|
|
52
|
+
interface GetMyCommandsOptions {
|
|
53
|
+
scope?: BotCommandScope;
|
|
54
|
+
language_code?: string;
|
|
49
55
|
}
|
|
50
56
|
interface DeleteMyCommandsOptions {
|
|
51
57
|
}
|
|
@@ -586,6 +592,32 @@ interface BotCommand {
|
|
|
586
592
|
command: string;
|
|
587
593
|
description: string;
|
|
588
594
|
}
|
|
595
|
+
type BotCommandScope = BotCommandScopeDefault | BotCommandScopeAllPrivateChats | BotCommandScopeAllGroupChats | BotCommandScopeAllChatAdministrators | BotCommandScopeChat | BotCommandScopeChatAdministrators | BotCommandScopeChatMember;
|
|
596
|
+
interface BotCommandScopeDefault {
|
|
597
|
+
type: 'default';
|
|
598
|
+
}
|
|
599
|
+
interface BotCommandScopeAllPrivateChats {
|
|
600
|
+
type: 'all_private_chats';
|
|
601
|
+
}
|
|
602
|
+
interface BotCommandScopeAllGroupChats {
|
|
603
|
+
type: 'all_group_chats';
|
|
604
|
+
}
|
|
605
|
+
interface BotCommandScopeAllChatAdministrators {
|
|
606
|
+
type: 'all_chat_administrators';
|
|
607
|
+
}
|
|
608
|
+
interface BotCommandScopeChat {
|
|
609
|
+
type: 'chat';
|
|
610
|
+
chat_id: number | string;
|
|
611
|
+
}
|
|
612
|
+
interface BotCommandScopeChatAdministrators {
|
|
613
|
+
type: 'chat_administrators';
|
|
614
|
+
chat_id: number | string;
|
|
615
|
+
}
|
|
616
|
+
interface BotCommandScopeChatMember {
|
|
617
|
+
type: 'chat_member';
|
|
618
|
+
chat_id: number | string;
|
|
619
|
+
user_id: number;
|
|
620
|
+
}
|
|
589
621
|
export declare function setWebhook(token: string, body: SetWebHookOptions, signal: AbortSignal): Promise<Boolean>;
|
|
590
622
|
export declare function deleteWebhook(token: string, params: {
|
|
591
623
|
drop_pending_updates?: boolean;
|
|
@@ -640,7 +672,8 @@ export declare function getChatMember(token: string, payload: {
|
|
|
640
672
|
chat_id: string;
|
|
641
673
|
user_id: string;
|
|
642
674
|
}, signal?: AbortSignal): Promise<ChatMember>;
|
|
643
|
-
export declare function setMyCommands(token: string, payload: SetMyCommandsOptions, signal?: AbortSignal): Promise<
|
|
675
|
+
export declare function setMyCommands(token: string, payload: SetMyCommandsOptions, signal?: AbortSignal): Promise<void>;
|
|
676
|
+
export declare function getMyCommands(token: string, payload?: GetMyCommandsOptions, signal?: AbortSignal): Promise<BotCommand[]>;
|
|
644
677
|
export declare function deleteMyCommands(token: string, payload: DeleteMyCommandsOptions, signal: AbortSignal): Promise<Chat>;
|
|
645
678
|
/**
|
|
646
679
|
* Parsers
|
package/index.js
CHANGED
|
@@ -166,6 +166,14 @@ export function setMyCommands(token, payload, signal) {
|
|
|
166
166
|
signal
|
|
167
167
|
}).then((parseResponse));
|
|
168
168
|
}
|
|
169
|
+
export function getMyCommands(token, payload, signal) {
|
|
170
|
+
return fetch(`https://api.telegram.org/bot${token}/getMyCommands`, {
|
|
171
|
+
method: "POST",
|
|
172
|
+
body: JSON.stringify(payload),
|
|
173
|
+
headers,
|
|
174
|
+
signal
|
|
175
|
+
}).then((parseResponse));
|
|
176
|
+
}
|
|
169
177
|
export function deleteMyCommands(token, payload, signal) {
|
|
170
178
|
return fetch(`https://api.telegram.org/bot${token}/deleteMyCommands`, {
|
|
171
179
|
method: "POST",
|