grammy 1.36.3 β 1.37.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 +2 -3
- package/out/context.d.ts +25 -4
- package/out/context.js +141 -23
- package/out/convenience/frameworks.d.ts +3 -1
- package/out/convenience/frameworks.js +94 -71
- package/out/convenience/webhook.js +9 -10
- package/out/core/api.d.ts +37 -4
- package/out/core/api.js +53 -2
- package/out/core/client.js +2 -1
- package/out/filter.d.ts +26 -0
- package/out/filter.js +4 -0
- package/out/web.mjs +164 -70
- 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-)
|
|
@@ -106,7 +106,6 @@ The Russian community chat can be found [here](https://t.me/grammyjs_ru).
|
|
|
106
106
|
### [grammY news](https://t.me/grammyjs_news)
|
|
107
107
|
|
|
108
108
|
βThe channel where updates to grammY and the ecosystem are posted.
|
|
109
|
-
We are also [on Twitter](https://twitter.com/grammy_js).
|
|
110
109
|
|
|
111
110
|
### [Telegram Bot API Reference](https://core.telegram.org/bots/api)
|
|
112
111
|
|
|
@@ -148,7 +147,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
148
147
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/MegaITA"><img src="https://avatars.githubusercontent.com/u/32493080?v=4?s=100" width="100px;" alt="Alessandro Bertozzi"/><br /><sub><b>Alessandro Bertozzi</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=MegaITA" title="Documentation">π</a></td>
|
|
149
148
|
<td align="center" valign="top" width="11.11%"><a href="https://trgwii.no/"><img src="https://avatars.githubusercontent.com/u/11262022?v=4?s=100" width="100px;" alt="trgwii"/><br /><sub><b>trgwii</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=trgwii" title="Code">π»</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Atrgwii" title="Reviewed Pull Requests">π</a></td>
|
|
150
149
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/KnightNiwrem"><img src="https://avatars.githubusercontent.com/u/9781814?v=4?s=100" width="100px;" alt="KnightNiwrem"/><br /><sub><b>KnightNiwrem</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=KnightNiwrem" title="Code">π»</a> <a href="https://github.com/grammyjs/grammY/issues?q=author%3AKnightNiwrem" title="Bug reports">π</a> <a href="#plugin-KnightNiwrem" title="Plugin/utility libraries">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=KnightNiwrem" title="Documentation">π</a> <a href="#example-KnightNiwrem" title="Examples">π‘</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AKnightNiwrem" title="Reviewed Pull Requests">π</a> <a href="#mentoring-KnightNiwrem" title="Mentoring">π§βπ«</a></td>
|
|
151
|
-
<td align="center" valign="top" width="11.11%"><a href="https://mkr.pw"><img src="https://avatars.githubusercontent.com/u/19621208?v=4?s=100" width="100px;" alt="Muthu Kumar"/><br /><sub><b>Muthu Kumar</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AMKRhere" title="Reviewed Pull Requests">π</a></td>
|
|
150
|
+
<td align="center" valign="top" width="11.11%"><a href="https://mkr.pw"><img src="https://avatars.githubusercontent.com/u/19621208?v=4?s=100" width="100px;" alt="Muthu Kumar"/><br /><sub><b>Muthu Kumar</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AMKRhere" title="Reviewed Pull Requests">π</a> <a href="https://github.com/grammyjs/grammY/issues?q=author%3AMKRhere" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=MKRhere" title="Code">π»</a></td>
|
|
152
151
|
<td align="center" valign="top" width="11.11%"><a href="https://edjopato.de/"><img src="https://avatars.githubusercontent.com/u/7953011?v=4?s=100" width="100px;" alt="EdJoPaTo"/><br /><sub><b>EdJoPaTo</b></sub></a><br /><a href="#plugin-EdJoPaTo" title="Plugin/utility libraries">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=EdJoPaTo" title="Documentation">π</a> <a href="#ideas-EdJoPaTo" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AEdJoPaTo" title="Reviewed Pull Requests">π</a> <a href="https://github.com/grammyjs/grammY/issues?q=author%3AEdJoPaTo" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=EdJoPaTo" title="Code">π»</a></td>
|
|
153
152
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/Amir-Zouerami"><img src="https://avatars.githubusercontent.com/u/53701884?v=4?s=100" width="100px;" alt="Amir Zouerami"/><br /><sub><b>Amir Zouerami</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Amir-Zouerami" title="Documentation">π</a> <a href="#plugin-Amir-Zouerami" title="Plugin/utility libraries">π</a> <a href="#example-Amir-Zouerami" title="Examples">π‘</a></td>
|
|
154
153
|
</tr>
|
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 AcceptedGiftTypes, type Chat, type ChatPermissions, type InlineQueryResult, type InputFile, type InputMedia, type InputMediaAudio, type InputMediaDocument, type InputMediaPhoto, type InputMediaVideo, type InputPaidMedia, type InputPollOption, type InputProfilePhoto, type InputStoryContent, type LabeledPrice, type Message, type MessageEntity, type PassportElementError, type ReactionType, type ReactionTypeEmoji, type Update, type User, type UserFromGetMe } from "./types.js";
|
|
4
|
+
import { type AcceptedGiftTypes, type Chat, type ChatPermissions, type InlineQueryResult, type InputChecklist, type InputFile, type InputMedia, type InputMediaAudio, type InputMediaDocument, type InputMediaPhoto, type InputMediaVideo, type InputPaidMedia, type InputPollOption, type InputProfilePhoto, type InputStoryContent, 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
|
/** permits `string` but gives hints */
|
|
7
7
|
export type StringWithCommandSuggestions = (string & Record<never, never>) | "start" | "help" | "settings" | "privacy" | "developer_info";
|
|
@@ -513,7 +513,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
513
513
|
*
|
|
514
514
|
* **Official reference:** https://core.telegram.org/bots/api#copymessages
|
|
515
515
|
*/
|
|
516
|
-
copyMessages(chat_id: number | string, message_ids: number[], other?: Other<"copyMessages", "chat_id" | "from_chat_id" | "
|
|
516
|
+
copyMessages(chat_id: number | string, message_ids: number[], other?: Other<"copyMessages", "chat_id" | "from_chat_id" | "message_ids">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").MessageId[]>;
|
|
517
517
|
/**
|
|
518
518
|
* Context-aware alias for `api.sendPhoto`. Use this method to send photos. On success, the sent Message is returned.
|
|
519
519
|
*
|
|
@@ -671,13 +671,33 @@ export declare class Context implements RenamedUpdate {
|
|
|
671
671
|
* Context-aware alias for `api.sendPoll`. Use this method to send a native poll. On success, the sent Message is returned.
|
|
672
672
|
*
|
|
673
673
|
* @param question Poll question, 1-300 characters
|
|
674
|
-
* @param options A list of answer options, 2-
|
|
674
|
+
* @param options A list of answer options, 2-12 strings 1-100 characters each
|
|
675
675
|
* @param other Optional remaining parameters, confer the official reference below
|
|
676
676
|
* @param signal Optional `AbortSignal` to cancel the request
|
|
677
677
|
*
|
|
678
678
|
* **Official reference:** https://core.telegram.org/bots/api#sendpoll
|
|
679
679
|
*/
|
|
680
|
-
replyWithPoll(question: string, options: InputPollOption[], other?: Other<"sendPoll", "chat_id" | "question" | "options">, signal?: AbortSignal): Promise<Message.PollMessage>;
|
|
680
|
+
replyWithPoll(question: string, options: (string | InputPollOption)[], other?: Other<"sendPoll", "chat_id" | "question" | "options">, signal?: AbortSignal): Promise<Message.PollMessage>;
|
|
681
|
+
/**
|
|
682
|
+
* Context-aware alias for `api.sendChecklist`. Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned.
|
|
683
|
+
*
|
|
684
|
+
* @param checklist An object for the checklist to send
|
|
685
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
686
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
687
|
+
*
|
|
688
|
+
* **Official reference:** https://core.telegram.org/bots/api#sendchecklist
|
|
689
|
+
*/
|
|
690
|
+
replyWithChecklist(checklist: InputChecklist, other?: Other<"sendChecklist", "business_connection_id" | "chat_id" | "checklist">, signal?: AbortSignal): Promise<Message.ChecklistMessage>;
|
|
691
|
+
/**
|
|
692
|
+
* Context-aware alias for `api.editMessageChecklist`. Use this method to edit a checklist on behalf of a connected business account. On success, the edited Message is returned.
|
|
693
|
+
*
|
|
694
|
+
* @param checklist An object for the new checklist
|
|
695
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
696
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
697
|
+
*
|
|
698
|
+
* **Official reference:** https://core.telegram.org/bots/api#editmessagechecklist
|
|
699
|
+
*/
|
|
700
|
+
editMessageChecklist(checklist: InputChecklist, other?: Other<"editMessageChecklist", "business_connection_id" | "chat_id" | "messaage_id" | "checklist">, signal?: AbortSignal): Promise<Message.ChecklistMessage>;
|
|
681
701
|
/**
|
|
682
702
|
* Context-aware alias for `api.sendDice`. Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.
|
|
683
703
|
*
|
|
@@ -1003,6 +1023,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
1003
1023
|
* Context-aware alias for `api.unpinChatMessage`. Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
|
|
1004
1024
|
*
|
|
1005
1025
|
* @param message_id Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned.
|
|
1026
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1006
1027
|
* @param signal Optional `AbortSignal` to cancel the request
|
|
1007
1028
|
*
|
|
1008
1029
|
* **Official reference:** https://core.telegram.org/bots/api#unpinchatmessage
|
package/out/context.js
CHANGED
|
@@ -666,7 +666,12 @@ class Context {
|
|
|
666
666
|
* **Official reference:** https://core.telegram.org/bots/api#sendmessage
|
|
667
667
|
*/
|
|
668
668
|
reply(text, other, signal) {
|
|
669
|
-
|
|
669
|
+
var _a;
|
|
670
|
+
return this.api.sendMessage(orThrow(this.chatId, "sendMessage"), text, {
|
|
671
|
+
business_connection_id: this.businessConnectionId,
|
|
672
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
673
|
+
...other,
|
|
674
|
+
}, signal);
|
|
670
675
|
}
|
|
671
676
|
/**
|
|
672
677
|
* 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.
|
|
@@ -678,7 +683,8 @@ class Context {
|
|
|
678
683
|
* **Official reference:** https://core.telegram.org/bots/api#forwardmessage
|
|
679
684
|
*/
|
|
680
685
|
forwardMessage(chat_id, other, signal) {
|
|
681
|
-
|
|
686
|
+
var _a;
|
|
687
|
+
return this.api.forwardMessage(chat_id, orThrow(this.chatId, "forwardMessage"), orThrow(this.msgId, "forwardMessage"), { message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id, ...other }, signal);
|
|
682
688
|
}
|
|
683
689
|
/**
|
|
684
690
|
* 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.
|
|
@@ -691,7 +697,8 @@ class Context {
|
|
|
691
697
|
* **Official reference:** https://core.telegram.org/bots/api#forwardmessages
|
|
692
698
|
*/
|
|
693
699
|
forwardMessages(chat_id, message_ids, other, signal) {
|
|
694
|
-
|
|
700
|
+
var _a;
|
|
701
|
+
return this.api.forwardMessages(chat_id, orThrow(this.chatId, "forwardMessages"), message_ids, { message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id, ...other }, signal);
|
|
695
702
|
}
|
|
696
703
|
/**
|
|
697
704
|
* 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.
|
|
@@ -703,7 +710,8 @@ class Context {
|
|
|
703
710
|
* **Official reference:** https://core.telegram.org/bots/api#copymessage
|
|
704
711
|
*/
|
|
705
712
|
copyMessage(chat_id, other, signal) {
|
|
706
|
-
|
|
713
|
+
var _a;
|
|
714
|
+
return this.api.copyMessage(chat_id, orThrow(this.chatId, "copyMessage"), orThrow(this.msgId, "copyMessage"), { message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id, ...other }, signal);
|
|
707
715
|
}
|
|
708
716
|
/**
|
|
709
717
|
* 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.
|
|
@@ -716,7 +724,8 @@ class Context {
|
|
|
716
724
|
* **Official reference:** https://core.telegram.org/bots/api#copymessages
|
|
717
725
|
*/
|
|
718
726
|
copyMessages(chat_id, message_ids, other, signal) {
|
|
719
|
-
|
|
727
|
+
var _a;
|
|
728
|
+
return this.api.copyMessages(chat_id, orThrow(this.chatId, "copyMessages"), message_ids, { message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id, ...other }, signal);
|
|
720
729
|
}
|
|
721
730
|
/**
|
|
722
731
|
* Context-aware alias for `api.sendPhoto`. Use this method to send photos. On success, the sent Message is returned.
|
|
@@ -728,7 +737,12 @@ class Context {
|
|
|
728
737
|
* **Official reference:** https://core.telegram.org/bots/api#sendphoto
|
|
729
738
|
*/
|
|
730
739
|
replyWithPhoto(photo, other, signal) {
|
|
731
|
-
|
|
740
|
+
var _a;
|
|
741
|
+
return this.api.sendPhoto(orThrow(this.chatId, "sendPhoto"), photo, {
|
|
742
|
+
business_connection_id: this.businessConnectionId,
|
|
743
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
744
|
+
...other,
|
|
745
|
+
}, signal);
|
|
732
746
|
}
|
|
733
747
|
/**
|
|
734
748
|
* Context-aware alias for `api.sendAudio`. Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
|
|
@@ -742,7 +756,12 @@ class Context {
|
|
|
742
756
|
* **Official reference:** https://core.telegram.org/bots/api#sendaudio
|
|
743
757
|
*/
|
|
744
758
|
replyWithAudio(audio, other, signal) {
|
|
745
|
-
|
|
759
|
+
var _a;
|
|
760
|
+
return this.api.sendAudio(orThrow(this.chatId, "sendAudio"), audio, {
|
|
761
|
+
business_connection_id: this.businessConnectionId,
|
|
762
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
763
|
+
...other,
|
|
764
|
+
}, signal);
|
|
746
765
|
}
|
|
747
766
|
/**
|
|
748
767
|
* Context-aware alias for `api.sendDocument`. Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
|
|
@@ -754,7 +773,12 @@ class Context {
|
|
|
754
773
|
* **Official reference:** https://core.telegram.org/bots/api#senddocument
|
|
755
774
|
*/
|
|
756
775
|
replyWithDocument(document, other, signal) {
|
|
757
|
-
|
|
776
|
+
var _a;
|
|
777
|
+
return this.api.sendDocument(orThrow(this.chatId, "sendDocument"), document, {
|
|
778
|
+
business_connection_id: this.businessConnectionId,
|
|
779
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
780
|
+
...other,
|
|
781
|
+
}, signal);
|
|
758
782
|
}
|
|
759
783
|
/**
|
|
760
784
|
* Context-aware alias for `api.sendVideo`. Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
|
|
@@ -766,7 +790,12 @@ class Context {
|
|
|
766
790
|
* **Official reference:** https://core.telegram.org/bots/api#sendvideo
|
|
767
791
|
*/
|
|
768
792
|
replyWithVideo(video, other, signal) {
|
|
769
|
-
|
|
793
|
+
var _a;
|
|
794
|
+
return this.api.sendVideo(orThrow(this.chatId, "sendVideo"), video, {
|
|
795
|
+
business_connection_id: this.businessConnectionId,
|
|
796
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
797
|
+
...other,
|
|
798
|
+
}, signal);
|
|
770
799
|
}
|
|
771
800
|
/**
|
|
772
801
|
* Context-aware alias for `api.sendAnimation`. Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
|
|
@@ -778,7 +807,12 @@ class Context {
|
|
|
778
807
|
* **Official reference:** https://core.telegram.org/bots/api#sendanimation
|
|
779
808
|
*/
|
|
780
809
|
replyWithAnimation(animation, other, signal) {
|
|
781
|
-
|
|
810
|
+
var _a;
|
|
811
|
+
return this.api.sendAnimation(orThrow(this.chatId, "sendAnimation"), animation, {
|
|
812
|
+
business_connection_id: this.businessConnectionId,
|
|
813
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
814
|
+
...other,
|
|
815
|
+
}, signal);
|
|
782
816
|
}
|
|
783
817
|
/**
|
|
784
818
|
* Context-aware alias for `api.sendVoice`. Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
|
|
@@ -790,7 +824,12 @@ class Context {
|
|
|
790
824
|
* **Official reference:** https://core.telegram.org/bots/api#sendvoice
|
|
791
825
|
*/
|
|
792
826
|
replyWithVoice(voice, other, signal) {
|
|
793
|
-
|
|
827
|
+
var _a;
|
|
828
|
+
return this.api.sendVoice(orThrow(this.chatId, "sendVoice"), voice, {
|
|
829
|
+
business_connection_id: this.businessConnectionId,
|
|
830
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
831
|
+
...other,
|
|
832
|
+
}, signal);
|
|
794
833
|
}
|
|
795
834
|
/**
|
|
796
835
|
* Context-aware alias for `api.sendVideoNote`. Use this method to send video messages. On success, the sent Message is returned.
|
|
@@ -803,7 +842,12 @@ class Context {
|
|
|
803
842
|
* **Official reference:** https://core.telegram.org/bots/api#sendvideonote
|
|
804
843
|
*/
|
|
805
844
|
replyWithVideoNote(video_note, other, signal) {
|
|
806
|
-
|
|
845
|
+
var _a;
|
|
846
|
+
return this.api.sendVideoNote(orThrow(this.chatId, "sendVideoNote"), video_note, {
|
|
847
|
+
business_connection_id: this.businessConnectionId,
|
|
848
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
849
|
+
...other,
|
|
850
|
+
}, signal);
|
|
807
851
|
}
|
|
808
852
|
/**
|
|
809
853
|
* Context-aware alias for `api.sendMediaGroup`. Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned.
|
|
@@ -815,7 +859,12 @@ class Context {
|
|
|
815
859
|
* **Official reference:** https://core.telegram.org/bots/api#sendmediagroup
|
|
816
860
|
*/
|
|
817
861
|
replyWithMediaGroup(media, other, signal) {
|
|
818
|
-
|
|
862
|
+
var _a;
|
|
863
|
+
return this.api.sendMediaGroup(orThrow(this.chatId, "sendMediaGroup"), media, {
|
|
864
|
+
business_connection_id: this.businessConnectionId,
|
|
865
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
866
|
+
...other,
|
|
867
|
+
}, signal);
|
|
819
868
|
}
|
|
820
869
|
/**
|
|
821
870
|
* Context-aware alias for `api.sendLocation`. Use this method to send point on the map. On success, the sent Message is returned.
|
|
@@ -828,7 +877,12 @@ class Context {
|
|
|
828
877
|
* **Official reference:** https://core.telegram.org/bots/api#sendlocation
|
|
829
878
|
*/
|
|
830
879
|
replyWithLocation(latitude, longitude, other, signal) {
|
|
831
|
-
|
|
880
|
+
var _a;
|
|
881
|
+
return this.api.sendLocation(orThrow(this.chatId, "sendLocation"), latitude, longitude, {
|
|
882
|
+
business_connection_id: this.businessConnectionId,
|
|
883
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
884
|
+
...other,
|
|
885
|
+
}, signal);
|
|
832
886
|
}
|
|
833
887
|
/**
|
|
834
888
|
* Context-aware alias for `api.editMessageLiveLocation`. Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
|
|
@@ -886,7 +940,12 @@ class Context {
|
|
|
886
940
|
* **Official reference:** https://core.telegram.org/bots/api#sendvenue
|
|
887
941
|
*/
|
|
888
942
|
replyWithVenue(latitude, longitude, title, address, other, signal) {
|
|
889
|
-
|
|
943
|
+
var _a;
|
|
944
|
+
return this.api.sendVenue(orThrow(this.chatId, "sendVenue"), latitude, longitude, title, address, {
|
|
945
|
+
business_connection_id: this.businessConnectionId,
|
|
946
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
947
|
+
...other,
|
|
948
|
+
}, signal);
|
|
890
949
|
}
|
|
891
950
|
/**
|
|
892
951
|
* Context-aware alias for `api.sendContact`. Use this method to send phone contacts. On success, the sent Message is returned.
|
|
@@ -899,20 +958,57 @@ class Context {
|
|
|
899
958
|
* **Official reference:** https://core.telegram.org/bots/api#sendcontact
|
|
900
959
|
*/
|
|
901
960
|
replyWithContact(phone_number, first_name, other, signal) {
|
|
902
|
-
|
|
961
|
+
var _a;
|
|
962
|
+
return this.api.sendContact(orThrow(this.chatId, "sendContact"), phone_number, first_name, {
|
|
963
|
+
business_connection_id: this.businessConnectionId,
|
|
964
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
965
|
+
...other,
|
|
966
|
+
}, signal);
|
|
903
967
|
}
|
|
904
968
|
/**
|
|
905
969
|
* Context-aware alias for `api.sendPoll`. Use this method to send a native poll. On success, the sent Message is returned.
|
|
906
970
|
*
|
|
907
971
|
* @param question Poll question, 1-300 characters
|
|
908
|
-
* @param options A list of answer options, 2-
|
|
972
|
+
* @param options A list of answer options, 2-12 strings 1-100 characters each
|
|
909
973
|
* @param other Optional remaining parameters, confer the official reference below
|
|
910
974
|
* @param signal Optional `AbortSignal` to cancel the request
|
|
911
975
|
*
|
|
912
976
|
* **Official reference:** https://core.telegram.org/bots/api#sendpoll
|
|
913
977
|
*/
|
|
914
978
|
replyWithPoll(question, options, other, signal) {
|
|
915
|
-
|
|
979
|
+
var _a;
|
|
980
|
+
return this.api.sendPoll(orThrow(this.chatId, "sendPoll"), question, options, {
|
|
981
|
+
business_connection_id: this.businessConnectionId,
|
|
982
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
983
|
+
...other,
|
|
984
|
+
}, signal);
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Context-aware alias for `api.sendChecklist`. Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned.
|
|
988
|
+
*
|
|
989
|
+
* @param checklist An object for the checklist to send
|
|
990
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
991
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
992
|
+
*
|
|
993
|
+
* **Official reference:** https://core.telegram.org/bots/api#sendchecklist
|
|
994
|
+
*/
|
|
995
|
+
replyWithChecklist(checklist, other, signal) {
|
|
996
|
+
return this.api.sendChecklist(orThrow(this.businessConnectionId, "sendChecklist"), orThrow(this.chatId, "sendChecklist"), checklist, other, signal);
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Context-aware alias for `api.editMessageChecklist`. Use this method to edit a checklist on behalf of a connected business account. On success, the edited Message is returned.
|
|
1000
|
+
*
|
|
1001
|
+
* @param checklist An object for the new checklist
|
|
1002
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1003
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1004
|
+
*
|
|
1005
|
+
* **Official reference:** https://core.telegram.org/bots/api#editmessagechecklist
|
|
1006
|
+
*/
|
|
1007
|
+
editMessageChecklist(checklist, other, signal) {
|
|
1008
|
+
var _a, _b, _c, _d;
|
|
1009
|
+
const msg = orThrow(this.msg, "editMessageChecklist");
|
|
1010
|
+
const target = (_d = (_b = (_a = msg.checklist_tasks_done) === null || _a === void 0 ? void 0 : _a.checklist_message) !== null && _b !== void 0 ? _b : (_c = msg.checklist_tasks_added) === null || _c === void 0 ? void 0 : _c.checklist_message) !== null && _d !== void 0 ? _d : msg;
|
|
1011
|
+
return this.api.editMessageChecklist(orThrow(this.businessConnectionId, "editMessageChecklist"), orThrow(target.chat.id, "editMessageChecklist"), orThrow(target.message_id, "editMessageChecklist"), checklist, other, signal);
|
|
916
1012
|
}
|
|
917
1013
|
/**
|
|
918
1014
|
* Context-aware alias for `api.sendDice`. Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.
|
|
@@ -924,7 +1020,12 @@ class Context {
|
|
|
924
1020
|
* **Official reference:** https://core.telegram.org/bots/api#senddice
|
|
925
1021
|
*/
|
|
926
1022
|
replyWithDice(emoji, other, signal) {
|
|
927
|
-
|
|
1023
|
+
var _a;
|
|
1024
|
+
return this.api.sendDice(orThrow(this.chatId, "sendDice"), emoji, {
|
|
1025
|
+
business_connection_id: this.businessConnectionId,
|
|
1026
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
1027
|
+
...other,
|
|
1028
|
+
}, signal);
|
|
928
1029
|
}
|
|
929
1030
|
/**
|
|
930
1031
|
* 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.
|
|
@@ -940,7 +1041,12 @@ class Context {
|
|
|
940
1041
|
* **Official reference:** https://core.telegram.org/bots/api#sendchataction
|
|
941
1042
|
*/
|
|
942
1043
|
replyWithChatAction(action, other, signal) {
|
|
943
|
-
|
|
1044
|
+
var _a;
|
|
1045
|
+
return this.api.sendChatAction(orThrow(this.chatId, "sendChatAction"), action, {
|
|
1046
|
+
business_connection_id: this.businessConnectionId,
|
|
1047
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
1048
|
+
...other,
|
|
1049
|
+
}, signal);
|
|
944
1050
|
}
|
|
945
1051
|
/**
|
|
946
1052
|
* Context-aware alias for `api.setMessageReaction`. Use this method to change the chosen reactions on a message. Service messages of some types 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. Bots can't use paid reactions. Returns True on success.
|
|
@@ -1319,6 +1425,7 @@ class Context {
|
|
|
1319
1425
|
* Context-aware alias for `api.unpinChatMessage`. Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
|
|
1320
1426
|
*
|
|
1321
1427
|
* @param message_id Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned.
|
|
1428
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1322
1429
|
* @param signal Optional `AbortSignal` to cancel the request
|
|
1323
1430
|
*
|
|
1324
1431
|
* **Official reference:** https://core.telegram.org/bots/api#unpinchatmessage
|
|
@@ -1911,7 +2018,12 @@ class Context {
|
|
|
1911
2018
|
* **Official reference:** https://core.telegram.org/bots/api#sendsticker
|
|
1912
2019
|
*/
|
|
1913
2020
|
replyWithSticker(sticker, other, signal) {
|
|
1914
|
-
|
|
2021
|
+
var _a;
|
|
2022
|
+
return this.api.sendSticker(orThrow(this.chatId, "sendSticker"), sticker, {
|
|
2023
|
+
business_connection_id: this.businessConnectionId,
|
|
2024
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
2025
|
+
...other,
|
|
2026
|
+
}, signal);
|
|
1915
2027
|
}
|
|
1916
2028
|
/**
|
|
1917
2029
|
* Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects.
|
|
@@ -2005,7 +2117,8 @@ class Context {
|
|
|
2005
2117
|
* **Official reference:** https://core.telegram.org/bots/api#sendinvoice
|
|
2006
2118
|
*/
|
|
2007
2119
|
replyWithInvoice(title, description, payload, currency, prices, other, signal) {
|
|
2008
|
-
|
|
2120
|
+
var _a;
|
|
2121
|
+
return this.api.sendInvoice(orThrow(this.chatId, "sendInvoice"), title, description, payload, currency, prices, { message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id, ...other }, signal);
|
|
2009
2122
|
}
|
|
2010
2123
|
/**
|
|
2011
2124
|
* Context-aware alias for `api.answerShippingQuery`. If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.
|
|
@@ -2131,7 +2244,12 @@ class Context {
|
|
|
2131
2244
|
* **Official reference:** https://core.telegram.org/bots/api#sendgame
|
|
2132
2245
|
*/
|
|
2133
2246
|
replyWithGame(game_short_name, other, signal) {
|
|
2134
|
-
|
|
2247
|
+
var _a;
|
|
2248
|
+
return this.api.sendGame(orThrow(this.chatId, "sendGame"), game_short_name, {
|
|
2249
|
+
business_connection_id: this.businessConnectionId,
|
|
2250
|
+
message_thread_id: (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_thread_id,
|
|
2251
|
+
...other,
|
|
2252
|
+
}, signal);
|
|
2135
2253
|
}
|
|
2136
2254
|
}
|
|
2137
2255
|
exports.Context = Context;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Update } from "../types.js";
|
|
2
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
2
3
|
/**
|
|
3
4
|
* Abstraction over a request-response cycle, providing access to the update, as
|
|
4
5
|
* well as a mechanism for responding to the request and to end it.
|
|
@@ -8,7 +9,7 @@ export interface ReqResHandler<T = void> {
|
|
|
8
9
|
* The update object sent from Telegram, usually resolves the request's JSON
|
|
9
10
|
* body
|
|
10
11
|
*/
|
|
11
|
-
update:
|
|
12
|
+
update: MaybePromise<Update>;
|
|
12
13
|
/**
|
|
13
14
|
* X-Telegram-Bot-Api-Secret-Token header of the request, or undefined if
|
|
14
15
|
* not present
|
|
@@ -214,3 +215,4 @@ export declare const adapters: {
|
|
|
214
215
|
sveltekit: SveltekitAdapter;
|
|
215
216
|
worktop: WorktopAdapter;
|
|
216
217
|
};
|
|
218
|
+
export {};
|