grammy 1.15.2 → 1.16.0

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/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  <!-- deno-fmt-ignore-start -->
12
12
 
13
- [![Bot API](https://img.shields.io/badge/Bot%20API-6.6-blue?logo=telegram&style=flat&labelColor=000&color=3b82f6)](https://core.telegram.org/bots/api)
13
+ [![Bot API](https://img.shields.io/badge/Bot%20API-6.7-blue?logo=telegram&style=flat&labelColor=000&color=3b82f6)](https://core.telegram.org/bots/api)
14
14
  [![Deno](https://shield.deno.dev/x/grammy)](https://deno.land/x/grammy)
15
15
  [![npm](https://img.shields.io/npm/v/grammy?logo=npm&style=flat&labelColor=000&color=3b82f6)](https://www.npmjs.org/package/grammy)
16
16
  [![All Contributors](https://img.shields.io/github/all-contributors/grammyjs/grammy?style=flat&labelColor=000&color=3b82f6)](#contributors-)
@@ -264,6 +264,12 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
264
264
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/gertminov"><img src="https://avatars.githubusercontent.com/u/78727928?v=4?s=100" width="100px;" alt="gertminov"/><br /><sub><b>gertminov</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=gertminov" title="Documentation">📖</a> <a href="#tutorial-gertminov" title="Tutorials">✅</a></td>
265
265
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/amanape"><img src="https://avatars.githubusercontent.com/u/83104063?v=4?s=100" width="100px;" alt="Stephan Psaras"/><br /><sub><b>Stephan Psaras</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aamanape" title="Bug reports">🐛</a></td>
266
266
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/shevernitskiy"><img src="https://avatars.githubusercontent.com/u/28886342?v=4?s=100" width="100px;" alt="shevernitskiy"/><br /><sub><b>shevernitskiy</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Ashevernitskiy" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Ashevernitskiy" title="Reviewed Pull Requests">👀</a></td>
267
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/mrmaster009"><img src="https://avatars.githubusercontent.com/u/81420490?v=4?s=100" width="100px;" alt="mrmaster009"/><br /><sub><b>mrmaster009</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=mrmaster009" title="Documentation">📖</a></td>
268
+ <td align="center" valign="top" width="14.28%"><a href="https://lwjerri.dev/"><img src="https://avatars.githubusercontent.com/u/50290430?v=4?s=100" width="100px;" alt="Andrey Zontov"/><br /><sub><b>Andrey Zontov</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3ALWJerri" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/commits?author=LWJerri" title="Code">💻</a> <a href="#question-LWJerri" title="Answering Questions">💬</a> <a href="#ideas-LWJerri" title="Ideas, Planning, & Feedback">🤔</a></td>
269
+ </tr>
270
+ <tr>
271
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/AbbassAlmusawi"><img src="https://avatars.githubusercontent.com/u/73327881?v=4?s=100" width="100px;" alt="Abbass Al-Musawi"/><br /><sub><b>Abbass Al-Musawi</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=AbbassAlmusawi" title="Documentation">📖</a></td>
272
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/inji-gg"><img src="https://avatars.githubusercontent.com/u/5071242?v=4?s=100" width="100px;" alt="ArunR"/><br /><sub><b>ArunR</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Ainji-gg" title="Bug reports">🐛</a></td>
267
273
  </tr>
268
274
  </tbody>
269
275
  </table>
package/out/context.d.ts CHANGED
@@ -1181,7 +1181,7 @@ type InlineQueryContextCore = FilterCore<"inline_query">;
1181
1181
  * in separate files and still have the correct types.
1182
1182
  */
1183
1183
  export type InlineQueryContext<C extends Context> = Filter<C, "inline_query">;
1184
- type ChatTypeContextCore<T extends Chat["type"]> = Record<"update", ChatTypeUpdate<T>> & ChatType<T> & ChatTypeRecord<"msg", T> & AliasProps<ChatTypeUpdate<T>>;
1184
+ type ChatTypeContextCore<T extends Chat["type"]> = Record<"update", ChatTypeUpdate<T>> & ChatType<T> & ChatFrom<T> & ChatTypeRecord<"msg", T> & AliasProps<ChatTypeUpdate<T>>;
1185
1185
  /**
1186
1186
  * Type of the context object that is available inside the handlers for
1187
1187
  * `bot.chatType`.
@@ -1203,5 +1203,8 @@ interface ChatType<T extends Chat["type"]> {
1203
1203
  type: T;
1204
1204
  };
1205
1205
  }
1206
+ interface ChatFrom<T extends Chat["type"]> {
1207
+ from: [T] extends ["private"] ? {} : unknown;
1208
+ }
1206
1209
  import { AbortSignal } from "./shim.node.js";
1207
1210
  export {};
package/out/context.js CHANGED
@@ -1360,7 +1360,6 @@ class Context {
1360
1360
  return this.api.sendGame(orThrow(this.chat, "sendGame").id, game_short_name, other, signal);
1361
1361
  }
1362
1362
  }
1363
- exports.Context = Context;
1364
1363
  // PROBING SHORTCUTS
1365
1364
  /**
1366
1365
  * `Context.has` is an object that contains a number of useful functions for
@@ -1383,6 +1382,7 @@ exports.Context = Context;
1383
1382
  * `Context.has.filterQuery(":text")(ctx)`.
1384
1383
  */
1385
1384
  Context.has = checker;
1385
+ exports.Context = Context;
1386
1386
  // === Util functions
1387
1387
  function orThrow(value, method) {
1388
1388
  if (value === undefined) {
@@ -1,4 +1,4 @@
1
- import { type InlineKeyboardButton, type KeyboardButton, type KeyboardButtonRequestChat, type KeyboardButtonRequestUser, type LoginUrl } from "../types.js";
1
+ import { type InlineKeyboardButton, type KeyboardButton, type KeyboardButtonRequestChat, type KeyboardButtonRequestUser, type LoginUrl, type SwitchInlineQueryChosenChat } from "../types.js";
2
2
  /**
3
3
  * Use this class to simplify building a custom keyboard (something like this:
4
4
  * https://core.telegram.org/bots#keyboards).
@@ -315,9 +315,10 @@ export declare class InlineKeyboard {
315
315
  */
316
316
  switchInline(text: string, query?: string): this;
317
317
  /**
318
- * Adds a new inline query button that act on the current chat. The selected
319
- * chat will be prefilled with the name of your bot. You may provide a text
320
- * that is specified along with it. This will start an inline query.
318
+ * Adds a new inline query button that acts on the current chat. The
319
+ * selected chat will be prefilled with the name of your bot. You may
320
+ * provide a text that is specified along with it. This will start an inline
321
+ * query.
321
322
  *
322
323
  * Your bot will in turn receive updates for inline queries. You can listen
323
324
  * to inline query updates like this:
@@ -329,6 +330,22 @@ export declare class InlineKeyboard {
329
330
  * @param query The (optional) inline query string to prefill
330
331
  */
331
332
  switchInlineCurrent(text: string, query?: string): this;
333
+ /**
334
+ * Adds a new inline query button. Telegram clients will let the user pick a
335
+ * chat when this button is pressed. This will start an inline query. The
336
+ * selected chat will be prefilled with the name of your bot. You may
337
+ * provide a text that is specified along with it.
338
+ *
339
+ * Your bot will in turn receive updates for inline queries. You can listen
340
+ * to inline query updates like this:
341
+ * ```ts
342
+ * bot.on('inline_query', ctx => { ... })
343
+ * ```
344
+ *
345
+ * @param text The text to display
346
+ * @param query The query object describing which chats can be picked
347
+ */
348
+ switchInlineChosen(text: string, query?: SwitchInlineQueryChosenChat): this;
332
349
  /**
333
350
  * Adds a new game query button, confer
334
351
  * https://core.telegram.org/bots/api#games
@@ -364,9 +364,10 @@ class InlineKeyboard {
364
364
  return this.add({ text, switch_inline_query: query });
365
365
  }
366
366
  /**
367
- * Adds a new inline query button that act on the current chat. The selected
368
- * chat will be prefilled with the name of your bot. You may provide a text
369
- * that is specified along with it. This will start an inline query.
367
+ * Adds a new inline query button that acts on the current chat. The
368
+ * selected chat will be prefilled with the name of your bot. You may
369
+ * provide a text that is specified along with it. This will start an inline
370
+ * query.
370
371
  *
371
372
  * Your bot will in turn receive updates for inline queries. You can listen
372
373
  * to inline query updates like this:
@@ -380,6 +381,24 @@ class InlineKeyboard {
380
381
  switchInlineCurrent(text, query = "") {
381
382
  return this.add({ text, switch_inline_query_current_chat: query });
382
383
  }
384
+ /**
385
+ * Adds a new inline query button. Telegram clients will let the user pick a
386
+ * chat when this button is pressed. This will start an inline query. The
387
+ * selected chat will be prefilled with the name of your bot. You may
388
+ * provide a text that is specified along with it.
389
+ *
390
+ * Your bot will in turn receive updates for inline queries. You can listen
391
+ * to inline query updates like this:
392
+ * ```ts
393
+ * bot.on('inline_query', ctx => { ... })
394
+ * ```
395
+ *
396
+ * @param text The text to display
397
+ * @param query The query object describing which chats can be picked
398
+ */
399
+ switchInlineChosen(text, query = {}) {
400
+ return this.add({ text, switch_inline_query_chosen_chat: query });
401
+ }
383
402
  /**
384
403
  * Adds a new game query button, confer
385
404
  * https://core.telegram.org/bots/api#games
package/out/core/api.d.ts CHANGED
@@ -825,23 +825,52 @@ export declare class Api<R extends RawApi = RawApi> {
825
825
  */
826
826
  answerCallbackQuery(callback_query_id: string, other?: Other<R, "answerCallbackQuery", "callback_query_id">, signal?: AbortSignal): Promise<true>;
827
827
  /**
828
- * Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success.
828
+ * Use this method to change the bot's name. Returns True on success.
829
829
  *
830
+ * @param name New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
830
831
  * @param other Optional remaining parameters, confer the official reference below
831
832
  * @param signal Optional `AbortSignal` to cancel the request
832
833
  *
833
- * **Official reference:** https://core.telegram.org/bots/api#setchatmenubutton
834
+ * **Official reference:** https://core.telegram.org/bots/api#setmyname
834
835
  */
835
- setChatMenuButton(other?: Other<R, "setChatMenuButton">, signal?: AbortSignal): Promise<true>;
836
+ setMyName(name: string, other?: Other<R, "setMyName", "name">, signal?: AbortSignal): Promise<true>;
836
837
  /**
837
- * Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success.
838
+ * Use this method to get the current bot name for the given user language. Returns BotName on success.
838
839
  *
839
840
  * @param other Optional remaining parameters, confer the official reference below
840
841
  * @param signal Optional `AbortSignal` to cancel the request
841
842
  *
842
- * **Official reference:** https://core.telegram.org/bots/api#getchatmenubutton
843
+ * **Official reference:** https://core.telegram.org/bots/api#getmyname
843
844
  */
844
- getChatMenuButton(other?: Other<R, "getChatMenuButton">, signal?: AbortSignal): Promise<import("@grammyjs/types/settings.js").MenuButton>;
845
+ getMyName(other?: Other<R, "getMyName">, signal?: AbortSignal): Promise<import("@grammyjs/types/settings.js").BotName>;
846
+ /**
847
+ * Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more details about bot commands. Returns True on success.
848
+ *
849
+ * @param commands A list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.
850
+ * @param other Optional remaining parameters, confer the official reference below
851
+ * @param signal Optional `AbortSignal` to cancel the request
852
+ *
853
+ * **Official reference:** https://core.telegram.org/bots/api#setmycommands
854
+ */
855
+ setMyCommands(commands: readonly BotCommand[], other?: Other<R, "setMyCommands", "commands">, signal?: AbortSignal): Promise<true>;
856
+ /**
857
+ * Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success.
858
+ *
859
+ * @param other Optional remaining parameters, confer the official reference below
860
+ * @param signal Optional `AbortSignal` to cancel the request
861
+ *
862
+ * **Official reference:** https://core.telegram.org/bots/api#deletemycommands
863
+ */
864
+ deleteMyCommands(other?: Other<R, "deleteMyCommands">, signal?: AbortSignal): Promise<true>;
865
+ /**
866
+ * Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned.
867
+ *
868
+ * @param other Optional remaining parameters, confer the official reference below
869
+ * @param signal Optional `AbortSignal` to cancel the request
870
+ *
871
+ * **Official reference:** https://core.telegram.org/bots/api#getmycommands
872
+ */
873
+ getMyCommands(other?: Other<R, "getMyCommands">, signal?: AbortSignal): Promise<BotCommand[]>;
845
874
  /**
846
875
  * Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success.
847
876
  *
@@ -881,51 +910,41 @@ export declare class Api<R extends RawApi = RawApi> {
881
910
  */
882
911
  getMyShortDescription(other?: Other<R, "getMyShortDescription">, signal?: AbortSignal): Promise<import("@grammyjs/types/settings.js").BotShortDescription>;
883
912
  /**
884
- * Use this method to the change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are are free to modify the list before adding the bot. Returns True on success.
885
- *
886
- * @param other Optional remaining parameters, confer the official reference below
887
- * @param signal Optional `AbortSignal` to cancel the request
888
- *
889
- * **Official reference:** https://core.telegram.org/bots/api#setmydefaultadministratorrights
890
- */
891
- setMyDefaultAdministratorRights(other?: Other<R, "setMyDefaultAdministratorRights">, signal?: AbortSignal): Promise<true>;
892
- /**
893
- * Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.
913
+ * Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success.
894
914
  *
895
915
  * @param other Optional remaining parameters, confer the official reference below
896
916
  * @param signal Optional `AbortSignal` to cancel the request
897
917
  *
898
- * **Official reference:** https://core.telegram.org/bots/api#getmydefaultadministratorrights
918
+ * **Official reference:** https://core.telegram.org/bots/api#setchatmenubutton
899
919
  */
900
- getMyDefaultAdministratorRights(other?: Other<R, "getMyDefaultAdministratorRights">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").ChatAdministratorRights>;
920
+ setChatMenuButton(other?: Other<R, "setChatMenuButton">, signal?: AbortSignal): Promise<true>;
901
921
  /**
902
- * Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more details about bot commands. Returns True on success.
922
+ * Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success.
903
923
  *
904
- * @param commands A list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.
905
924
  * @param other Optional remaining parameters, confer the official reference below
906
925
  * @param signal Optional `AbortSignal` to cancel the request
907
926
  *
908
- * **Official reference:** https://core.telegram.org/bots/api#setmycommands
927
+ * **Official reference:** https://core.telegram.org/bots/api#getchatmenubutton
909
928
  */
910
- setMyCommands(commands: readonly BotCommand[], other?: Other<R, "setMyCommands", "commands">, signal?: AbortSignal): Promise<true>;
929
+ getChatMenuButton(other?: Other<R, "getChatMenuButton">, signal?: AbortSignal): Promise<import("@grammyjs/types/settings.js").MenuButton>;
911
930
  /**
912
- * Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success.
931
+ * Use this method to the change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are are free to modify the list before adding the bot. Returns True on success.
913
932
  *
914
933
  * @param other Optional remaining parameters, confer the official reference below
915
934
  * @param signal Optional `AbortSignal` to cancel the request
916
935
  *
917
- * **Official reference:** https://core.telegram.org/bots/api#deletemycommands
936
+ * **Official reference:** https://core.telegram.org/bots/api#setmydefaultadministratorrights
918
937
  */
919
- deleteMyCommands(other?: Other<R, "deleteMyCommands">, signal?: AbortSignal): Promise<true>;
938
+ setMyDefaultAdministratorRights(other?: Other<R, "setMyDefaultAdministratorRights">, signal?: AbortSignal): Promise<true>;
920
939
  /**
921
- * Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned.
940
+ * Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.
922
941
  *
923
942
  * @param other Optional remaining parameters, confer the official reference below
924
943
  * @param signal Optional `AbortSignal` to cancel the request
925
944
  *
926
- * **Official reference:** https://core.telegram.org/bots/api#getmycommands
945
+ * **Official reference:** https://core.telegram.org/bots/api#getmydefaultadministratorrights
927
946
  */
928
- getMyCommands(other?: Other<R, "getMyCommands">, signal?: AbortSignal): Promise<BotCommand[]>;
947
+ getMyDefaultAdministratorRights(other?: Other<R, "getMyDefaultAdministratorRights">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").ChatAdministratorRights>;
929
948
  /**
930
949
  * Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
931
950
  *
package/out/core/api.js CHANGED
@@ -932,26 +932,61 @@ class Api {
932
932
  return this.raw.answerCallbackQuery({ callback_query_id, ...other }, signal);
933
933
  }
934
934
  /**
935
- * Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success.
935
+ * Use this method to change the bot's name. Returns True on success.
936
936
  *
937
+ * @param name New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
937
938
  * @param other Optional remaining parameters, confer the official reference below
938
939
  * @param signal Optional `AbortSignal` to cancel the request
939
940
  *
940
- * **Official reference:** https://core.telegram.org/bots/api#setchatmenubutton
941
+ * **Official reference:** https://core.telegram.org/bots/api#setmyname
941
942
  */
942
- setChatMenuButton(other, signal) {
943
- return this.raw.setChatMenuButton({ ...other }, signal);
943
+ setMyName(name, other, signal) {
944
+ return this.raw.setMyName({ name, ...other }, signal);
944
945
  }
945
946
  /**
946
- * Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success.
947
+ * Use this method to get the current bot name for the given user language. Returns BotName on success.
947
948
  *
948
949
  * @param other Optional remaining parameters, confer the official reference below
949
950
  * @param signal Optional `AbortSignal` to cancel the request
950
951
  *
951
- * **Official reference:** https://core.telegram.org/bots/api#getchatmenubutton
952
+ * **Official reference:** https://core.telegram.org/bots/api#getmyname
952
953
  */
953
- getChatMenuButton(other, signal) {
954
- return this.raw.getChatMenuButton({ ...other }, signal);
954
+ getMyName(other, signal) {
955
+ return this.raw.getMyName(other !== null && other !== void 0 ? other : {}, signal);
956
+ }
957
+ /**
958
+ * Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more details about bot commands. Returns True on success.
959
+ *
960
+ * @param commands A list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.
961
+ * @param other Optional remaining parameters, confer the official reference below
962
+ * @param signal Optional `AbortSignal` to cancel the request
963
+ *
964
+ * **Official reference:** https://core.telegram.org/bots/api#setmycommands
965
+ */
966
+ setMyCommands(commands, other, signal) {
967
+ return this.raw.setMyCommands({ commands, ...other }, signal);
968
+ }
969
+ /**
970
+ * Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success.
971
+ *
972
+ * @param other Optional remaining parameters, confer the official reference below
973
+ * @param signal Optional `AbortSignal` to cancel the request
974
+ *
975
+ * **Official reference:** https://core.telegram.org/bots/api#deletemycommands
976
+ */
977
+ deleteMyCommands(other, signal) {
978
+ return this.raw.deleteMyCommands({ ...other }, signal);
979
+ }
980
+ /**
981
+ * Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned.
982
+ *
983
+ * @param other Optional remaining parameters, confer the official reference below
984
+ * @param signal Optional `AbortSignal` to cancel the request
985
+ *
986
+ * **Official reference:** https://core.telegram.org/bots/api#getmycommands
987
+ */
988
+ getMyCommands(other, signal) {
989
+ return this.raw.getMyCommands({ ...other }, signal);
955
990
  }
956
991
  /**
957
992
  * Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success.
@@ -1000,60 +1035,48 @@ class Api {
1000
1035
  return this.raw.getMyShortDescription({ ...other }, signal);
1001
1036
  }
1002
1037
  /**
1003
- * Use this method to the change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are are free to modify the list before adding the bot. Returns True on success.
1004
- *
1005
- * @param other Optional remaining parameters, confer the official reference below
1006
- * @param signal Optional `AbortSignal` to cancel the request
1007
- *
1008
- * **Official reference:** https://core.telegram.org/bots/api#setmydefaultadministratorrights
1009
- */
1010
- setMyDefaultAdministratorRights(other, signal) {
1011
- return this.raw.setMyDefaultAdministratorRights({ ...other }, signal);
1012
- }
1013
- /**
1014
- * Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.
1038
+ * Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success.
1015
1039
  *
1016
1040
  * @param other Optional remaining parameters, confer the official reference below
1017
1041
  * @param signal Optional `AbortSignal` to cancel the request
1018
1042
  *
1019
- * **Official reference:** https://core.telegram.org/bots/api#getmydefaultadministratorrights
1043
+ * **Official reference:** https://core.telegram.org/bots/api#setchatmenubutton
1020
1044
  */
1021
- getMyDefaultAdministratorRights(other, signal) {
1022
- return this.raw.getMyDefaultAdministratorRights({ ...other }, signal);
1045
+ setChatMenuButton(other, signal) {
1046
+ return this.raw.setChatMenuButton({ ...other }, signal);
1023
1047
  }
1024
1048
  /**
1025
- * Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more details about bot commands. Returns True on success.
1049
+ * Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success.
1026
1050
  *
1027
- * @param commands A list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.
1028
1051
  * @param other Optional remaining parameters, confer the official reference below
1029
1052
  * @param signal Optional `AbortSignal` to cancel the request
1030
1053
  *
1031
- * **Official reference:** https://core.telegram.org/bots/api#setmycommands
1054
+ * **Official reference:** https://core.telegram.org/bots/api#getchatmenubutton
1032
1055
  */
1033
- setMyCommands(commands, other, signal) {
1034
- return this.raw.setMyCommands({ commands, ...other }, signal);
1056
+ getChatMenuButton(other, signal) {
1057
+ return this.raw.getChatMenuButton({ ...other }, signal);
1035
1058
  }
1036
1059
  /**
1037
- * Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success.
1060
+ * Use this method to the change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are are free to modify the list before adding the bot. Returns True on success.
1038
1061
  *
1039
1062
  * @param other Optional remaining parameters, confer the official reference below
1040
1063
  * @param signal Optional `AbortSignal` to cancel the request
1041
1064
  *
1042
- * **Official reference:** https://core.telegram.org/bots/api#deletemycommands
1065
+ * **Official reference:** https://core.telegram.org/bots/api#setmydefaultadministratorrights
1043
1066
  */
1044
- deleteMyCommands(other, signal) {
1045
- return this.raw.deleteMyCommands({ ...other }, signal);
1067
+ setMyDefaultAdministratorRights(other, signal) {
1068
+ return this.raw.setMyDefaultAdministratorRights({ ...other }, signal);
1046
1069
  }
1047
1070
  /**
1048
- * Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned.
1071
+ * Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.
1049
1072
  *
1050
1073
  * @param other Optional remaining parameters, confer the official reference below
1051
1074
  * @param signal Optional `AbortSignal` to cancel the request
1052
1075
  *
1053
- * **Official reference:** https://core.telegram.org/bots/api#getmycommands
1076
+ * **Official reference:** https://core.telegram.org/bots/api#getmydefaultadministratorrights
1054
1077
  */
1055
- getMyCommands(other, signal) {
1056
- return this.raw.getMyCommands({ ...other }, signal);
1078
+ getMyDefaultAdministratorRights(other, signal) {
1079
+ return this.raw.getMyDefaultAdministratorRights({ ...other }, signal);
1057
1080
  }
1058
1081
  /**
1059
1082
  * Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
package/out/web.mjs CHANGED
@@ -1797,15 +1797,14 @@ class BytesList {
1797
1797
  const startIdx = this.getChunkIndex(start);
1798
1798
  const endIdx = this.getChunkIndex(end - 1);
1799
1799
  let written = 0;
1800
- for(let i = startIdx; i < endIdx; i++){
1801
- const chunk = this.#chunks[i];
1802
- const len = chunk.end - chunk.start;
1803
- result.set(chunk.value.subarray(chunk.start, chunk.end), written);
1800
+ for(let i = startIdx; i <= endIdx; i++){
1801
+ const { value: chunkValue , start: chunkStart , end: chunkEnd , offset: chunkOffset } = this.#chunks[i];
1802
+ const readStart = chunkStart + (i === startIdx ? start - chunkOffset : 0);
1803
+ const readEnd = i === endIdx ? end - chunkOffset + chunkStart : chunkEnd;
1804
+ const len = readEnd - readStart;
1805
+ result.set(chunkValue.subarray(readStart, readEnd), written);
1804
1806
  written += len;
1805
1807
  }
1806
- const last = this.#chunks[endIdx];
1807
- const rest = end - start - written;
1808
- result.set(last.value.subarray(last.start, last.start + rest), written);
1809
1808
  return result;
1810
1809
  }
1811
1810
  concat() {
@@ -3735,13 +3734,28 @@ class Api {
3735
3734
  ...other
3736
3735
  }, signal);
3737
3736
  }
3738
- setChatMenuButton(other, signal) {
3739
- return this.raw.setChatMenuButton({
3737
+ setMyName(name, other, signal) {
3738
+ return this.raw.setMyName({
3739
+ name,
3740
3740
  ...other
3741
3741
  }, signal);
3742
3742
  }
3743
- getChatMenuButton(other, signal) {
3744
- return this.raw.getChatMenuButton({
3743
+ getMyName(other, signal) {
3744
+ return this.raw.getMyName(other ?? {}, signal);
3745
+ }
3746
+ setMyCommands(commands, other, signal) {
3747
+ return this.raw.setMyCommands({
3748
+ commands,
3749
+ ...other
3750
+ }, signal);
3751
+ }
3752
+ deleteMyCommands(other, signal) {
3753
+ return this.raw.deleteMyCommands({
3754
+ ...other
3755
+ }, signal);
3756
+ }
3757
+ getMyCommands(other, signal) {
3758
+ return this.raw.getMyCommands({
3745
3759
  ...other
3746
3760
  }, signal);
3747
3761
  }
@@ -3767,29 +3781,23 @@ class Api {
3767
3781
  ...other
3768
3782
  }, signal);
3769
3783
  }
3770
- setMyDefaultAdministratorRights(other, signal) {
3771
- return this.raw.setMyDefaultAdministratorRights({
3772
- ...other
3773
- }, signal);
3774
- }
3775
- getMyDefaultAdministratorRights(other, signal) {
3776
- return this.raw.getMyDefaultAdministratorRights({
3784
+ setChatMenuButton(other, signal) {
3785
+ return this.raw.setChatMenuButton({
3777
3786
  ...other
3778
3787
  }, signal);
3779
3788
  }
3780
- setMyCommands(commands, other, signal) {
3781
- return this.raw.setMyCommands({
3782
- commands,
3789
+ getChatMenuButton(other, signal) {
3790
+ return this.raw.getChatMenuButton({
3783
3791
  ...other
3784
3792
  }, signal);
3785
3793
  }
3786
- deleteMyCommands(other, signal) {
3787
- return this.raw.deleteMyCommands({
3794
+ setMyDefaultAdministratorRights(other, signal) {
3795
+ return this.raw.setMyDefaultAdministratorRights({
3788
3796
  ...other
3789
3797
  }, signal);
3790
3798
  }
3791
- getMyCommands(other, signal) {
3792
- return this.raw.getMyCommands({
3799
+ getMyDefaultAdministratorRights(other, signal) {
3800
+ return this.raw.getMyDefaultAdministratorRights({
3793
3801
  ...other
3794
3802
  }, signal);
3795
3803
  }
@@ -4476,6 +4484,12 @@ class InlineKeyboard {
4476
4484
  switch_inline_query_current_chat: query
4477
4485
  });
4478
4486
  }
4487
+ switchInlineChosen(text, query = {}) {
4488
+ return this.add({
4489
+ text,
4490
+ switch_inline_query_chosen_chat: query
4491
+ });
4492
+ }
4479
4493
  game(text) {
4480
4494
  return this.add({
4481
4495
  text,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grammy",
3
3
  "description": "The Telegram Bot Framework.",
4
- "version": "1.15.2",
4
+ "version": "1.16.0",
5
5
  "author": "KnorpelSenf",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -18,7 +18,7 @@
18
18
  "contribs": "all-contributors"
19
19
  },
20
20
  "dependencies": {
21
- "@grammyjs/types": "3.0.2",
21
+ "@grammyjs/types": "3.1.1",
22
22
  "abort-controller": "^3.0.0",
23
23
  "debug": "^4.3.4",
24
24
  "node-fetch": "^2.6.9"
@@ -26,9 +26,9 @@
26
26
  "devDependencies": {
27
27
  "@types/debug": "^4.1.7",
28
28
  "@types/node": "^12.20.55",
29
- "@types/node-fetch": "^2.6.2",
29
+ "@types/node-fetch": "2.6.2",
30
30
  "all-contributors-cli": "^6.24.0",
31
- "deno2node": "^1.7.2"
31
+ "deno2node": "^1.8.1"
32
32
  },
33
33
  "files": [
34
34
  "out/"