grammy 1.25.2 → 1.26.1

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-7.5-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.6-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-)
package/out/composer.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type CallbackQueryContext, type ChatTypeContext, type ChosenInlineResultContext, type CommandContext, Context, type GameQueryContext, type HearsContext, type InlineQueryContext, type MaybeArray, type PreCheckoutQueryContext, type ReactionContext, type ShippingQueryContext, 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 PreCheckoutQueryContext, type ReactionContext, type ShippingQueryContext, type StringWithCommandSuggestions } from "./context.js";
2
2
  import { type Filter, type FilterQuery } from "./filter.js";
3
3
  import { type Chat, type ReactionType, type ReactionTypeEmoji } from "./types.js";
4
4
  type MaybePromise<T> = T | Promise<T>;
@@ -267,7 +267,7 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
267
267
  * @param command The command to look for
268
268
  * @param middleware The middleware to register
269
269
  */
270
- command<S extends string>(command: MaybeArray<StringWithSuggestions<S | "start" | "help" | "settings">>, ...middleware: Array<CommandMiddleware<C>>): Composer<CommandContext<C>>;
270
+ command(command: MaybeArray<StringWithCommandSuggestions>, ...middleware: Array<CommandMiddleware<C>>): Composer<CommandContext<C>>;
271
271
  /**
272
272
  * Registers some middleware that will only be added when a new reaction of
273
273
  * the given type is added to a message.
@@ -412,10 +412,10 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
412
412
  inlineQuery(trigger: MaybeArray<string | RegExp>, ...middleware: Array<InlineQueryMiddleware<C>>): Composer<InlineQueryContext<C>>;
413
413
  /**
414
414
  * Registers middleware for the ChosenInlineResult by the given id or ids.
415
- * ChosenInlineResult represents a result of an inline query that was
416
- * chosen by the user and sent to their chat partner. Check out
417
- * https://core.telegram.org/bots/api#choseninlineresult to read more
418
- * about chosen inline results.
415
+ * ChosenInlineResult represents a result of an inline query that was chosen
416
+ * by the user and sent to their chat partner. Check out
417
+ * https://core.telegram.org/bots/api#choseninlineresult to read more about
418
+ * chosen inline results.
419
419
  *
420
420
  * ```ts
421
421
  * bot.chosenInlineResult('id', async ctx => {
@@ -429,13 +429,14 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
429
429
  */
430
430
  chosenInlineResult(resultId: MaybeArray<string | RegExp>, ...middleware: Array<ChosenInlineResultMiddleware<C>>): Composer<ChosenInlineResultContext<C>>;
431
431
  /**
432
- * Registers middleware for pre-checkout queries. Telegram sends a pre-checkout
433
- * query to your bot whenever a user has confirmed their payment and shipping
434
- * details. You bot will then receive all information about the order and
435
- * has to respond within 10 seconds with a confirmation of whether everything
436
- * is alright (goods are available, etc.) and the bot is ready to proceed
437
- * with the order. Check out https://core.telegram.org/bots/api#precheckoutquery
438
- * to read more about pre-checkout queries.
432
+ * Registers middleware for pre-checkout queries. Telegram sends a
433
+ * pre-checkout query to your bot whenever a user has confirmed their
434
+ * payment and shipping details. You bot will then receive all information
435
+ * about the order and has to respond within 10 seconds with a confirmation
436
+ * of whether everything is alright (goods are available, etc.) and the bot
437
+ * is ready to proceed with the order. Check out
438
+ * https://core.telegram.org/bots/api#precheckoutquery to read more about
439
+ * pre-checkout queries.
439
440
  *
440
441
  * ```ts
441
442
  * bot.preCheckoutQuery('invoice_payload', async ctx => {
@@ -449,13 +450,14 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
449
450
  */
450
451
  preCheckoutQuery(trigger: MaybeArray<string | RegExp>, ...middleware: Array<PreCheckoutQueryMiddleware<C>>): Composer<PreCheckoutQueryContext<C>>;
