grammy 1.19.2 → 1.20.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.9-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-7.0-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-)
@@ -260,7 +260,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
260
260
  <td align="center" valign="top" width="11.11%"><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> <a href="https://github.com/grammyjs/grammY/commits?author=shevernitskiy" title="Code">💻</a></td>
261
261
  <td align="center" valign="top" width="11.11%"><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>
262
262
  <td align="center" valign="top" width="11.11%"><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> <a href="https://github.com/grammyjs/grammY/commits?author=LWJerri" title="Documentation">📖</a> <a href="#translation-LWJerri" title="Translation">🌍</a></td>
263
- <td align="center" valign="top" width="11.11%"><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>
263
+ <td align="center" valign="top" width="11.11%"><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> <a href="https://github.com/grammyjs/grammY/issues?q=author%3AAbbassAlmusawi" title="Bug reports">🐛</a></td>
264
264
  </tr>
265
265
  <tr>
266
266
  <td align="center" valign="top" width="11.11%"><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> <a href="https://github.com/grammyjs/grammY/commits?author=inji-gg" title="Code">💻</a></td>
@@ -280,6 +280,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
280
280
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/shaunnope"><img src="https://avatars.githubusercontent.com/u/19631195?v=4?s=100" width="100px;" alt="Sean Yap"/><br /><sub><b>Sean Yap</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Ashaunnope" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/commits?author=shaunnope" title="Code">💻</a></td>
281
281
  <td align="center" valign="top" width="11.11%"><a href="https://sergeysolovev.com"><img src="https://avatars.githubusercontent.com/u/5831301?v=4?s=100" width="100px;" alt="Sergey Solovev"/><br /><sub><b>Sergey Solovev</b></sub></a><br /><a href="#ideas-sergeysolovev" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Asergeysolovev" title="Reviewed Pull Requests">👀</a></td>
282
282
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/HeySreelal"><img src="https://avatars.githubusercontent.com/u/94184909?v=4?s=100" width="100px;" alt="Sree (Taylor's Version)"/><br /><sub><b>Sree (Taylor's Version)</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3AHeySreelal" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/commits?author=HeySreelal" title="Code">💻</a></td>
283
+ <td align="center" valign="top" width="11.11%"><a href="http://linkedin.com/in/thecoorum"><img src="https://avatars.githubusercontent.com/u/32096016?v=4?s=100" width="100px;" alt="Yaroslav Vovchenko"/><br /><sub><b>Yaroslav Vovchenko</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Athecoorum" title="Bug reports">🐛</a></td>
283
284
  </tr>
284
285
  </tbody>
285
286
  </table>
package/out/bot.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { BotError, Composer, type Middleware } from "./composer.js";
2
- import { Context } from "./context.js";
1
+ import { BotError, Composer, type Middleware, type ReactionMiddleware } from "./composer.js";
2
+ import { Context, type MaybeArray, type ReactionContext } from "./context.js";
3
3
  import { Api } from "./core/api.js";
4
4
  import { type ApiClientOptions, type WebhookReplyEnvelope } from "./core/client.js";
5
5
  import { type Filter, type FilterQuery } from "./filter.js";
