grammy 1.4.3 β†’ 1.5.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
@@ -4,15 +4,15 @@
4
4
 
5
5
  ---
6
6
 
7
- _<h2 align="center"> [:mag: Documentation](https://grammy.dev) | [:page_with_curl: API Reference](https://doc.deno.land/https/deno.land/x/grammy/mod.ts) | [:busts_in_silhouette: Group Chat](https://telegram.me/grammyjs) | [:new: News](https://telegram.me/grammyjs_news)</h2>_
7
+ _<h2 align="center"> [:mag: Documentation](https://grammy.dev) | [:page_with_curl: API Reference](https://doc.deno.land/https://deno.land/x/grammy/mod.ts) | [:busts_in_silhouette: Group Chat](https://telegram.me/grammyjs) | [:new: News](https://telegram.me/grammyjs_news)</h2>_
8
8
 
9
9
  <div align="center">
10
10
 
11
11
  <!-- deno-fmt-ignore-start -->
12
12
 
13
- [![Bot API](https://img.shields.io/badge/Bot%20API-5.4-blue?logo=telegram&style=flat-square)](https://core.telegram.org/bots/api)
13
+ [![Bot API](https://img.shields.io/badge/Bot%20API-5.5-blue?logo=telegram&style=flat-square)](https://core.telegram.org/bots/api)
14
14
  [![npm](https://img.shields.io/npm/v/grammy?logo=npm&style=flat-square)](https://www.npmjs.org/package/grammy) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
15
- [![All Contributors](https://img.shields.io/badge/all_contributors-43-orange.svg?style=flat-square)](#contributors-)
15
+ [![All Contributors](https://img.shields.io/badge/all_contributors-44-orange.svg?style=flat-square)](#contributors-)
16
16
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
17
17
 
18
18
  <!-- deno-fmt-ignore-end -->
@@ -25,7 +25,7 @@ You want grammY because it is easy to use. It is very powerful and always up to
25
25
 
26
26
  Are you ready? πŸ€–πŸš€
27
27
 
28
- Bots are written in [TypeScript](https://www.typescriptlang.org/) (or JavaScript) and run on [Node.js](https://nodejs.org/).
28
+ Bots are written in [TypeScript](https://www.typescriptlang.org/) (or JavaScript) and run on [Node.js](https://nodejs.org/) or [Deno](#deno-support).
29
29
 
30
30
  ## Quickstart
31
31
 
@@ -66,7 +66,7 @@ Congrats! You just wrote a Telegram bot :)
66
66
 
67
67
  ## Going Further
68
68
 
69
- grammY has an excellent [documentation](https://grammy.dev), and an [API Reference](https://doc.deno.land/https/deno.land/x/grammy/mod.ts). It even integrates with your code editor, e.g. [VSCode](https://code.visualstudio.com/). You can hover over any element of grammY to get a detailed description of what that thing does or means.
69
+ grammY has an excellent [documentation](https://grammy.dev), and an [API Reference](https://doc.deno.land/https://deno.land/x/grammy/mod.ts). It even integrates with your code editor, e.g. [VSCode](https://code.visualstudio.com/). You can hover over any element of grammY to get a detailed description of what that thing does or means.
70
70
 
71
71
  If you are still stuck, just join the [Telegram chat](https://t.me/grammyjs) and ask for help. People are nice there and we appreciate your question, no matter what it is :)
72
72
 
@@ -78,7 +78,7 @@ Here are some more resources to support you:
78
78
 
79
79
  β€”main project website and documentation.
80
80
 
81
- ### [grammY API Reference](https://doc.deno.land/https/deno.land/x/grammy/mod.ts)
81
+ ### [grammY API Reference](https://doc.deno.land/https://deno.land/x/grammy/mod.ts)
82
82
 
83
83
  β€”reference of everything that grammY exports.
84
84
 
@@ -90,6 +90,8 @@ Here are some more resources to support you:
90
90
 
91
91
  β€”Telegram chat where you can ask any question about grammY or bots in general. We are also open for feedback, ideas, and contributions!
92
92
 
93
+ The Russian commnity chat can be found [here](https://t.me/grammyjs_ru).
94
+
93
95
  ### [grammY News Channel](https://t.me/grammyjs_news)
94
96
 
95
97
  β€”Telegram channel where updates to grammY and the ecosystem are posted.
@@ -100,9 +102,11 @@ Here are some more resources to support you:
100
102
 
101
103
  ## Deno Support
102
104
 
103
- All grammY packages published by [@grammyjs](https://github.com/grammyjs) run natively on Deno. We are compiling every codebase to still run on Node.
105
+ All grammY packages published by [@grammyjs](https://github.com/grammyjs) run natively on [Deno](https://deno.land). We are compiling every codebase to still run on Node.js.
106
+
107
+ However, given that most bot developers are still using Node.js, all documentation is written Node.js-first. We may migrate it if Deno overtakes Node.js. If you are already on Deno today, import grammY from [`https://deno.land/x/grammy/mod.ts`](https://deno.land/x/grammy).
104
108
 
105
- However, given that most bot developers are still using Node, all documentation is written Node-first. We may migrate it if Deno overtakes Node. If you are already on Deno today, we expect you to know what you're doing. You mainly have to adjust the imports to URL imports, and import from [`https://deno.land/x/grammy/mod.ts`](https://deno.land/x/grammy).
109
+ You may also be interested in [why we support Deno](https://grammy.dev/resources/faq.html#why-do-you-support-deno).
106
110
 
107
111
  ## [Contribution Guide Β»](./CONTRIBUTING.md)
108
112
 
@@ -163,13 +167,14 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
163
167
  <td align="center"><a href="https://github.com/taotie111"><img src="https://avatars.githubusercontent.com/u/44166322?v=4?s=100" width="100px;" alt=""/><br /><sub><b>taotie111</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=taotie111" title="Documentation">πŸ“–</a> <a href="#translation-taotie111" title="Translation">🌍</a></td>
164
168
  <td align="center"><a href="https://www.linkedin.com/in/merlin-brandes-42328717a/"><img src="https://avatars.githubusercontent.com/u/14237330?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Merlin</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=FatalMerlin" title="Documentation">πŸ“–</a></td>
165
169
  <td align="center"><a href="https://darve.sh"><img src="https://avatars.githubusercontent.com/u/22394081?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Darvesh</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adarvesh" title="Bug reports">πŸ›</a> <a href="https://github.com/grammyjs/grammY/commits?author=darvesh" title="Code">πŸ’»</a></td>
166
- <td align="center"><a href="http://telegram.me/dcdunkan"><img src="https://avatars.githubusercontent.com/u/70066170?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dcdunkan</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adcdunkan" title="Bug reports">πŸ›</a> <a href="https://github.com/grammyjs/grammY/commits?author=dcdunkan" title="Code">πŸ’»</a></td>
170
+ <td align="center"><a href="http://telegram.me/dcdunkan"><img src="https://avatars.githubusercontent.com/u/70066170?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dcdunkan</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adcdunkan" title="Bug reports">πŸ›</a> <a href="https://github.com/grammyjs/grammY/commits?author=dcdunkan" title="Code">πŸ’»</a> <a href="#plugin-dcdunkan" title="Plugin/utility libraries">πŸ”Œ</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Adcdunkan" title="Reviewed Pull Requests">πŸ‘€</a></td>
167
171
  <td align="center"><a href="https://xuann.wang/"><img src="https://avatars.githubusercontent.com/u/44045911?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kid</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=kidonng" title="Documentation">πŸ“–</a> <a href="#translation-kidonng" title="Translation">🌍</a></td>
168
172
  <td align="center"><a href="http://slava.fomin.io/"><img src="https://avatars.githubusercontent.com/u/1702725?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Slava Fomin II</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aslavafomin" title="Bug reports">πŸ›</a> <a href="https://github.com/grammyjs/grammY/commits?author=slavafomin" title="Documentation">πŸ“–</a></td>
169
173
  <td align="center"><a href="https://kikobeats.com/"><img src="https://avatars.githubusercontent.com/u/2096101?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kiko Beats</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Kikobeats" title="Documentation">πŸ“–</a></td>
170
174
  </tr>
171
175
  <tr>
172
176
  <td align="center"><a href="http://///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////kraftwerk28.pp.ua"><img src="https://avatars.githubusercontent.com/u/31807671?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vsevolod</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=kraftwerk28" title="Code">πŸ’»</a> <a href="#ideas-kraftwerk28" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Akraftwerk28" title="Reviewed Pull Requests">πŸ‘€</a></td>
177
+ <td align="center"><a href="https://github.com/habemuscode"><img src="https://avatars.githubusercontent.com/u/34692207?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Habemuscode</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Ahabemuscode" title="Reviewed Pull Requests">πŸ‘€</a></td>
173
178
  </tr>
174
179
  </table>
175
180
 
package/out/context.d.ts CHANGED
@@ -62,7 +62,7 @@ export declare class Context implements RenamedUpdate {
62
62
  * Used by some middleware to store information about how a certain string
63
63
  * or regular expression was matched.
64
64
  */
65
- match?: string | RegExpMatchArray | null;
65
+ match?: string | RegExpMatchArray;
66
66
  constructor(
67
67
  /**
68
68
  * The update object that is contained in the context.
@@ -113,7 +113,7 @@ export declare class Context implements RenamedUpdate {
113
113
  get msg(): Message | undefined;
114
114
  /**
115
115
  * Get chat object from whereever possible. Alias for `(this.msg ??
116
- * this.myChatMember ?? this.chatMember)?.chat`
116
+ * this.myChatMember ?? this.chatMember ?? this.chatJoinRequest)?.chat`
117
117
  */
118
118
  get chat(): Chat | undefined;
119
119
  /**
@@ -125,7 +125,7 @@ export declare class Context implements RenamedUpdate {
125
125
  * Get message author from whereever possible. Alias for
126
126
  * `(ctx.callbackQuery?? ctx.inlineQuery ?? ctx.shippingQuery ??
127
127
  * ctx.preCheckoutQuery ?? ctx.chosenInlineResult ?? ctx.msg ??
128
- * this.myChatMember ?? this.chatMember)?.from`
128
+ * this.myChatMember ?? this.chatMember ?? this.chatJoinRequest)?.from`
129
129
  */
130
130
  get from(): User | undefined;
131
131
  /**
@@ -447,6 +447,25 @@ export declare class Context implements RenamedUpdate {
447
447
  * **Official reference:** https://core.telegram.org/bots/api#setchatadministratorcustomtitle
448
448
  */
449
449
  setChatAdministratorCustomTitle(user_id: number, custom_title: string, signal?: AbortSignal): Promise<true>;
450
+ /**
451
+ * Context-aware alias for `api.banChatSenderChat`. Use this method to ban a channel chat in a supergroup or a channel. The owner of the chat will not be able to send messages and join live streams on behalf of the chat, unless it is unbanned first. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.
452
+ *
453
+ * @param sender_chat_id Unique identifier of the target sender chat
454
+ * @param other Optional remaining parameters, confer the official reference below
455
+ * @param signal Optional `AbortSignal` to cancel the request
456
+ *
457
+ * **Official reference:** https://core.telegram.org/bots/api#banchatsenderchat
458
+ */
459
+ banChatSenderChat(sender_chat_id: number, other?: Other<"banChatSenderChat", "sender_chat_id">, signal?: AbortSignal): Promise<true>;
460
+ /**
461
+ * Context-aware alias for `api.unbanChatSenderChat`. Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
462
+ *
463
+ * @param sender_chat_id Unique identifier of the target sender chat
464
+ * @param signal Optional `AbortSignal` to cancel the request
465
+ *
466
+ * **Official reference:** https://core.telegram.org/bots/api#unbanchatsenderchat
467
+ */
468
+ unbanChatSenderChat(sender_chat_id: number, signal?: AbortSignal): Promise<true>;
450
469
  /**
451
470
  * Context-aware alias for `api.setChatPermissions`. Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
452
471
  *
package/out/context.js CHANGED
@@ -152,12 +152,12 @@ class Context {
152
152
  }
153
153
  /**
154
154
  * Get chat object from whereever possible. Alias for `(this.msg ??
155
- * this.myChatMember ?? this.chatMember)?.chat`
155
+ * this.myChatMember ?? this.chatMember ?? this.chatJoinRequest)?.chat`
156
156
  */
157
157
  get chat() {
158
- var _a, _b, _c;
158
+ var _a, _b, _c, _d;
159
159
  // Keep in sync with types in `filter.ts`.
160
- return (_c = ((_b = (_a = this.msg) !== null && _a !== void 0 ? _a : this.myChatMember) !== null && _b !== void 0 ? _b : this.chatMember)) === null || _c === void 0 ? void 0 : _c.chat;
160
+ return (_d = ((_c = (_b = (_a = this.msg) !== null && _a !== void 0 ? _a : this.myChatMember) !== null && _b !== void 0 ? _b : this.chatMember) !== null && _c !== void 0 ? _c : this.chatJoinRequest)) === null || _d === void 0 ? void 0 : _d.chat;
161
161
  }
162
162
  /**
163
163
  * Get sender chat object from wherever possible. Alias for
@@ -171,12 +171,12 @@ class Context {
171
171
  * Get message author from whereever possible. Alias for
172
172
  * `(ctx.callbackQuery?? ctx.inlineQuery ?? ctx.shippingQuery ??
173
173
  * ctx.preCheckoutQuery ?? ctx.chosenInlineResult ?? ctx.msg ??
174
- * this.myChatMember ?? this.chatMember)?.from`
174
+ * this.myChatMember ?? this.chatMember ?? this.chatJoinRequest)?.from`
175
175
  */
176
176
  get from() {
177
- var _a, _b, _c, _d, _e, _f, _g, _h;
177
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
178
178
  // Keep in sync with types in `filter.ts`.
179
- return (_h = ((_g = (_f = (_e = (_d = (_c = (_b = (_a = this.callbackQuery) !== null && _a !== void 0 ? _a : this.inlineQuery) !== null && _b !== void 0 ? _b : this.shippingQuery) !== null && _c !== void 0 ? _c : this.preCheckoutQuery) !== null && _d !== void 0 ? _d : this.chosenInlineResult) !== null && _e !== void 0 ? _e : this.msg) !== null && _f !== void 0 ? _f : this.myChatMember) !== null && _g !== void 0 ? _g : this.chatMember)) === null || _h === void 0 ? void 0 : _h.from;
179
+ return (_j = ((_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = this.callbackQuery) !== null && _a !== void 0 ? _a : this.inlineQuery) !== null && _b !== void 0 ? _b : this.shippingQuery) !== null && _c !== void 0 ? _c : this.preCheckoutQuery) !== null && _d !== void 0 ? _d : this.chosenInlineResult) !== null && _e !== void 0 ? _e : this.msg) !== null && _f !== void 0 ? _f : this.myChatMember) !== null && _g !== void 0 ? _g : this.chatMember) !== null && _h !== void 0 ? _h : this.chatJoinRequest)) === null || _j === void 0 ? void 0 : _j.from;
180
180
  }
181
181
  /**
182
182
  * Get inline message ID from whereever possible. Alias for
@@ -576,6 +576,29 @@ class Context {
576
576
  setChatAdministratorCustomTitle(user_id, custom_title, signal) {
577
577
  return this.api.setChatAdministratorCustomTitle(orThrow(this.chat, "setChatAdministratorCustomTitle").id, user_id, custom_title, signal);
578
578
  }
579
+ /**
580
+ * Context-aware alias for `api.banChatSenderChat`. Use this method to ban a channel chat in a supergroup or a channel. The owner of the chat will not be able to send messages and join live streams on behalf of the chat, unless it is unbanned first. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.
581
+ *
582
+ * @param sender_chat_id Unique identifier of the target sender chat
583
+ * @param other Optional remaining parameters, confer the official reference below
584
+ * @param signal Optional `AbortSignal` to cancel the request
585
+ *
586
+ * **Official reference:** https://core.telegram.org/bots/api#banchatsenderchat
587
+ */
588
+ banChatSenderChat(sender_chat_id, other, signal) {
589
+ return this.api.banChatSenderChat(orThrow(this.chat, "banChatSenderChat").id, sender_chat_id, other, signal);
590
+ }
591
+ /**
592
+ * Context-aware alias for `api.unbanChatSenderChat`. Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
593
+ *
594
+ * @param sender_chat_id Unique identifier of the target sender chat
595
+ * @param signal Optional `AbortSignal` to cancel the request
596
+ *
597
+ * **Official reference:** https://core.telegram.org/bots/api#unbanchatsenderchat
598
+ */
599
+ unbanChatSenderChat(sender_chat_id, signal) {
600
+ return this.api.unbanChatSenderChat(orThrow(this.chat, "unbanChatSenderChat").id, sender_chat_id, signal);
601
+ }
579
602
  /**
580
603
  * Context-aware alias for `api.setChatPermissions`. Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
581
604
  *
@@ -138,7 +138,7 @@ export declare class InlineKeyboard {
138
138
  * the button is pressed.
139
139
  *
140
140
  * @param text The text to display
141
- * @param url HTTP or tg:// url to be opened when button is pressed
141
+ * @param url HTTP or tg:// url to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings.
142
142
  */
143
143
  url(text: string, url: string): this;
144
144
  /**
@@ -211,7 +211,7 @@ export declare class InlineKeyboard {
211
211
  /**
212
212
  * Adds a new payment button, confer https://core.telegram.org/bots/api#payments
213
213
  *
214
- * This type of button must always be the first button in the first row.
214
+ * This type of button must always be the first button in the first row and can only be used in invoice messages.
215
215
  *
216
216
  * @param text The text to display
217
217
  */
@@ -179,7 +179,7 @@ class InlineKeyboard {
179
179
  * the button is pressed.
180
180
  *
181
181
  * @param text The text to display
182
- * @param url HTTP or tg:// url to be opened when button is pressed
182
+ * @param url HTTP or tg:// url to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings.
183
183
  */
184
184
  url(text, url) {
185
185
  return this.add({ text, url });
@@ -269,7 +269,7 @@ class InlineKeyboard {
269
269
  /**
270
270
  * Adds a new payment button, confer https://core.telegram.org/bots/api#payments
271
271
  *
272
- * This type of button must always be the first button in the first row.
272
+ * This type of button must always be the first button in the first row and can only be used in invoice messages.
273
273
  *
274
274
  * @param text The text to display
275
275
  */
@@ -8,7 +8,7 @@ declare type MaybePromise<T> = Promise<T> | T;
8
8
  * Session middleware will load the session data of a specific chat from your
9
9
  * storage solution, and make it available to you on the context object. Check
10
10
  * out the
11
- * [documentation](https://doc.deno.land/https/deno.land/x/grammy/mod.ts#session)
11
+ * [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/session)
12
12
  * on session middleware to know more, and read the section about sessions on
13
13
  * the [website](https://grammy.dev/plugins/session.html).
14
14
  */
@@ -37,7 +37,7 @@ export interface SessionFlavor<S> {
37
37
  * object. Once you access `ctx.session`, the storage will be queried and the
38
38
  * session data becomes available. If you access `ctx.session` again for the
39
39
  * same context object, the cached value will be used. Check out the
40
- * [documentation](https://doc.deno.land/https/deno.land/x/grammy/mod.ts#lazySession)
40
+ * [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/lazySession)
41
41
  * on lazy session middleware to know more, and read the section about lazy
42
42
  * sessions on the
43
43
  * [website](https://grammy.dev/plugins/session.html#lazy-sessions).
package/out/core/api.d.ts CHANGED
@@ -459,6 +459,27 @@ export declare class Api<R extends RawApi = RawApi> {
459
459
  * **Official reference:** https://core.telegram.org/bots/api#setchatadministratorcustomtitle
460
460
  */
461
461
  setChatAdministratorCustomTitle(chat_id: number | string, user_id: number, custom_title: string, signal?: AbortSignal): Promise<true>;
462
+ /**
463
+ * Use this method to ban a channel chat in a supergroup or a channel. The owner of the chat will not be able to send messages and join live streams on behalf of the chat, unless it is unbanned first. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.
464
+ *
465
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
466
+ * @param sender_chat_id Unique identifier of the target sender chat
467
+ * @param other Optional remaining parameters, confer the official reference below
468
+ * @param signal Optional `AbortSignal` to cancel the request
469
+ *
470
+ * **Official reference:** https://core.telegram.org/bots/api#banchatsenderchat
471
+ */
472
+ banChatSenderChat(chat_id: number | string, sender_chat_id: number, other?: Other<R, "banChatSenderChat", "sender_chat_id">, signal?: AbortSignal): Promise<true>;
473
+ /**
474
+ * Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
475
+ *
476
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
477
+ * @param sender_chat_id Unique identifier of the target sender chat
478
+ * @param signal Optional `AbortSignal` to cancel the request
479
+ *
480
+ * **Official reference:** https://core.telegram.org/bots/api#unbanchatsenderchat
481
+ */
482
+ unbanChatSenderChat(chat_id: number | string, sender_chat_id: number, signal?: AbortSignal): Promise<true>;
462
483
  /**
463
484
  * Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
464
485
  *
package/out/core/api.js CHANGED
@@ -166,12 +166,7 @@ class Api {
166
166
  * **Official reference:** https://core.telegram.org/bots/api#forwardmessage
167
167
  */
168
168
  forwardMessage(chat_id, from_chat_id, message_id, other, signal) {
169
- return this.raw.forwardMessage({
170
- chat_id,
171
- from_chat_id,
172
- message_id,
173
- ...other,
174
- }, signal);
169
+ return this.raw.forwardMessage({ chat_id, from_chat_id, message_id, ...other }, signal);
175
170
  }
176
171
  /**
177
172
  * Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.
@@ -185,12 +180,7 @@ class Api {
185
180
  * **Official reference:** https://core.telegram.org/bots/api#copymessage
186
181
  */
187
182
  copyMessage(chat_id, from_chat_id, message_id, other, signal) {
188
- return this.raw.copyMessage({
189
- chat_id,
190
- from_chat_id,
191
- message_id,
192
- ...other,
193
- }, signal);
183
+ return this.raw.copyMessage({ chat_id, from_chat_id, message_id, ...other }, signal);
194
184
  }
195
185
  /**
196
186
  * Use this method to send photos. On success, the sent Message is returned.
@@ -326,13 +316,7 @@ class Api {
326
316
  * **Official reference:** https://core.telegram.org/bots/api#editmessagelivelocation
327
317
  */
328
318
  editMessageLiveLocation(chat_id, message_id, latitude, longitude, other, signal) {
329
- return this.raw.editMessageLiveLocation({
330
- chat_id,
331
- message_id,
332
- latitude,
333
- longitude,
334
- ...other,
335
- }, signal);
319
+ return this.raw.editMessageLiveLocation({ chat_id, message_id, latitude, longitude, ...other }, signal);
336
320
  }
337
321
  /**
338
322
  * Use this method to edit live location inline messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
@@ -346,12 +330,7 @@ class Api {
346
330
  * **Official reference:** https://core.telegram.org/bots/api#editmessagelivelocation
347
331
  */
348
332
  editMessageLiveLocationInline(inline_message_id, latitude, longitude, other, signal) {
349
- return this.raw.editMessageLiveLocation({
350
- inline_message_id,
351
- latitude,
352
- longitude,
353
- ...other,
354
- }, signal);
333
+ return this.raw.editMessageLiveLocation({ inline_message_id, latitude, longitude, ...other }, signal);
355
334
  }
356
335
  /**
357
336
  * Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.
@@ -364,11 +343,7 @@ class Api {
364
343
  * **Official reference:** https://core.telegram.org/bots/api#stopmessagelivelocation
365
344
  */
366
345
  stopMessageLiveLocation(chat_id, message_id, other, signal) {
367
- return this.raw.stopMessageLiveLocation({
368
- chat_id,
369
- message_id,
370
- ...other,
371
- }, signal);
346
+ return this.raw.stopMessageLiveLocation({ chat_id, message_id, ...other }, signal);
372
347
  }
373
348
  /**
374
349
  * Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.
@@ -396,14 +371,7 @@ class Api {
396
371
  * **Official reference:** https://core.telegram.org/bots/api#sendvenue
397
372
  */
398
373
  sendVenue(chat_id, latitude, longitude, title, address, other, signal) {
399
- return this.raw.sendVenue({
400
- chat_id,
401
- latitude,
402
- longitude,
403
- title,
404
- address,
405
- ...other,
406
- }, signal);
374
+ return this.raw.sendVenue({ chat_id, latitude, longitude, title, address, ...other }, signal);
407
375
  }
408
376
  /**
409
377
  * Use this method to send phone contacts. On success, the sent Message is returned.
@@ -417,12 +385,7 @@ class Api {
417
385
  * **Official reference:** https://core.telegram.org/bots/api#sendcontact
418
386
  */
419
387
  sendContact(chat_id, phone_number, first_name, other, signal) {
420
- return this.raw.sendContact({
421
- chat_id,
422
- phone_number,
423
- first_name,
424
- ...other,
425
- }, signal);
388
+ return this.raw.sendContact({ chat_id, phone_number, first_name, ...other }, signal);
426
389
  }
427
390
  /**
428
391
  * Use this method to send a native poll. On success, the sent Message is returned.
@@ -534,12 +497,7 @@ class Api {
534
497
  * **Official reference:** https://core.telegram.org/bots/api#restrictchatmember
535
498
  */
536
499
  restrictChatMember(chat_id, user_id, permissions, other, signal) {
537
- return this.raw.restrictChatMember({
538
- chat_id,
539
- user_id,
540
- permissions,
541
- ...other,
542
- }, signal);
500
+ return this.raw.restrictChatMember({ chat_id, user_id, permissions, ...other }, signal);
543
501
  }
544
502
  /**
545
503
  * Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success.
@@ -565,11 +523,32 @@ class Api {
565
523
  * **Official reference:** https://core.telegram.org/bots/api#setchatadministratorcustomtitle
566
524
  */
567
525
  setChatAdministratorCustomTitle(chat_id, user_id, custom_title, signal) {
568
- return this.raw.setChatAdministratorCustomTitle({
569
- chat_id,
570
- user_id,
571
- custom_title,
572
- }, signal);
526
+ return this.raw.setChatAdministratorCustomTitle({ chat_id, user_id, custom_title }, signal);
527
+ }
528
+ /**
529
+ * Use this method to ban a channel chat in a supergroup or a channel. The owner of the chat will not be able to send messages and join live streams on behalf of the chat, unless it is unbanned first. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.
530
+ *
531
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
532
+ * @param sender_chat_id Unique identifier of the target sender chat
533
+ * @param other Optional remaining parameters, confer the official reference below
534
+ * @param signal Optional `AbortSignal` to cancel the request
535
+ *
536
+ * **Official reference:** https://core.telegram.org/bots/api#banchatsenderchat
537
+ */
538
+ banChatSenderChat(chat_id, sender_chat_id, other, signal) {
539
+ return this.raw.banChatSenderChat({ chat_id, sender_chat_id, ...other }, signal);
540
+ }
541
+ /**
542
+ * Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
543
+ *
544
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
545
+ * @param sender_chat_id Unique identifier of the target sender chat
546
+ * @param signal Optional `AbortSignal` to cancel the request
547
+ *
548
+ * **Official reference:** https://core.telegram.org/bots/api#unbanchatsenderchat
549
+ */
550
+ unbanChatSenderChat(chat_id, sender_chat_id, signal) {
551
+ return this.raw.unbanChatSenderChat({ chat_id, sender_chat_id }, signal);
573
552
  }
574
553
  /**
575
554
  * Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
@@ -811,10 +790,7 @@ class Api {
811
790
  * **Official reference:** https://core.telegram.org/bots/api#setchatstickerset
812
791
  */
813
792
  setChatStickerSet(chat_id, sticker_set_name, signal) {
814
- return this.raw.setChatStickerSet({
815
- chat_id,
816
- sticker_set_name,
817
- }, signal);
793
+ return this.raw.setChatStickerSet({ chat_id, sticker_set_name }, signal);
818
794
  }
819
795
  /**
820
796
  * Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set ly returned in getChat requests to check if the bot can use this method. Returns True on success.
@@ -938,12 +914,7 @@ class Api {
938
914
  * **Official reference:** https://core.telegram.org/bots/api#editmessagemedia
939
915
  */
940
916
  editMessageMedia(chat_id, message_id, media, other, signal) {
941
- return this.raw.editMessageMedia({
942
- chat_id,
943
- message_id,
944
- media,
945
- ...other,
946
- }, signal);
917
+ return this.raw.editMessageMedia({ chat_id, message_id, media, ...other }, signal);
947
918
  }
948
919
  /**
949
920
  * Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
@@ -969,11 +940,7 @@ class Api {
969
940
  * **Official reference:** https://core.telegram.org/bots/api#editmessagereplymarkup
970
941
  */
971
942
  editMessageReplyMarkup(chat_id, message_id, other, signal) {
972
- return this.raw.editMessageReplyMarkup({
973
- chat_id,
974
- message_id,
975
- ...other,
976
- }, signal);
943
+ return this.raw.editMessageReplyMarkup({ chat_id, message_id, ...other }, signal);
977
944
  }
978
945
  /**
979
946
  * Use this method to edit only the reply markup of inline messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
@@ -1069,13 +1036,7 @@ class Api {
1069
1036
  * **Official reference:** https://core.telegram.org/bots/api#createnewstickerset
1070
1037
  */
1071
1038
  createNewStickerSet(user_id, name, title, emojis, other, signal) {
1072
- return this.raw.createNewStickerSet({
1073
- user_id,
1074
- name,
1075
- title,
1076
- emojis,
1077
- ...other,
1078
- }, signal);
1039
+ return this.raw.createNewStickerSet({ user_id, name, title, emojis, ...other }, signal);
1079
1040
  }
1080
1041
  /**
1081
1042
  * Use this method to add a new sticker to a set created by the bot. You must use exactly one of the fields png_sticker or tgs_sticker. Animated stickers can be added to animated sticker sets and only to them. Animated sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns True on success.
@@ -1141,11 +1102,7 @@ class Api {
1141
1102
  * **Official reference:** https://core.telegram.org/bots/api#answerinlinequery
1142
1103
  */
1143
1104
  answerInlineQuery(inline_query_id, results, other, signal) {
1144
- return this.raw.answerInlineQuery({
1145
- inline_query_id,
1146
- results,
1147
- ...other,
1148
- }, signal);
1105
+ return this.raw.answerInlineQuery({ inline_query_id, results, ...other }, signal);
1149
1106
  }
1150
1107
  /**
1151
1108
  * Use this method to send invoices. On success, the sent Message is returned.
@@ -1198,11 +1155,7 @@ class Api {
1198
1155
  * **Official reference:** https://core.telegram.org/bots/api#answerprecheckoutquery
1199
1156
  */
1200
1157
  answerPreCheckoutQuery(pre_checkout_query_id, ok, other, signal) {
1201
- return this.raw.answerPreCheckoutQuery({
1202
- pre_checkout_query_id,
1203
- ok,
1204
- ...other,
1205
- }, signal);
1158
+ return this.raw.answerPreCheckoutQuery({ pre_checkout_query_id, ok, ...other }, signal);
1206
1159
  }
1207
1160
  /**
1208
1161
  * Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
@@ -1244,13 +1197,7 @@ class Api {
1244
1197
  * **Official reference:** https://core.telegram.org/bots/api#setgamescore
1245
1198
  */
1246
1199
  setGameScore(chat_id, message_id, user_id, score, other, signal) {
1247
- return this.raw.setGameScore({
1248
- chat_id,
1249
- message_id,
1250
- user_id,
1251
- score,
1252
- ...other,
1253
- }, signal);
1200
+ return this.raw.setGameScore({ chat_id, message_id, user_id, score, ...other }, signal);
1254
1201
  }
1255
1202
  /**
1256
1203
  * Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
@@ -1264,12 +1211,7 @@ class Api {
1264
1211
  * **Official reference:** https://core.telegram.org/bots/api#setgamescore
1265
1212
  */
1266
1213
  setGameScoreInline(inline_message_id, user_id, score, other, signal) {
1267
- return this.raw.setGameScore({
1268
- inline_message_id,
1269
- user_id,
1270
- score,
1271
- ...other,
1272
- }, signal);
1214
+ return this.raw.setGameScore({ inline_message_id, user_id, score, ...other }, signal);
1273
1215
  }
1274
1216
  /**
1275
1217
  * Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects.
@@ -1284,11 +1226,7 @@ class Api {
1284
1226
  * **Official reference:** https://core.telegram.org/bots/api#getgamehighscores
1285
1227
  */
1286
1228
  getGameHighScores(chat_id, message_id, user_id, signal) {
1287
- return this.raw.getGameHighScores({
1288
- chat_id,
1289
- message_id,
1290
- user_id,
1291
- }, signal);
1229
+ return this.raw.getGameHighScores({ chat_id, message_id, user_id }, signal);
1292
1230
  }
1293
1231
  /**
1294
1232
  * Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in an inline game. On success, returns an Array of GameHighScore objects.
@@ -1302,10 +1240,7 @@ class Api {
1302
1240
  * **Official reference:** https://core.telegram.org/bots/api#getgamehighscores
1303
1241
  */
1304
1242
  getGameHighScoresInline(inline_message_id, user_id, signal) {
1305
- return this.raw.getGameHighScores({
1306
- inline_message_id,
1307
- user_id,
1308
- }, signal);
1243
+ return this.raw.getGameHighScores({ inline_message_id, user_id }, signal);
1309
1244
  }
1310
1245
  }
1311
1246
  exports.Api = Api;
package/out/filter.d.ts CHANGED
@@ -17,7 +17,7 @@ declare type FilterFunction<C extends Context, D extends C> = (ctx: C) => ctx is
17
17
  * ```
18
18
  *
19
19
  * Check out the
20
- * [documentation](https://doc.deno.land/https/deno.land/x/grammy/mod.ts#Composer)
20
+ * [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/Composer)
21
21
  * of `bot.on` for examples. In addition, the
22
22
  * [website](https://grammy.dev/guide/filter-queries.html) contains more
23
23
  * information about how filter queries work in grammY.
@@ -61,6 +61,7 @@ declare const UPDATE_KEYS: {
61
61
  readonly voice_chat_ended: {};
62
62
  readonly voice_chat_participants_invited: {};
63
63
  readonly forward_date: {};
64
+ readonly is_automatic_forward: {};
64
65
  readonly text: {};
65
66
  readonly animation: {};
66
67
  readonly audio: {};
@@ -140,6 +141,7 @@ declare const UPDATE_KEYS: {
140
141
  readonly voice_chat_ended: {};
141
142
  readonly voice_chat_participants_invited: {};
142
143
  readonly forward_date: {};
144
+ readonly is_automatic_forward: {};
143
145
  readonly text: {};
144
146
  readonly animation: {};
145
147
  readonly audio: {};
@@ -205,6 +207,7 @@ declare const UPDATE_KEYS: {
205
207
  readonly voice_chat_ended: {};
206
208
  readonly voice_chat_participants_invited: {};
207
209
  readonly forward_date: {};
210
+ readonly is_automatic_forward: {};
208
211
  readonly text: {};
209
212
  readonly animation: {};
210
213
  readonly audio: {};
@@ -270,6 +273,7 @@ declare const UPDATE_KEYS: {
270
273
  readonly voice_chat_ended: {};
271
274
  readonly voice_chat_participants_invited: {};
272
275
  readonly forward_date: {};
276
+ readonly is_automatic_forward: {};
273
277
  readonly text: {};
274
278
  readonly animation: {};
275
279
  readonly audio: {};
@@ -398,8 +402,8 @@ declare type PerformQuery<C extends Context, U extends SomeObject> = U extends u
398
402
  declare type FilteredContext<C extends Context, U extends Update> = C & Record<"update", U> & AliasProps<Omit<U, "update_id">> & Shortcuts<U>;
399
403
  interface Shortcuts<U extends Update> {
400
404
  msg: [U["callback_query"]] extends [SomeObject] ? U["callback_query"]["message"] : [U["message"]] extends [SomeObject] ? U["message"] : [U["edited_message"]] extends [SomeObject] ? U["edited_message"] : [U["channel_post"]] extends [SomeObject] ? U["channel_post"] : [U["edited_channel_post"]] extends [SomeObject] ? U["edited_channel_post"] : undefined;
401
- chat: [U["callback_query"]] extends [SomeObject] ? NonNullable<U["callback_query"]["message"]>["chat"] | undefined : [Shortcuts<U>["msg"]] extends [SomeObject] ? Shortcuts<U>["msg"]["chat"] : [U["my_chat_member"]] extends [SomeObject] ? U["my_chat_member"]["chat"] : [U["chat_member"]] extends [SomeObject] ? U["chat_member"]["chat"] : undefined;
402
- from: [U["callback_query"]] extends [SomeObject] ? U["callback_query"]["from"] : [U["inline_query"]] extends [SomeObject] ? U["inline_query"]["from"] : [U["shipping_query"]] extends [SomeObject] ? U["shipping_query"]["from"] : [U["pre_checkout_query"]] extends [SomeObject] ? U["pre_checkout_query"]["from"] : [U["chosen_inline_result"]] extends [SomeObject] ? U["chosen_inline_result"]["from"] : [U["message"]] extends [SomeObject] ? NonNullable<U["message"]["from"]> : [U["edited_message"]] extends [SomeObject] ? NonNullable<U["edited_message"]["from"]> : [U["my_chat_member"]] extends [SomeObject] ? U["my_chat_member"]["from"] : [U["chat_member"]] extends [SomeObject] ? U["chat_member"]["from"] : undefined;
405
+ chat: [U["callback_query"]] extends [SomeObject] ? NonNullable<U["callback_query"]["message"]>["chat"] | undefined : [Shortcuts<U>["msg"]] extends [SomeObject] ? Shortcuts<U>["msg"]["chat"] : [U["my_chat_member"]] extends [SomeObject] ? U["my_chat_member"]["chat"] : [U["chat_member"]] extends [SomeObject] ? U["chat_member"]["chat"] : [U["chat_join_request"]] extends [SomeObject] ? U["chat_join_request"]["chat"] : undefined;
406
+ from: [U["callback_query"]] extends [SomeObject] ? U["callback_query"]["from"] : [U["inline_query"]] extends [SomeObject] ? U["inline_query"]["from"] : [U["shipping_query"]] extends [SomeObject] ? U["shipping_query"]["from"] : [U["pre_checkout_query"]] extends [SomeObject] ? U["pre_checkout_query"]["from"] : [U["chosen_inline_result"]] extends [SomeObject] ? U["chosen_inline_result"]["from"] : [U["message"]] extends [SomeObject] ? NonNullable<U["message"]["from"]> : [U["edited_message"]] extends [SomeObject] ? NonNullable<U["edited_message"]["from"]> : [U["my_chat_member"]] extends [SomeObject] ? U["my_chat_member"]["from"] : [U["chat_member"]] extends [SomeObject] ? U["chat_member"]["from"] : [U["chat_join_request"]] extends [SomeObject] ? U["chat_join_request"]["from"] : undefined;
403
407
  }
404
408
  declare const L1_SHORTCUTS: {
405
409
  readonly "": readonly ["message", "channel_post"];
package/out/filter.js CHANGED
@@ -18,7 +18,7 @@ exports.matchFilter = void 0;
18
18
  * ```
19
19
  *
20
20
  * Check out the
21
- * [documentation](https://doc.deno.land/https/deno.land/x/grammy/mod.ts#Composer)
21
+ * [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/Composer)
22
22
  * of `bot.on` for examples. In addition, the
23
23
  * [website](https://grammy.dev/guide/filter-queries.html) contains more
24
24
  * information about how filter queries work in grammY.
@@ -249,6 +249,7 @@ const COMMON_MESSAGE_KEYS = {
249
249
  voice_chat_ended: {},
250
250
  voice_chat_participants_invited: {},
251
251
  forward_date: {},
252
+ is_automatic_forward: {},
252
253
  };
253
254
  const MESSAGE_KEYS = {
254
255
  ...COMMON_MESSAGE_KEYS,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grammy",
3
3
  "description": "The Telegram Bot Framework.",
4
- "version": "1.4.3",
4
+ "version": "1.5.0",
5
5
  "author": "KnorpelSenf",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -23,7 +23,7 @@
23
23
  "contribs": "all-contributors"
24
24
  },
25
25
  "dependencies": {
26
- "@grammyjs/types": "^2.3.1",
26
+ "@grammyjs/types": "^2.4.0",
27
27
  "abort-controller": "^3.0.0",
28
28
  "debug": "^4.3.3",
29
29
  "node-fetch": "^2.6.5"