451
452
  /**
452
- * Registers middleware for shipping queries. If you sent an invoice requesting
453
- * a shipping address and the parameter _is_flexible_ was specified, Telegram
454
- * will send a shipping query to your bot whenever a user has confirmed their
455
- * shipping details. You bot will then receive the shipping information and
456
- * can respond with a confirmation of whether delivery to the specified address
457
- * is possible. Check out https://core.telegram.org/bots/api#shippingquery to
458
- * read more about shipping queries.
453
+ * Registers middleware for shipping queries. If you sent an invoice
454
+ * requesting a shipping address and the parameter _is_flexible_ was
455
+ * specified, Telegram will send a shipping query to your bot whenever a
456
+ * user has confirmed their shipping details. You bot will then receive the
457
+ * shipping information and can respond with a confirmation of whether
458
+ * delivery to the specified address is possible. Check out
459
+ * https://core.telegram.org/bots/api#shippingquery to read more about
460
+ * shipping queries.
459
461
  *
460
462
  * ```ts
461
463
  * bot.shippingQuery('invoice_payload', async ctx => {
@@ -728,8 +730,8 @@ export type InlineQueryMiddleware<C extends Context> = Middleware<InlineQueryCon
728
730
  *
729
731
  * This helper type can be used to annotate middleware functions that are
730
732
  * defined in one place, so that they have the correct type when passed to
731
- * `bot.chosenInlineResult` in a different place. For instance, this allows for more
732
- * modular code where handlers are defined in separate files.
733
+ * `bot.chosenInlineResult` in a different place. For instance, this allows for
734
+ * more modular code where handlers are defined in separate files.
733
735
  */
734
736
  export type ChosenInlineResultMiddleware<C extends Context> = Middleware<ChosenInlineResultContext<C>>;
735
737
  /**
@@ -737,8 +739,8 @@ export type ChosenInlineResultMiddleware<C extends Context> = Middleware<ChosenI
737
739
  *
738
740
  * This helper type can be used to annotate middleware functions that are
739
741
  * defined in one place, so that they have the correct type when passed to
740
- * `bot.preCheckoutQuery` in a different place. For instance, this allows for more
741
- * modular code where handlers are defined in separate files.
742
+ * `bot.preCheckoutQuery` in a different place. For instance, this allows for
743
+ * more modular code where handlers are defined in separate files.
742
744
  */
743
745
  export type PreCheckoutQueryMiddleware<C extends Context> = Middleware<PreCheckoutQueryContext<C>>;
744
746
  /**
package/out/composer.js CHANGED
@@ -429,10 +429,10 @@ class Composer {
429
429
  }
430
430
  /**
431
431
  * Registers middleware for the ChosenInlineResult by the given id or ids.
432
- * ChosenInlineResult represents a result of an inline query that was
433
- * chosen by the user and sent to their chat partner. Check out
434
- * https://core.telegram.org/bots/api#choseninlineresult to read more
435
- * about chosen inline results.
432
+ * ChosenInlineResult represents a result of an inline query that was chosen
433
+ * by the user and sent to their chat partner. Check out
434
+ * https://core.telegram.org/bots/api#choseninlineresult to read more about
435
+ * chosen inline results.
436
436
  *
437
437
  * ```ts
438
438
  * bot.chosenInlineResult('id', async ctx => {
@@ -448,13 +448,14 @@ class Composer {
448
448
  return this.filter(context_js_1.Context.has.chosenInlineResult(resultId), ...middleware);
449
449
  }
450
450
  /**
451
- * Registers middleware for pre-checkout queries. Telegram sends a pre-checkout
452
- * query to your bot whenever a user has confirmed their payment and shipping
453
- * details. You bot will then receive all information about the order and
454
- * has to respond within 10 seconds with a confirmation of whether everything
455
- * is alright (goods are available, etc.) and the bot is ready to proceed
456
- * with the order. Check out https://core.telegram.org/bots/api#precheckoutquery
457
- * to read more about pre-checkout queries.
451
+ * Registers middleware for pre-checkout queries. Telegram sends a
452
+ * pre-checkout query to your bot whenever a user has confirmed their
453
+ * payment and shipping details. You bot will then receive all information
454
+ * about the order and has to respond within 10 seconds with a confirmation
455
+ * of whether everything is alright (goods are available, etc.) and the bot
456
+ * is ready to proceed with the order. Check out
457
+ * https://core.telegram.org/bots/api#precheckoutquery to read more about
458
+ * pre-checkout queries.
458
459
  *
459
460
  * ```ts
460
461
  * bot.preCheckoutQuery('invoice_payload', async ctx => {
@@ -470,13 +471,14 @@ class Composer {
470
471
  return this.filter(context_js_1.Context.has.preCheckoutQuery(trigger), ...middleware);
471
472
  }
472
473
  /**
473
- * Registers middleware for shipping queries. If you sent an invoice requesting
474
- * a shipping address and the parameter _is_flexible_ was specified, Telegram
475
- * will send a shipping query to your bot whenever a user has confirmed their
476
- * shipping details. You bot will then receive the shipping information and
477
- * can respond with a confirmation of whether delivery to the specified address
478
- * is possible. Check out https://core.telegram.org/bots/api#shippingquery to
479
- * read more about shipping queries.
474
+ * Registers middleware for shipping queries. If you sent an invoice
475
+ * requesting a shipping address and the parameter _is_flexible_ was
476
+ * specified, Telegram will send a shipping query to your bot whenever a
477
+ * user has confirmed their shipping details. You bot will then receive the
478
+ * shipping information and can respond with a confirmation of whether
479
+ * delivery to the specified address is possible. Check out
480
+ * https://core.telegram.org/bots/api#shippingquery to read more about
481
+ * shipping queries.
480
482
  *
481
483
  * ```ts
482
484
  * bot.shippingQuery('invoice_payload', async ctx => {
package/out/context.d.ts CHANGED
@@ -1,9 +1,10 @@
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 InputPollOption, type LabeledPrice, type Message, type MessageEntity, type PassportElementError, type ReactionType, type ReactionTypeEmoji, 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 InputPaidMedia, type InputPollOption, 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
- export type StringWithSuggestions<S extends string> = (string & Record<never, never>) | S;
6
+ /** permits `string` but gives hints */
7
+ export type StringWithCommandSuggestions = (string & Record<never, never>) | "start" | "help" | "settings" | "privacy";
7
8
  type Other<M extends Methods<RawApi>, X extends string = never> = OtherApi<RawApi, M, X>;