6
- import { type Update, type UserFromGetMe } from "./types.js";
7
- export declare const DEFAULT_UPDATE_TYPES: readonly ["message", "edited_message", "channel_post", "edited_channel_post", "inline_query", "chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "poll", "poll_answer", "my_chat_member", "chat_join_request"];
6
+ import { type ReactionType, type ReactionTypeEmoji, type Update, type UserFromGetMe } from "./types.js";
7
+ export declare const DEFAULT_UPDATE_TYPES: readonly ["message", "edited_message", "channel_post", "edited_channel_post", "inline_query", "chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "poll", "poll_answer", "my_chat_member", "chat_join_request", "chat_boost", "removed_chat_boost"];
8
8
  /**
9
9
  * Options that can be specified when running the bot via simple long polling.
10
10
  */
@@ -163,6 +163,10 @@ export declare class Bot<C extends Context = Context, A extends Api = Api> exten
163
163
  * @inheritdoc
164
164
  */
165
165
  on<Q extends FilterQuery>(filter: Q | Q[], ...middleware: Array<Middleware<Filter<C, Q>>>): Composer<Filter<C, Q>>;
166
+ /**
167
+ * @inheritdoc
168
+ */
169
+ reaction(reaction: MaybeArray<ReactionTypeEmoji["emoji"] | ReactionType>, ...middleware: Array<ReactionMiddleware<C>>): Composer<ReactionContext<C>>;
166
170
  /**
167
171
  * Checks if the bot has been initialized. A bot is initialized if the bot
168
172
  * information is set. The bot information can either be set automatically
package/out/bot.js CHANGED
@@ -26,6 +26,8 @@ exports.DEFAULT_UPDATE_TYPES = [
26
26
  "poll_answer",
27
27
  "my_chat_member",
28
28
  "chat_join_request",
29
+ "chat_boost",
30
+ "removed_chat_boost",
29
31
  ];
30
32
  /**
31
33
  * This is the single most important class of grammY. It represents your bot.
@@ -125,6 +127,13 @@ class Bot extends composer_js_1.Composer {
125
127
  }
126
128
  return super.on(filter, ...middleware);
127
129
  }
130
+ /**
131
+ * @inheritdoc
132
+ */
133
+ reaction(reaction, ...middleware) {
134
+ this.observedUpdateTypes.add("message_reaction");
135
+ return super.reaction(reaction, ...middleware);
136
+ }
128
137
  /**
129
138
  * Checks if the bot has been initialized. A bot is initialized if the bot
130
139
  * information is set. The bot information can either be set automatically
package/out/composer.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { type CallbackQueryContext, type ChatTypeContext, type ChosenInlineResultContext, type CommandContext, Context, type GameQueryContext, type HearsContext, type InlineQueryContext, type MaybeArray, type StringWithSuggestions } from "./context.js";
1
+ import { type CallbackQueryContext, type ChatTypeContext, type ChosenInlineResultContext, type CommandContext, Context, type GameQueryContext, type HearsContext, type InlineQueryContext, type MaybeArray, type ReactionContext, type StringWithSuggestions } from "./context.js";
2
2
  import { type Filter, type FilterQuery } from "./filter.js";
3
- import { type Chat } from "./types.js";
3
+ import { type Chat, type ReactionType, type ReactionTypeEmoji } from "./types.js";
4
4
  type MaybePromise<T> = T | Promise<T>;
5
5
  /**
6
6
  * A function of this type is passed as the second parameter to all middleware.
@@ -173,7 +173,7 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
173
173
  * (logical AND), you can chain the `.on` calls:
174
174
  * ```ts
175
175
  * // Matches all messages and channel posts that both a) contain a URL and b) are forwards
176
- * bot.on('::url').on(':forward_date', ctx => { ... })
176
+ * bot.on('::url').on(':forward_origin', ctx => { ... })
177
177
  * ```
178
178
  *
179
179
  * @param filter The filter query to use, may also be an array of queries
@@ -268,6 +268,33 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
268
268
  * @param middleware The middleware to register
269
269
  */
270
270
  command<S extends string>(command: MaybeArray<StringWithSuggestions<S | "start" | "help" | "settings">>, ...middleware: Array<CommandMiddleware<C>>): Composer<CommandContext<C>>;
271
+ /**
272
+ * Registers some middleware that will only be added when a new reaction of
273
+ * the given type is added to a message.
274
+ * ```ts
275
+ * // Reacts to new '👍' reactions
276
+ * bot.reaction('👍', ctx => { ... })
277
+ * // Reacts to new '👍' or '👎' reactions
278
+ * bot.reaction(['👍', '👎'], ctx => { ... })
279
+ * ```
280
+ *
281
+ * > Note that you have to enable `message_reaction` updates in
282
+ * `allowed_updates` if you want your bot to receive updates about message
283
+ * reactions.
284
+ *
285
+ * `bot.reaction` will trigger if:
286
+ * - a new emoji reaction is added to a message
287
+ * - a new custom emoji reaction is added a message
288
+ *
289
+ * `bot.reaction` will not trigger if:
290
+ * - a reaction is removed
291
+ * - an anonymous reaction count is updated, such as on channel posts
292
+ * - `message_reaction` updates are not enabled for your bot
293
+ *
294
+ * @param reaction The reaction to look for
295
+ * @param middleware The middleware to register
296
+ */
297
+ reaction(reaction: MaybeArray<ReactionTypeEmoji["emoji"] | ReactionType>, ...middleware: Array<ReactionMiddleware<C>>): Composer<ReactionContext<C>>;
271
298
  /**
272
299
  * Registers some middleware for certain chat types only. For example, you
273
300
  * can use this method to only receive updates from private chats. The four
@@ -620,6 +647,15 @@ export type HearsMiddleware<C extends Context> = Middleware<HearsContext<C>>;
620
647
  * modular code where handlers are defined in separate files.
621
648
  */
622
649
  export type CommandMiddleware<C extends Context> = Middleware<CommandContext<C>>;
650
+ /**
651
+ * Type of the middleware that can be passed to `bot.reaction`.
652
+ *
653
+ * This helper type can be used to annotate middleware functions that are
654
+ * defined in one place, so that they have the correct type when passed to
655
+ * `bot.reaction` in a different place. For instance, this allows for more
656
+ * modular code where handlers are defined in separate files.
657
+ */
658
+ export type ReactionMiddleware<C extends Context> = Middleware<ReactionContext<C>>;
623
659
  /**
624
660
  * Type of the middleware that can be passed to `bot.callbackQuery`.
625
661
  *
package/out/composer.js CHANGED
@@ -174,7 +174,7 @@ class Composer {
174
174
  * (logical AND), you can chain the `.on` calls:
175
175
  * ```ts
176
176
  * // Matches all messages and channel posts that both a) contain a URL and b) are forwards
177
- * bot.on('::url').on(':forward_date', ctx => { ... })
177
+ * bot.on('::url').on(':forward_origin', ctx => { ... })
178
178
  * ```
179
179
  *
180
180
  * @param filter The filter query to use, may also be an array of queries
@@ -275,6 +275,35 @@ class Composer {
275
275
  command(command, ...middleware) {
276
276
  return this.filter(context_js_1.Context.has.command(command), ...middleware);
277
277
  }
278
+ /**
279
+ * Registers some middleware that will only be added when a new reaction of
280
+ * the given type is added to a message.
281
+ * ```ts
282
+ * // Reacts to new '👍' reactions
283
+ * bot.reaction('👍', ctx => { ... })
284
+ * // Reacts to new '👍' or '👎' reactions
285
+ * bot.reaction(['👍', '👎'], ctx => { ... })
286
+ * ```
287
+ *
288
+ * > Note that you have to enable `message_reaction` updates in
289
+ * `allowed_updates` if you want your bot to receive updates about message
290
+ * reactions.
291
+ *
292
+ * `bot.reaction` will trigger if:
293
+ * - a new emoji reaction is added to a message
294
+ * - a new custom emoji reaction is added a message
295
+ *
296
+ * `bot.reaction` will not trigger if:
297
+ * - a reaction is removed
298
+ * - an anonymous reaction count is updated, such as on channel posts
299
+ * - `message_reaction` updates are not enabled for your bot
300
+ *
301
+ * @param reaction The reaction to look for
302
+ * @param middleware The middleware to register
303
+ */
304
+ reaction(reaction, ...middleware) {
305
+ return this.filter(context_js_1.Context.has.reaction(reaction), ...middleware);
306
+ }
278
307
  /**
279
308
  * Registers some middleware for certain chat types only. For example, you
280
309
  * can use this method to only receive updates from private chats. The four
package/out/context.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type Api, type Other as OtherApi } from "./core/api.js";
2
2
  import { type Methods, type RawApi } from "./core/client.js";
3
3
  import { type Filter, type FilterCore, type FilterQuery } from "./filter.js";
4
- import { type Chat, type ChatPermissions, type InlineQueryResult, type InputFile, type InputMedia, type InputMediaAudio, type InputMediaDocument, type InputMediaPhoto, type InputMediaVideo, type LabeledPrice, type Message, type MessageEntity, type PassportElementError, type Update, type User, type UserFromGetMe } from "./types.js";
4
+ import { type Chat, type ChatPermissions, type InlineQueryResult, type InputFile, type InputMedia, type InputMediaAudio, type InputMediaDocument, type InputMediaPhoto, type InputMediaVideo, type LabeledPrice, type Message, type MessageEntity, type PassportElementError, type ReactionType, type ReactionTypeEmoji, type Update, type User, type UserFromGetMe } from "./types.js";
5
5
  export type MaybeArray<T> = T | T[];
6
6
  export type StringWithSuggestions<S extends string> = (string & Record<never, never>) | S;
7
7
  type Other<M extends Methods<RawApi>, X extends string = never> = OtherApi<RawApi, M, X>;
@@ -33,6 +33,14 @@ interface StaticHas {
33
33
  * @param command The command to match
34
34
  */
35
35
  command<S extends string>(command: MaybeArray<StringWithSuggestions<S | "start" | "help" | "settings">>): <C extends Context>(ctx: C) => ctx is CommandContext<C>;
36
+ /**
37
+ * Generates a predicate function that can test context
38
+ * objects for containing a message reaction update. This uses the same
39
+ * logic as `bot.reaction`.
40
+ *
41
+ * @param reaction The reaction to test against
42
+ */
43
+ reaction(reaction: MaybeArray<ReactionTypeEmoji["emoji"] | ReactionType>): <C extends Context>(ctx: C) => ctx is ReactionContext<C>;
36
44
  /**
37
45
  * Generates a predicate function that can test context objects for
38
46
  * belonging to a chat with the given chat type. This uses the same logic as
@@ -153,6 +161,10 @@ export declare class Context implements RenamedUpdate {
153
161
  get channelPost(): (Message & Update.Channel) | undefined;
154
162
  /** Alias for `ctx.update.edited_channel_post` */
155
163
  get editedChannelPost(): (Message & Update.Edited & Update.Channel) | undefined;
164
+ /** Alias for `ctx.update.message_reaction` */
165
+ get messageReaction(): import("@grammyjs/types/message.js").MessageReactionUpdated | undefined;
166
+ /** Alias for `ctx.update.message_reaction_count` */
167
+ get messageReactionCount(): import("@grammyjs/types/message.js").MessageReactionCountUpdated | undefined;
156
168
  /** Alias for `ctx.update.inline_query` */
157
169
  get inlineQuery(): import("@grammyjs/types/inline.js").InlineQuery | undefined;
158
170
  /** Alias for `ctx.update.chosen_inline_result` */
@@ -173,6 +185,10 @@ export declare class Context implements RenamedUpdate {
173
185
  get chatMember(): import("@grammyjs/types/manage.js").ChatMemberUpdated | undefined;
174
186
  /** Alias for `ctx.update.chat_join_request` */
175
187
  get chatJoinRequest(): import("@grammyjs/types/manage.js").ChatJoinRequest | undefined;
188
+ /** Alias for `ctx.update.chat_boost` */
189
+ get chatBoost(): import("@grammyjs/types/manage.js").ChatBoostUpdated | undefined;
190
+ /** Alias for `ctx.update.removed_chat_boost` */
191
+ get removedChatBoost(): import("@grammyjs/types/manage.js").ChatBoostRemoved | undefined;
176
192
  /**
177
193
  * Get message object from wherever possible. Alias for `ctx.message ??
178
194
  * ctx.editedMessage ?? ctx.callbackQuery?.message ?? ctx.channelPost ??
@@ -181,7 +197,9 @@ export declare class Context implements RenamedUpdate {
181
197
  get msg(): Message | undefined;
182
198
  /**
183
199
  * Get chat object from wherever possible. Alias for `(ctx.msg ??
184
- * ctx.myChatMember ?? ctx.chatMember ?? ctx.chatJoinRequest)?.chat`
200
+ * ctx.myChatMember ?? ctx.chatMember ?? ctx.chatJoinRequest ??
201
+ * ctx.messageReaction ?? ctx.messageReactionCount ?? ctx.chatBoost ??
202
+ * ctx.removedChatBoost)?.chat`
185
203
  */
186
204
  get chat(): Chat | undefined;
187
205
  /**
@@ -218,12 +236,64 @@ export declare class Context implements RenamedUpdate {
218
236
  * @returns Array of entities and their texts, or empty array when there's no text
219
237
  */
220
238
  entities(): Array<MessageEntity & {
239
+ /** Slice of the message text that contains this entity */
221
240
  text: string;
222
241
  }>;
223
242
  entities<T extends MessageEntity["type"]>(types: MaybeArray<T>): Array<MessageEntity & {
224
243
  type: T;
244
+ /** Slice of the message text that contains this entity */
225
245
  text: string;
226
246
  }>;
247
+ /**
248
+ * Find out which reactions were added and removed in a `message_reaction`
249
+ * update. This method looks at `ctx.messageReaction` and computes the
250
+ * difference between the old reaction and the new reaction. It also groups
251
+ * the reactions by emoji reactions and custom emoji reactions. For example,
252
+ * the resulting object could look like this:
253
+ * ```ts
254
+ * {
255
+ * emoji: ['👍', '🎉']
256
+ * emojiAdded: ['🎉'],
257
+ * emojiKept: ['👍'],
258
+ * emojiRemoved: [],
259
+ * customEmoji: [],
260
+ * customEmojiAdded: [],
261
+ * customEmojiKept: [],
262
+ * customEmojiRemoved: ['id0123'],
263
+ * }
264
+ * ```
265
+ * In the above example, a tada reaction was added by the user, and a custom
266
+ * emoji reaction with the custom emoji 'id0123' was removed in the same
267
+ * update. The user had already reacted with a thumbs up reaction, which
268
+ * they left unchanged. As a result, the current reaction by the user is
269
+ * thumbs up and tada. Note that the current reaction (both emoji and custom
270
+ * emoji in one list) can also be obtained from
271
+ * `ctx.messageReaction.new_reaction`.
272
+ *
273
+ * Remember that reaction updates only include information about the
274
+ * reaction of a specific user. The respective message may have many more
275
+ * reactions by other people which will not be included in this update.
276
+ *
277
+ * @returns An object containing information about the reaction update
278
+ */
279
+ reactions(): {
280
+ /** Emoji currently present in this user's reaction */
281
+ emoji: ReactionTypeEmoji["emoji"][];
282
+ /** Emoji newly added to this user's reaction */
283
+ emojiAdded: ReactionTypeEmoji["emoji"][];
284
+ /** Emoji not changed by the update to this user's reaction */
285
+ emojiKept: ReactionTypeEmoji["emoji"][];
286
+ /** Emoji removed from this user's reaction */
287
+ emojiRemoved: ReactionTypeEmoji["emoji"][];
288
+ /** Custom emoji currently present in this user's reaction */
289
+ customEmoji: string[];
290
+ /** Custom emoji newly added to this user's reaction */
291
+ customEmojiAdded: string[];
292
+ /** Custom emoji not changed by the update to this user's reaction */
293
+ customEmojiKept: string[];
294
+ /** Custom emoji removed from this user's reaction */
295
+ customEmojiRemoved: string[];
296
+ };
227
297
  /**
228
298
  * `Context.has` is an object that contains a number of useful functions for
229
299
  * probing context objects. Each of these functions can generate a predicate
@@ -267,6 +337,7 @@ export declare class Context implements RenamedUpdate {
267
337
  * @param command The command to match
268
338
  */
269
339
  hasCommand<S extends string>(command: MaybeArray<StringWithSuggestions<S | "start" | "help" | "settings">>): this is CommandContextCore;
340
+ hasReaction(reaction: MaybeArray<ReactionTypeEmoji["emoji"] | ReactionType>): this is ReactionContextCore;
270
341
  /**
271
342
  * Returns `true` if this context object belongs to a chat with the given
272
343
  * chat type, and `false` otherwise. This uses the same logic as
@@ -319,7 +390,7 @@ export declare class Context implements RenamedUpdate {
319
390
  */
320
391
  reply(text: string, other?: Other<"sendMessage", "chat_id" | "text">, signal?: AbortSignal): Promise<Message.TextMessage>;
321
392
  /**
322
- * Context-aware alias for `api.forwardMessage`. Use this method to forward messages of any kind. Service messages can't be forwarded. On success, the sent Message is returned.
393
+ * Context-aware alias for `api.forwardMessage`. Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent Message is returned.
323
394
  *
324
395
  * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
325
396
  * @param other Optional remaining parameters, confer the official reference below
@@ -329,7 +400,18 @@ export declare class Context implements RenamedUpdate {
329
400
  */
330
401
  forwardMessage(chat_id: number | string, other?: Other<"forwardMessage", "chat_id" | "from_chat_id" | "message_id">, signal?: AbortSignal): Promise<Message>;
331
402
  /**
332
- * Context-aware alias for `api.copyMessage`. Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. 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.
403
+ * Context-aware alias for `api.forwardMessages`. Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned.
404
+ *
405
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
406
+ * @param message_ids Identifiers of 1-100 messages in the current chat to forward. The identifiers must be specified in a strictly increasing order.
407
+ * @param other Optional remaining parameters, confer the official reference below
408
+ * @param signal Optional `AbortSignal` to cancel the request
409
+ *
410
+ * **Official reference:** https://core.telegram.org/bots/api#forwardmessages
411
+ */
412
+ forwardMessages(chat_id: number | string, message_ids: number[], other?: Other<"forwardMessages", "chat_id" | "from_chat_id" | "message_ids">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").MessageId[]>;
413
+ /**
414
+ * Context-aware alias for `api.copyMessage`. Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. 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.
333
415
  *
334
416
  * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
335
417
  * @param other Optional remaining parameters, confer the official reference below
@@ -338,6 +420,17 @@ export declare class Context implements RenamedUpdate {
338
420
  * **Official reference:** https://core.telegram.org/bots/api#copymessage
339
421
  */
340
422
  copyMessage(chat_id: number | string, other?: Other<"copyMessage", "chat_id" | "from_chat_id" | "message_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").MessageId>;
423
+ /**
424
+ * Context-aware alias for `api.copyMessages`.Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned.
425
+ *
426
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
427
+ * @param message_ids Identifiers of 1-100 messages in the current chat to copy. The identifiers must be specified in a strictly increasing order.
428
+ * @param other Optional remaining parameters, confer the official reference below
429
+ * @param signal Optional `AbortSignal` to cancel the request
430
+ *
431
+ * **Official reference:** https://core.telegram.org/bots/api#copymessages
432
+ */
433
+ copyMessages(chat_id: number | string, message_ids: number[], other?: Other<"copyMessages", "chat_id" | "from_chat_id" | "message_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").MessageId[]>;
341
434
  /**
342
435
  * Context-aware alias for `api.sendPhoto`. Use this method to send photos. On success, the sent Message is returned.
343
436
  *
@@ -501,6 +594,16 @@ export declare class Context implements RenamedUpdate {
501
594
  * **Official reference:** https://core.telegram.org/bots/api#senddice
502
595
  */
503
596
  replyWithDice(emoji: string, other?: Other<"sendDice", "chat_id" | "emoji">, signal?: AbortSignal): Promise<Message.DiceMessage>;
597
+ /**
598
+ * Context-aware alias for `api.setMessageReaction`. Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. In albums, bots must react to the first message. Returns True on success.
599
+ *
600
+ * @param reaction New list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators.
601
+ * @param other Optional remaining parameters, confer the official reference below
602
+ * @param signal Optional `AbortSignal` to cancel the request
603
+ *
604
+ * **Official reference:** https://core.telegram.org/bots/api#senddice
605
+ */
606
+ react(reaction: MaybeArray<ReactionTypeEmoji["emoji"] | ReactionType>, other?: Other<"setMessageReaction", "chat_id" | "message_id" | "reaction">, signal?: AbortSignal): Promise<true>;
504
607
  /**
505
608
  * Context-aware alias for `api.sendChatAction`. Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
506
609
  *
@@ -525,6 +628,15 @@ export declare class Context implements RenamedUpdate {
525
628
  * **Official reference:** https://core.telegram.org/bots/api#getuserprofilephotos
526
629
  */
527
630
  getUserProfilePhotos(other?: Other<"getUserProfilePhotos", "user_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").UserProfilePhotos>;
631
+ /**
632
+ * Context-aware alias for `api.getUserChatBoosts`. Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.
633
+ *
634
+ * @param chat_id Unique identifier for the chat or username of the channel (in the format @channelusername)
635
+ * @param signal Optional `AbortSignal` to cancel the request
636
+ *
637
+ * **Official reference:** https://core.telegram.org/bots/api#getuserchatboosts
638
+ */
639
+ getUserChatBoosts(chat_id: number | string, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").UserChatBoosts>;
528
640
  /**
529
641
  * Context-aware alias for `api.getFile`. Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
530
642
  *
@@ -534,7 +646,7 @@ export declare class Context implements RenamedUpdate {
534
646
  *
535
647
  * **Official reference:** https://core.telegram.org/bots/api#getfile
536
648
  */
537
- getFile(signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").File>;
649
+ getFile(signal?: AbortSignal): Promise<File>;
538
650
  /** @deprecated Use `banAuthor` instead. */
539
651
  kickAuthor(...args: Parameters<Context["banAuthor"]>): Promise<true>;
540
652
  /**
@@ -544,7 +656,8 @@ export declare class Context implements RenamedUpdate {
544
656
  * @param signal Optional `AbortSignal` to cancel the request
545
657
  *
546
658
  * **Official reference:** https://core.telegram.org/bots/api#banchatmember
547
- */ banAuthor(other?: Other<"banChatMember", "chat_id" | "user_id">, signal?: AbortSignal): Promise<true>;
659
+ */
660
+ banAuthor(other?: Other<"banChatMember", "chat_id" | "user_id">, signal?: AbortSignal): Promise<true>;
548
661
  /** @deprecated Use `banChatMember` instead. */
549
662
  kickChatMember(...args: Parameters<Context["banChatMember"]>): Promise<true>;
550
663
  /**
@@ -1049,6 +1162,16 @@ export declare class Context implements RenamedUpdate {
1049
1162
  * **Official reference:** https://core.telegram.org/bots/api#deletemessage
1050
1163
  */
1051
1164
  deleteMessage(signal?: AbortSignal): Promise<true>;
1165
+ /**
1166
+ * Context-aware alias for `api.deleteMessages`. Use this method to delete multiple messages simultaneously. Returns True on success.
1167
+ *
1168
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1169
+ * @param message_ids Identifiers of 1-100 messages to delete. See deleteMessage for limitations on which messages can be deleted
1170
+ * @param signal Optional `AbortSignal` to cancel the request
1171
+ *
1172
+ * **Official reference:** https://core.telegram.org/bots/api#deletemessages
1173
+ */
1174
+ deleteMessages(message_ids: number[], signal?: AbortSignal): Promise<true>;
1052
1175
  /**
1053
1176
  * Context-aware alias for `api.sendSticker`. Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned.
1054
1177
  *
@@ -1205,6 +1328,18 @@ type InlineQueryContextCore = FilterCore<"inline_query">;
1205
1328
  * in separate files and still have the correct types.
1206
1329
  */
1207
1330
  export type InlineQueryContext<C extends Context> = Filter<C, "inline_query">;
1331
+ type ReactionContextCore = FilterCore<"message_reaction">;
1332
+ /**
1333
+ * Type of the context object that is available inside the handlers for
1334
+ * `bot.reaction`.
1335
+ *
1336
+ * This helper type can be used to narrow down context objects the same way how
1337
+ * annotate `bot.reaction` does it. This allows you to context objects in
1338
+ * middleware that is not directly passed to `bot.reaction`, hence not inferring
1339
+ * the correct type automatically. That way, handlers can be defined in separate
1340
+ * files and still have the correct types.
1341
+ */
1342
+ export type ReactionContext<C extends Context> = Filter<C, "message_reaction">;
1208
1343
  type ChosenInlineResultContextCore = FilterCore<"chosen_inline_result">;
1209
1344
  /**
1210
1345
  * Type of the context object that is available inside the handlers for