grammy 1.25.2 → 1.26.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 +1 -1
- package/out/composer.d.ts +24 -22
- package/out/composer.js +20 -18
- package/out/context.d.ts +34 -19
- package/out/context.js +25 -9
- package/out/core/api.d.ts +15 -3
- package/out/core/api.js +16 -2
- package/out/filter.d.ts +6 -0
- package/out/filter.js +1 -0
- package/out/types.node.d.ts +9 -1
- package/out/web.mjs +12 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- deno-fmt-ignore-start -->
|
|
12
12
|
|
|
13
|
-
[](https://core.telegram.org/bots/api)
|
|
14
14
|
[](https://deno.land/x/grammy)
|
|
15
15
|
[](https://www.npmjs.org/package/grammy)
|
|
16
16
|
[](#contributors-)
|
package/out/composer.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
417
|
-
* https://core.telegram.org/bots/api#choseninlineresult to read more
|
|
418
|
-
*
|
|
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
|
|
433
|
-
* query to your bot whenever a user has confirmed their
|
|
434
|
-
* details. You bot will then receive all information
|
|
435
|
-
* has to respond within 10 seconds with a confirmation
|
|
436
|
-
* is alright (goods are available, etc.) and the bot
|
|
437
|
-
* with the order. Check out
|
|
438
|
-
* to read more about
|
|
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
|
|
453
|
-
* a shipping address and the parameter _is_flexible_ was
|
|
454
|
-
* will send a shipping query to your bot whenever a
|
|
455
|
-
* shipping details. You bot will then receive the
|
|
456
|
-
* can respond with a confirmation of whether
|
|
457
|
-
* is possible. Check out
|
|
458
|
-
* read more about
|
|
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
|
|
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
|
|
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
|
-
*
|
|
434
|
-
* https://core.telegram.org/bots/api#choseninlineresult to read more
|
|
435
|
-
*
|
|
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
|
|
452
|
-
* query to your bot whenever a user has confirmed their
|
|
453
|
-
* details. You bot will then receive all information
|
|
454
|
-
* has to respond within 10 seconds with a confirmation
|
|
455
|
-
* is alright (goods are available, etc.) and the bot
|
|
456
|
-
* with the order. Check out
|
|
457
|
-
* to read more about
|
|
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
|
|
474
|
-
* a shipping address and the parameter _is_flexible_ was
|
|
475
|
-
* will send a shipping query to your bot whenever a
|
|
476
|
-
* shipping details. You bot will then receive the
|
|
477
|
-
* can respond with a confirmation of whether
|
|
478
|
-
* is possible. Check out
|
|
479
|
-
* read more about
|
|
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,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 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
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>;
|
|
@@ -34,9 +34,9 @@ interface StaticHas {
|
|
|
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
36
|
/**
|
|
37
|
-
* Generates a predicate function that can test context
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* Generates a predicate function that can test context objects for
|
|
38
|
+
* containing a message reaction update. This uses the same logic as
|
|
39
|
+
* `bot.reaction`.
|
|
40
40
|
*
|
|
41
41
|
* @param reaction The reaction to test against
|
|
42
42
|
*/
|
|
@@ -93,8 +93,8 @@ interface StaticHas {
|
|
|
93
93
|
preCheckoutQuery(trigger: MaybeArray<string | RegExp>): <C extends Context>(ctx: C) => ctx is PreCheckoutQueryContext<C>;
|
|
94
94
|
/**
|
|
95
95
|
* Generates a predicate function that can test context objects for
|
|
96
|
-
* containing the given shipping query, or for the shipping query to
|
|
97
|
-
*
|
|
96
|
+
* containing the given shipping query, or for the shipping query to match
|
|
97
|
+
* the given regular expression. This uses the same logic as
|
|
98
98
|
* `bot.shippingQuery`.
|
|
99
99
|
*
|
|
100
100
|
* @param trigger The string or regex to match
|
|
@@ -266,11 +266,12 @@ export declare class Context implements RenamedUpdate {
|
|
|
266
266
|
*/
|
|
267
267
|
get businessConnectionId(): string | undefined;
|
|
268
268
|
/**
|
|
269
|
-
* Get entities and their text. Extracts the text from `ctx.msg.text` or
|
|
270
|
-
* Returns an empty array if one of `ctx.msg`,
|
|
271
|
-
* or `ctx.msg.entities` is undefined.
|
|
269
|
+
* Get entities and their text. Extracts the text from `ctx.msg.text` or
|
|
270
|
+
* `ctx.msg.caption`. Returns an empty array if one of `ctx.msg`,
|
|
271
|
+
* `ctx.msg.text` or `ctx.msg.entities` is undefined.
|
|
272
272
|
*
|
|
273
|
-
* You can filter specific entity types by passing the `types` parameter.
|
|
273
|
+
* You can filter specific entity types by passing the `types` parameter.
|
|
274
|
+
* Example:
|
|
274
275
|
*
|
|
275
276
|
* ```ts
|
|
276
277
|
* ctx.entities() // Returns all entity types
|
|
@@ -418,17 +419,19 @@ export declare class Context implements RenamedUpdate {
|
|
|
418
419
|
*/
|
|
419
420
|
hasInlineQuery(trigger: MaybeArray<string | RegExp>): this is InlineQueryContextCore;
|
|
420
421
|
/**
|
|
421
|
-
* Returns `true` if this context object contains the chosen inline result,
|
|
422
|
-
* if the contained chosen inline result matches the given regular
|
|
423
|
-
* returns `false` otherwise. This uses the same logic as
|
|
422
|
+
* Returns `true` if this context object contains the chosen inline result,
|
|
423
|
+
* or if the contained chosen inline result matches the given regular
|
|
424
|
+
* expression. It returns `false` otherwise. This uses the same logic as
|
|
425
|
+
* `bot.chosenInlineResult`.
|
|
424
426
|
*
|
|
425
427
|
* @param trigger The string or regex to match
|
|
426
428
|
*/
|
|
427
429
|
hasChosenInlineResult(trigger: MaybeArray<string | RegExp>): this is ChosenInlineResultContextCore;
|
|
428
430
|
/**
|
|
429
|
-
* Returns `true` if this context object contains the given pre-checkout
|
|
430
|
-
* or if the contained pre-checkout query matches the given regular
|
|
431
|
-
* It returns `false` otherwise. This uses the same logic as
|
|
431
|
+
* Returns `true` if this context object contains the given pre-checkout
|
|
432
|
+
* query, or if the contained pre-checkout query matches the given regular
|
|
433
|
+
* expression. It returns `false` otherwise. This uses the same logic as
|
|
434
|
+
* `bot.preCheckoutQuery`.
|
|
432
435
|
*
|
|
433
436
|
* @param trigger The string or regex to match
|
|
434
437
|
*/
|
|
@@ -436,7 +439,8 @@ export declare class Context implements RenamedUpdate {
|
|
|
436
439
|
/**
|
|
437
440
|
* Returns `true` if this context object contains the given shipping query,
|
|
438
441
|
* or if the contained shipping query matches the given regular expression.
|
|
439
|
-
* It returns `false` otherwise. This uses the same logic as
|
|
442
|
+
* It returns `false` otherwise. This uses the same logic as
|
|
443
|
+
* `bot.shippingQuery`.
|
|
440
444
|
*
|
|
441
445
|
* @param trigger The string or regex to match
|
|
442
446
|
*/
|
|
@@ -473,7 +477,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
473
477
|
*/
|
|
474
478
|
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
479
|
/**
|
|
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.
|
|
480
|
+
* 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
481
|
*
|
|
478
482
|
* @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
|
|
479
483
|
* @param other Optional remaining parameters, confer the official reference below
|
|
@@ -483,7 +487,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
483
487
|
*/
|
|
484
488
|
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
489
|
/**
|
|
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.
|
|
490
|
+
* 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
491
|
*
|
|
488
492
|
* @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
|
|
489
493
|
* @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 +615,17 @@ export declare class Context implements RenamedUpdate {
|
|
|
611
615
|
stopMessageLiveLocation(other?: Other<"stopMessageLiveLocation", "chat_id" | "message_id" | "inline_message_id">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CommonMessage & {
|
|
612
616
|
location: import("@grammyjs/types/message.js").Location;
|
|
613
617
|
})>;
|
|
618
|
+
/**
|
|
619
|
+
* Context-aware alias for `api.sendPaidMedia`. Use this method to send paid media to channel chats. On success, the sent Message is returned.
|
|
620
|
+
*
|
|
621
|
+
* @param star_count The number of Telegram Stars that must be paid to buy access to the media
|
|
622
|
+
* @param media An array describing the media to be sent; up to 10 items
|
|
623
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
624
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
625
|
+
*
|
|
626
|
+
* **Official reference:** https://core.telegram.org/bots/api#sendpaidmedia
|
|
627
|
+
*/
|
|
628
|
+
sendPaidMedia(star_count: number, media: InputPaidMedia[], other?: Other<"sendPaidMedia", "chat_id" | "star_count" | "media">, signal?: AbortSignal): Promise<Message.PaidMediaMessage>;
|
|
614
629
|
/**
|
|
615
630
|
* Context-aware alias for `api.sendVenue`. Use this method to send information about a venue. On success, the sent Message is returned.
|
|
616
631
|
*
|
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,
|
|
597
|
-
* if the contained chosen inline result matches the given regular
|
|
598
|
-
* returns `false` otherwise. This uses the same logic as
|
|
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
|
|
607
|
-
* or if the contained pre-checkout query matches the given regular
|
|
608
|
-
* It returns `false` otherwise. This uses the same logic as
|
|
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
|
|
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
package/out/types.node.d.ts
CHANGED
|
@@ -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.
|
|
4
|
+
"version": "1.26.0",
|
|
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.
|
|
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"
|