8
9
  type SnakeToCamelCase<S extends string> = S extends `${infer L}_${infer R}` ? `${L}${Capitalize<SnakeToCamelCase<R>>}` : S;
9
10
  type AliasProps<U> = {
@@ -32,11 +33,11 @@ interface StaticHas {
32
33
  *
33
34
  * @param command The command to match
34
35
  */
35
- command<S extends string>(command: MaybeArray<StringWithSuggestions<S | "start" | "help" | "settings">>): <C extends Context>(ctx: C) => ctx is CommandContext<C>;
36
+ command(command: MaybeArray<StringWithCommandSuggestions>): <C extends Context>(ctx: C) => ctx is CommandContext<C>;
36
37
  /**
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`.
38
+ * Generates a predicate function that can test context objects for
39
+ * containing a message reaction update. This uses the same logic as
40
+ * `bot.reaction`.
40
41
  *
41
42
  * @param reaction The reaction to test against
42
43
  */
@@ -93,8 +94,8 @@ interface StaticHas {
93
94
  preCheckoutQuery(trigger: MaybeArray<string | RegExp>): <C extends Context>(ctx: C) => ctx is PreCheckoutQueryContext<C>;
94
95
  /**
95
96
  * Generates a predicate function that can test context objects for
96
- * containing the given shipping query, or for the shipping query to
97
- * match the given regular expression. This uses the same logic as
97
+ * containing the given shipping query, or for the shipping query to match
98
+ * the given regular expression. This uses the same logic as
98
99
  * `bot.shippingQuery`.
99
100
  *
100
101
  * @param trigger The string or regex to match
@@ -266,11 +267,12 @@ export declare class Context implements RenamedUpdate {
266
267
  */
267
268
  get businessConnectionId(): string | undefined;
268
269
  /**
269
- * Get entities and their text. Extracts the text from `ctx.msg.text` or `ctx.msg.caption`.
270
- * Returns an empty array if one of `ctx.msg`, `ctx.msg.text`
271
- * or `ctx.msg.entities` is undefined.
270
+ * Get entities and their text. Extracts the text from `ctx.msg.text` or
271
+ * `ctx.msg.caption`. Returns an empty array if one of `ctx.msg`,
272
+ * `ctx.msg.text` or `ctx.msg.entities` is undefined.
272
273
  *
273
- * You can filter specific entity types by passing the `types` parameter. Example:
274
+ * You can filter specific entity types by passing the `types` parameter.
275
+ * Example:
274
276
  *
275
277
  * ```ts
276
278
  * ctx.entities() // Returns all entity types
@@ -382,7 +384,7 @@ export declare class Context implements RenamedUpdate {
382
384
  *
383
385
  * @param command The command to match
384
386
  */
385
- hasCommand<S extends string>(command: MaybeArray<StringWithSuggestions<S | "start" | "help" | "settings">>): this is CommandContextCore;
387
+ hasCommand(command: MaybeArray<StringWithCommandSuggestions>): this is CommandContextCore;
386
388
  hasReaction(reaction: MaybeArray<ReactionTypeEmoji["emoji"] | ReactionType>): this is ReactionContextCore;
387
389
  /**
388
390
  * Returns `true` if this context object belongs to a chat with the given
@@ -418,17 +420,19 @@ export declare class Context implements RenamedUpdate {
418
420
  */
419
421
  hasInlineQuery(trigger: MaybeArray<string | RegExp>): this is InlineQueryContextCore;
420
422
  /**
421
- * Returns `true` if this context object contains the chosen inline result, or
422
- * if the contained chosen inline result matches the given regular expression. It
423
- * returns `false` otherwise. This uses the same logic as `bot.chosenInlineResult`.
423
+ * Returns `true` if this context object contains the chosen inline result,
424
+ * or if the contained chosen inline result matches the given regular
425
+ * expression. It returns `false` otherwise. This uses the same logic as
426
+ * `bot.chosenInlineResult`.
424
427
  *
425
428
  * @param trigger The string or regex to match
426
429
  */
427
430
  hasChosenInlineResult(trigger: MaybeArray<string | RegExp>): this is ChosenInlineResultContextCore;
428
431
  /**
429
- * Returns `true` if this context object contains the given pre-checkout query,
430
- * or if the contained pre-checkout query matches the given regular expression.
431
- * It returns `false` otherwise. This uses the same logic as `bot.preCheckoutQuery`.
432
+ * Returns `true` if this context object contains the given pre-checkout
433
+ * query, or if the contained pre-checkout query matches the given regular
434
+ * expression. It returns `false` otherwise. This uses the same logic as
435
+ * `bot.preCheckoutQuery`.
432
436
  *
433
437
  * @param trigger The string or regex to match
434
438
  */
@@ -436,7 +440,8 @@ export declare class Context implements RenamedUpdate {
436
440
  /**
437
441
  * Returns `true` if this context object contains the given shipping query,
438
442
  * or if the contained shipping query matches the given regular expression.
439
- * It returns `false` otherwise. This uses the same logic as `bot.shippingQuery`.
443
+ * It returns `false` otherwise. This uses the same logic as
444
+ * `bot.shippingQuery`.
440
445
  *
441
446
  * @param trigger The string or regex to match
442
447
  */
@@ -473,7 +478,7 @@ export declare class Context implements RenamedUpdate {
473
478
  */
474
479
  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[]>;
475
480
  /**
476
- * 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.
481
+ * Context-aware alias for `api.copyMessage`. Use this method to copy messages of any kind. Service messages, paid media 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.
477
482
  *
478
483
  * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
479
484
  * @param other Optional remaining parameters, confer the official reference below
@@ -483,7 +488,7 @@ export declare class Context implements RenamedUpdate {
483
488
  */
484
489
  copyMessage(chat_id: number | string, other?: Other<"copyMessage", "chat_id" | "from_chat_id" | "message_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").MessageId>;
485
490
  /**
486
- * 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.
491
+ * 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, paid media 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.
487
492
  *
488
493
  * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
489
494
  * @param message_ids A list of 1-100 identifiers of messages in the current chat to copy. The identifiers must be specified in a strictly increasing order.
@@ -611,6 +616,17 @@ export declare class Context implements RenamedUpdate {
611
616
  stopMessageLiveLocation(other?: Other<"stopMessageLiveLocation", "chat_id" | "message_id" | "inline_message_id">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CommonMessage & {
612
617
  location: import("@grammyjs/types/message.js").Location;
613
618
  })>;
619
+ /**
620
+ * Context-aware alias for `api.sendPaidMedia`. Use this method to send paid media to channel chats. On success, the sent Message is returned.
621
+ *
622
+ * @param star_count The number of Telegram Stars that must be paid to buy access to the media
623
+ * @param media An array describing the media to be sent; up to 10 items
624
+ * @param other Optional remaining parameters, confer the official reference below
625
+ * @param signal Optional `AbortSignal` to cancel the request
626
+ *
627
+ * **Official reference:** https://core.telegram.org/bots/api#sendpaidmedia
628
+ */
629
+ sendPaidMedia(star_count: number, media: InputPaidMedia[], other?: Other<"sendPaidMedia", "chat_id" | "star_count" | "media">, signal?: AbortSignal): Promise<Message.PaidMediaMessage>;
614
630
  /**
615
631
  * Context-aware alias for `api.sendVenue`. Use this method to send information about a venue. On success, the sent Message is returned.
616
632
  *
package/out/context.js CHANGED
@@ -593,9 +593,10 @@ class Context {
593
593
  return Context.has.inlineQuery(trigger)(this);
594
594
  }
595
595
  /**
596
- * Returns `true` if this context object contains the chosen inline result, or
597
- * if the contained chosen inline result matches the given regular expression. It
598
- * returns `false` otherwise. This uses the same logic as `bot.chosenInlineResult`.
596
+ * Returns `true` if this context object contains the chosen inline result,
597
+ * or if the contained chosen inline result matches the given regular
598
+ * expression. It returns `false` otherwise. This uses the same logic as
599
+ * `bot.chosenInlineResult`.
599
600
  *
600
601
  * @param trigger The string or regex to match
601
602
  */
@@ -603,9 +604,10 @@ class Context {
603
604
  return Context.has.chosenInlineResult(trigger)(this);
604
605
  }
605
606
  /**
606
- * Returns `true` if this context object contains the given pre-checkout query,
607
- * or if the contained pre-checkout query matches the given regular expression.
608
- * It returns `false` otherwise. This uses the same logic as `bot.preCheckoutQuery`.
607
+ * Returns `true` if this context object contains the given pre-checkout
608
+ * query, or if the contained pre-checkout query matches the given regular
609
+ * expression. It returns `false` otherwise. This uses the same logic as
610
+ * `bot.preCheckoutQuery`.
609
611
  *
610
612
  * @param trigger The string or regex to match
611
613
  */
@@ -615,7 +617,8 @@ class Context {
615
617
  /**
616
618
  * Returns `true` if this context object contains the given shipping query,
617
619
  * or if the contained shipping query matches the given regular expression.
618
- * It returns `false` otherwise. This uses the same logic as `bot.shippingQuery`.
620
+ * It returns `false` otherwise. This uses the same logic as
621
+ * `bot.shippingQuery`.
619
622
  *
620
623
  * @param trigger The string or regex to match
621
624
  */
@@ -661,7 +664,7 @@ class Context {
661
664
  return this.api.forwardMessages(chat_id, orThrow(this.chatId, "forwardMessages"), message_ids, other, signal);
662
665
  }
663
666
  /**
664
- * 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.
667
+ * Context-aware alias for `api.copyMessage`. Use this method to copy messages of any kind. Service messages, paid media 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.
665
668
  *
666
669
  * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
667
670
  * @param other Optional remaining parameters, confer the official reference below
@@ -673,7 +676,7 @@ class Context {
673
676
  return this.api.copyMessage(chat_id, orThrow(this.chatId, "copyMessage"), orThrow(this.msgId, "copyMessage"), other, signal);
674
677
  }
675
678
  /**
676
- * 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.
679
+ * 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, paid media 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.
677
680
  *
678
681
  * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
679
682
  * @param message_ids A list of 1-100 identifiers of messages in the current chat to copy. The identifiers must be specified in a strictly increasing order.
@@ -827,6 +830,19 @@ class Context {
827
830
  ? this.api.stopMessageLiveLocationInline(inlineId, other)
828
831
  : this.api.stopMessageLiveLocation(orThrow(this.chatId, "stopMessageLiveLocation"), orThrow(this.msgId, "stopMessageLiveLocation"), other, signal);
829
832
  }
833
+ /**
834
+ * Context-aware alias for `api.sendPaidMedia`. Use this method to send paid media to channel chats. On success, the sent Message is returned.
835
+ *
836
+ * @param star_count The number of Telegram Stars that must be paid to buy access to the media
837
+ * @param media An array describing the media to be sent; up to 10 items
838
+ * @param other Optional remaining parameters, confer the official reference below
839
+ * @param signal Optional `AbortSignal` to cancel the request
840
+ *
841
+ * **Official reference:** https://core.telegram.org/bots/api#sendpaidmedia
842
+ */
843
+ sendPaidMedia(star_count, media, other, signal) {
844
+ return this.api.sendPaidMedia(orThrow(this.chatId, "sendPaidMedia"), star_count, media, other, signal);
845
+ }
830
846
  /**
831
847
  * Context-aware alias for `api.sendVenue`. Use this method to send information about a venue. On success, the sent Message is returned.
832
848
  *
package/out/core/api.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type BotCommand, type ChatPermissions, type InlineQueryResult, type InputFile, type InputMedia, type InputMediaAudio, type InputMediaDocument, type InputMediaPhoto, type InputMediaVideo, type InputPollOption, type InputSticker, type LabeledPrice, type MaskPosition, type PassportElementError, type ReactionType } from "../types.js";
1
+ import { type BotCommand, type ChatPermissions, type InlineQueryResult, type InputFile, type InputMedia, type InputMediaAudio, type InputMediaDocument, type InputMediaPhoto, type InputMediaVideo, type InputPaidMedia, type InputPollOption, type InputSticker, type LabeledPrice, type MaskPosition, type PassportElementError, type ReactionType } from "../types.js";
2
2
  import { type ApiClientOptions, type Methods, type Payload, type RawApi, type Transformer, type TransformerConsumer, type WebhookReplyEnvelope } from "./client.js";
3
3
  /**
4
4
  * Helper type to derive remaining properties of a given API method call M,
@@ -179,7 +179,7 @@ export declare class Api<R extends RawApi = RawApi> {
179
179
  */
180
180
  forwardMessages(chat_id: number | string, from_chat_id: number | string, message_ids: number[], other?: Other<R, "forwardMessages", "chat_id" | "from_chat_id" | "message_ids">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").MessageId[]>;
181
181
  /**
182
- * 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.
182
+ * Use this method to copy messages of any kind. Service messages, paid media 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.
183
183
  *
184
184
  * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
185
185
  * @param from_chat_id Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
@@ -191,7 +191,7 @@ export declare class Api<R extends RawApi = RawApi> {
191
191
  */
192
192
  copyMessage(chat_id: number | string, from_chat_id: number | string, message_id: number, other?: Other<R, "copyMessage", "chat_id" | "from_chat_id" | "message_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").MessageId>;
193
193
  /**
194
- * 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.
194
+ * 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, paid media 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.
195
195
  *
196
196
  * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
197
197
  * @param from_chat_id Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
@@ -359,6 +359,18 @@ export declare class Api<R extends RawApi = RawApi> {
359
359
  stopMessageLiveLocationInline(inline_message_id: string, other?: Other<R, "stopMessageLiveLocation", "chat_id" | "message_id" | "inline_message_id">, signal?: AbortSignal): Promise<true | (import("@grammyjs/types/update.js").Update.Edited & import("@grammyjs/types/message.js").Message.CommonMessage & {
360
360
  location: import("@grammyjs/types/message.js").Location;
361
361
  })>;
362
+ /**
363
+ * Use this method to send paid media to channel chats. On success, the sent Message is returned.
364
+ *
365
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
366
+ * @param star_count The number of Telegram Stars that must be paid to buy access to the media
367
+ * @param media An array describing the media to be sent; up to 10 items
368
+ * @param other Optional remaining parameters, confer the official reference below
369
+ * @param signal Optional `AbortSignal` to cancel the request
370
+ *
371
+ * **Official reference:** https://core.telegram.org/bots/api#sendpaidmedia
372
+ */
373
+ sendPaidMedia(chat_id: number | string, star_count: number, media: InputPaidMedia[], other?: Other<R, "sendPaidMedia", "chat_id" | "star_count" | "media">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.PaidMediaMessage>;
362
374
  /**
363
375
  * Use this method to send information about a venue. On success, the sent Message is returned.
364
376
  *
package/out/core/api.js CHANGED
@@ -173,7 +173,7 @@ class Api {
173
173
  }, signal);
174
174
  }
175
175
  /**
176
- * 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.
176
+ * Use this method to copy messages of any kind. Service messages, paid media 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.
177
177
  *
178
178
  * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
179
179
  * @param from_chat_id Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
@@ -187,7 +187,7 @@ class Api {
187
187
  return this.raw.copyMessage({ chat_id, from_chat_id, message_id, ...other }, signal);
188
188
  }
189
189
  /**
190
- * 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.
190
+ * 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, paid media 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.
191
191
  *
192
192
  * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
193
193
  * @param from_chat_id Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
@@ -380,6 +380,20 @@ class Api {
380
380
  stopMessageLiveLocationInline(inline_message_id, other, signal) {
381
381
  return this.raw.stopMessageLiveLocation({ inline_message_id, ...other }, signal);
382
382
  }
383
+ /**
384
+ * Use this method to send paid media to channel chats. On success, the sent Message is returned.
385
+ *
386
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
387
+ * @param star_count The number of Telegram Stars that must be paid to buy access to the media
388
+ * @param media An array describing the media to be sent; up to 10 items
389
+ * @param other Optional remaining parameters, confer the official reference below
390
+ * @param signal Optional `AbortSignal` to cancel the request
391
+ *
392
+ * **Official reference:** https://core.telegram.org/bots/api#sendpaidmedia
393
+ */
394
+ sendPaidMedia(chat_id, star_count, media, other, signal) {
395
+ return this.raw.sendPaidMedia({ chat_id, star_count, media, ...other }, signal);
396
+ }
383
397
  /**
384
398
  * Use this method to send information about a venue. On success, the sent Message is returned.
385
399
  *
package/out/filter.d.ts CHANGED
@@ -91,6 +91,7 @@ declare const UPDATE_KEYS: {
91
91
  readonly poll: {};
92
92
  readonly venue: {};
93
93
  readonly location: {};
94
+ readonly paid_media: {};
94
95
  readonly entities: {
95
96
  readonly mention: {};
96
97
  readonly hashtag: {};
@@ -213,6 +214,7 @@ declare const UPDATE_KEYS: {
213
214
  readonly poll: {};
214
215
  readonly venue: {};
215
216
  readonly location: {};
217
+ readonly paid_media: {};
216
218
  readonly entities: {
217
219
  readonly mention: {};
218
220
  readonly hashtag: {};
@@ -303,6 +305,7 @@ declare const UPDATE_KEYS: {
303
305
  readonly poll: {};
304
306
  readonly venue: {};
305
307
  readonly location: {};
308
+ readonly paid_media: {};
306
309
  readonly entities: {
307
310
  readonly mention: {};
308
311
  readonly hashtag: {};
@@ -393,6 +396,7 @@ declare const UPDATE_KEYS: {
393
396
  readonly poll: {};
394
397
  readonly venue: {};
395
398
  readonly location: {};
399
+ readonly paid_media: {};
396
400
  readonly entities: {
397
401
  readonly mention: {};
398
402
  readonly hashtag: {};
@@ -519,6 +523,7 @@ declare const UPDATE_KEYS: {
519
523
  readonly poll: {};
520
524
  readonly venue: {};
521
525
  readonly location: {};
526
+ readonly paid_media: {};
522
527
  readonly entities: {
523
528
  readonly mention: {};
524
529
  readonly hashtag: {};
@@ -641,6 +646,7 @@ declare const UPDATE_KEYS: {
641
646
  readonly poll: {};
642
647
  readonly venue: {};
643
648
  readonly location: {};
649
+ readonly paid_media: {};
644
650
  readonly entities: {
645
651
  readonly mention: {};
646
652
  readonly hashtag: {};
package/out/filter.js CHANGED
@@ -265,6 +265,7 @@ const COMMON_MESSAGE_KEYS = {
265
265
  poll: {},
266
266
  venue: {},
267
267
  location: {},
268
+ paid_media: {},
268
269
  entities: ENTITY_KEYS,
269
270
  caption_entities: ENTITY_KEYS,
270
271
  caption: {},
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { type ApiMethods as ApiMethodsF, type InputMedia as InputMediaF, type InputMediaAnimation as InputMediaAnimationF, type InputMediaAudio as InputMediaAudioF, type InputMediaDocument as InputMediaDocumentF, type InputMediaPhoto as InputMediaPhotoF, type InputMediaVideo as InputMediaVideoF, type InputSticker as InputStickerF, type Opts as OptsF } from "@grammyjs/types";
2
+ import { type ApiMethods as ApiMethodsF, type InputMedia as InputMediaF, type InputMediaAnimation as InputMediaAnimationF, type InputMediaAudio as InputMediaAudioF, type InputMediaDocument as InputMediaDocumentF, type InputMediaPhoto as InputMediaPhotoF, type InputMediaVideo as InputMediaVideoF, type InputPaidMedia as InputPaidMediaF, type InputPaidMediaPhoto as InputPaidMediaPhotoF, type InputPaidMediaVideo as InputPaidMediaVideoF, type InputSticker as InputStickerF, type Opts as OptsF } from "@grammyjs/types";
3
3
  import { type ReadStream } from "fs";
4
4
  export * from "@grammyjs/types";
5
5
  /** A value, or a potentially async function supplying that value */
@@ -69,3 +69,11 @@ export type InputMediaAnimation = InputMediaAnimationF<InputFile>;
69
69
  export type InputMediaAudio = InputMediaAudioF<InputFile>;
70
70
  /** Represents a general file to be sent. */
71
71
  export type InputMediaDocument = InputMediaDocumentF<InputFile>;
72
+ /** This object describes the paid media to be sent. Currently, it can be one of
73
+ - InputPaidMediaPhoto
74
+ - InputPaidMediaVideo */
75
+ export type InputPaidMedia = InputPaidMediaF<InputFile>;
76
+ /** The paid media to send is a photo. */
77
+ export type InputPaidMediaPhoto = InputPaidMediaPhotoF<InputFile>;
78
+ /** The paid media to send is a video. */
79
+ export type InputPaidMediaVideo = InputPaidMediaVideoF<InputFile>;
package/out/web.mjs CHANGED
@@ -210,6 +210,7 @@ const COMMON_MESSAGE_KEYS = {
210
210
  poll: {},
211
211
  venue: {},
212
212
  location: {},
213
+ paid_media: {},
213
214
  entities: ENTITY_KEYS,
214
215
  caption_entities: ENTITY_KEYS,
215
216
  caption: {},
@@ -781,6 +782,9 @@ class Context {
781
782
  const inlineId = this.inlineMessageId;
782
783
  return inlineId !== undefined ? this.api.stopMessageLiveLocationInline(inlineId, other) : this.api.stopMessageLiveLocation(orThrow(this.chatId, "stopMessageLiveLocation"), orThrow(this.msgId, "stopMessageLiveLocation"), other, signal);
783
784
  }
785
+ sendPaidMedia(star_count, media, other, signal) {
786
+ return this.api.sendPaidMedia(orThrow(this.chatId, "sendPaidMedia"), star_count, media, other, signal);
787
+ }
784
788
  replyWithVenue(latitude, longitude, title, address, other, signal) {
785
789
  return this.api.sendVenue(orThrow(this.chatId, "sendVenue"), latitude, longitude, title, address, {
786
790
  business_connection_id: this.businessConnectionId,
@@ -2563,6 +2567,14 @@ class Api {
2563
2567
  ...other
2564
2568
  }, signal);
2565
2569
  }
2570
+ sendPaidMedia(chat_id, star_count, media, other, signal) {
2571
+ return this.raw.sendPaidMedia({
2572
+ chat_id,
2573
+ star_count,
2574
+ media,
2575
+ ...other
2576
+ }, signal);
2577
+ }
2566
2578
  sendVenue(chat_id, latitude, longitude, title, address, other, signal) {
2567
2579
  return this.raw.sendVenue({
2568
2580
  chat_id,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grammy",
3
3
  "description": "The Telegram Bot Framework.",
4
- "version": "1.25.2",
4
+ "version": "1.26.1",
5
5
  "author": "KnorpelSenf",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -17,7 +17,7 @@
17
17
  "backport": "deno2node tsconfig.json"
18
18
  },
19
19
  "dependencies": {
20
- "@grammyjs/types": "3.9.0",
20
+ "@grammyjs/types": "3.10.0",
21
21
  "abort-controller": "^3.0.0",
22
22
  "debug": "^4.3.4",
23
23
  "node-fetch": "^2.7.0"