telegram-bot-api-nodejs 1.0.18 → 1.0.20

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.
Files changed (3) hide show
  1. package/index.d.ts +39 -1
  2. package/index.js +8 -0
  3. 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
  }
@@ -188,6 +194,7 @@ export interface Message {
188
194
  game?: Game;
189
195
  photo?: PhotoSize[];
190
196
  sticker?: Sticker;
197
+ story?: Story;
191
198
  video?: Video;
192
199
  voice?: Voice;
193
200
  video_note?: VideoNote;
@@ -293,6 +300,10 @@ export interface Document extends FileBase {
293
300
  mime_type?: string;
294
301
  file_size?: number;
295
302
  }
303
+ export interface Story {
304
+ chat: Chat;
305
+ id: number;
306
+ }
296
307
  export interface Video extends FileBase {
297
308
  width: number;
298
309
  height: number;
@@ -586,6 +597,32 @@ interface BotCommand {
586
597
  command: string;
587
598
  description: string;
588
599
  }
600
+ type BotCommandScope = BotCommandScopeDefault | BotCommandScopeAllPrivateChats | BotCommandScopeAllGroupChats | BotCommandScopeAllChatAdministrators | BotCommandScopeChat | BotCommandScopeChatAdministrators | BotCommandScopeChatMember;
601
+ interface BotCommandScopeDefault {
602
+ type: 'default';
603
+ }
604
+ interface BotCommandScopeAllPrivateChats {
605
+ type: 'all_private_chats';
606
+ }
607
+ interface BotCommandScopeAllGroupChats {
608
+ type: 'all_group_chats';
609
+ }
610
+ interface BotCommandScopeAllChatAdministrators {
611
+ type: 'all_chat_administrators';
612
+ }
613
+ interface BotCommandScopeChat {
614
+ type: 'chat';
615
+ chat_id: number | string;
616
+ }
617
+ interface BotCommandScopeChatAdministrators {
618
+ type: 'chat_administrators';
619
+ chat_id: number | string;
620
+ }
621
+ interface BotCommandScopeChatMember {
622
+ type: 'chat_member';
623
+ chat_id: number | string;
624
+ user_id: number;
625
+ }
589
626
  export declare function setWebhook(token: string, body: SetWebHookOptions, signal: AbortSignal): Promise<Boolean>;
590
627
  export declare function deleteWebhook(token: string, params: {
591
628
  drop_pending_updates?: boolean;
@@ -640,7 +677,8 @@ export declare function getChatMember(token: string, payload: {
640
677
  chat_id: string;
641
678
  user_id: string;
642
679
  }, signal?: AbortSignal): Promise<ChatMember>;
643
- export declare function setMyCommands(token: string, payload: SetMyCommandsOptions, signal?: AbortSignal): Promise<Chat>;
680
+ export declare function setMyCommands(token: string, payload: SetMyCommandsOptions, signal?: AbortSignal): Promise<void>;
681
+ export declare function getMyCommands(token: string, payload?: GetMyCommandsOptions, signal?: AbortSignal): Promise<BotCommand[]>;
644
682
  export declare function deleteMyCommands(token: string, payload: DeleteMyCommandsOptions, signal: AbortSignal): Promise<Chat>;
645
683
  /**
646
684
  * 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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telegram-bot-api-nodejs",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Telegram Bot API client for nodejs",
5
5
  "type": "module",
6
6
  "main": "index.js",