@yaebal/contexts 0.0.4 → 0.0.5
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/lib/generated/business-connection.d.ts +48 -0
- package/lib/generated/business-connection.d.ts.map +1 -1
- package/lib/generated/business-connection.js +96 -0
- package/lib/generated/business-connection.js.map +1 -1
- package/lib/generated/business-message.d.ts +83 -41
- package/lib/generated/business-message.d.ts.map +1 -1
- package/lib/generated/business-message.js +125 -41
- package/lib/generated/business-message.js.map +1 -1
- package/lib/generated/callback-query.d.ts +40 -40
- package/lib/generated/callback-query.d.ts.map +1 -1
- package/lib/generated/callback-query.js +40 -40
- package/lib/generated/callback-query.js.map +1 -1
- package/lib/generated/channel-post.d.ts +33 -35
- package/lib/generated/channel-post.d.ts.map +1 -1
- package/lib/generated/channel-post.js +37 -41
- package/lib/generated/channel-post.js.map +1 -1
- package/lib/generated/chat-boost.d.ts +0 -12
- package/lib/generated/chat-boost.d.ts.map +1 -1
- package/lib/generated/chat-boost.js +0 -24
- package/lib/generated/chat-boost.js.map +1 -1
- package/lib/generated/chat-join-request.d.ts +0 -12
- package/lib/generated/chat-join-request.d.ts.map +1 -1
- package/lib/generated/chat-join-request.js +0 -24
- package/lib/generated/chat-join-request.js.map +1 -1
- package/lib/generated/chat-member.d.ts +0 -12
- package/lib/generated/chat-member.d.ts.map +1 -1
- package/lib/generated/chat-member.js +0 -24
- package/lib/generated/chat-member.js.map +1 -1
- package/lib/generated/deleted-business-messages.d.ts +68 -38
- package/lib/generated/deleted-business-messages.d.ts.map +1 -1
- package/lib/generated/deleted-business-messages.js +108 -48
- package/lib/generated/deleted-business-messages.js.map +1 -1
- package/lib/generated/edited-business-message.d.ts +83 -41
- package/lib/generated/edited-business-message.d.ts.map +1 -1
- package/lib/generated/edited-business-message.js +125 -41
- package/lib/generated/edited-business-message.js.map +1 -1
- package/lib/generated/edited-channel-post.d.ts +33 -35
- package/lib/generated/edited-channel-post.d.ts.map +1 -1
- package/lib/generated/edited-channel-post.js +37 -41
- package/lib/generated/edited-channel-post.js.map +1 -1
- package/lib/generated/edited-message.d.ts +33 -35
- package/lib/generated/edited-message.d.ts.map +1 -1
- package/lib/generated/edited-message.js +37 -41
- package/lib/generated/edited-message.js.map +1 -1
- package/lib/generated/guest-message.d.ts +33 -35
- package/lib/generated/guest-message.d.ts.map +1 -1
- package/lib/generated/guest-message.js +37 -41
- package/lib/generated/guest-message.js.map +1 -1
- package/lib/generated/message-reaction-count.d.ts +0 -16
- package/lib/generated/message-reaction-count.d.ts.map +1 -1
- package/lib/generated/message-reaction-count.js +0 -32
- package/lib/generated/message-reaction-count.js.map +1 -1
- package/lib/generated/message-reaction.d.ts +0 -16
- package/lib/generated/message-reaction.d.ts.map +1 -1
- package/lib/generated/message-reaction.js +0 -32
- package/lib/generated/message-reaction.js.map +1 -1
- package/lib/generated/message.d.ts +33 -35
- package/lib/generated/message.d.ts.map +1 -1
- package/lib/generated/message.js +37 -41
- package/lib/generated/message.js.map +1 -1
- package/lib/generated/my-chat-member.d.ts +0 -12
- package/lib/generated/my-chat-member.d.ts.map +1 -1
- package/lib/generated/my-chat-member.js +0 -24
- package/lib/generated/my-chat-member.js.map +1 -1
- package/lib/generated/removed-chat-boost.d.ts +0 -12
- package/lib/generated/removed-chat-boost.d.ts.map +1 -1
- package/lib/generated/removed-chat-boost.js +0 -24
- package/lib/generated/removed-chat-boost.js.map +1 -1
- package/lib/index.test.js +172 -1
- package/lib/index.test.js.map +1 -1
- package/lib/sugar/business-message.d.ts +12 -3
- package/lib/sugar/business-message.d.ts.map +1 -1
- package/lib/sugar/business-message.js +12 -1
- package/lib/sugar/business-message.js.map +1 -1
- package/lib/sugar/channel-post.d.ts +5 -2
- package/lib/sugar/channel-post.d.ts.map +1 -1
- package/lib/sugar/edited-business-message.d.ts +12 -3
- package/lib/sugar/edited-business-message.d.ts.map +1 -1
- package/lib/sugar/edited-business-message.js +12 -1
- package/lib/sugar/edited-business-message.js.map +1 -1
- package/lib/sugar/edited-channel-post.d.ts +5 -2
- package/lib/sugar/edited-channel-post.d.ts.map +1 -1
- package/lib/sugar/edited-message.d.ts +5 -2
- package/lib/sugar/edited-message.d.ts.map +1 -1
- package/lib/sugar/message-mixin.d.ts +6 -0
- package/lib/sugar/message-mixin.d.ts.map +1 -1
- package/lib/sugar/message-mixin.js +32 -1
- package/lib/sugar/message-mixin.js.map +1 -1
- package/lib/sugar/message.d.ts +5 -2
- package/lib/sugar/message.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/generated/business-connection.ts +96 -0
- package/src/generated/business-message.ts +166 -82
- package/src/generated/callback-query.ts +80 -80
- package/src/generated/channel-post.ts +66 -70
- package/src/generated/chat-boost.ts +0 -24
- package/src/generated/chat-join-request.ts +0 -24
- package/src/generated/chat-member.ts +0 -24
- package/src/generated/deleted-business-messages.ts +136 -76
- package/src/generated/edited-business-message.ts +166 -82
- package/src/generated/edited-channel-post.ts +66 -70
- package/src/generated/edited-message.ts +66 -70
- package/src/generated/guest-message.ts +66 -70
- package/src/generated/message-reaction-count.ts +0 -32
- package/src/generated/message-reaction.ts +0 -32
- package/src/generated/message.ts +66 -70
- package/src/generated/my-chat-member.ts +0 -24
- package/src/generated/removed-chat-boost.ts +0 -24
- package/src/index.test.ts +193 -0
- package/src/sugar/business-message.ts +14 -2
- package/src/sugar/edited-business-message.ts +14 -2
- package/src/sugar/message-mixin.ts +41 -1
|
@@ -23,81 +23,85 @@ export class DeletedBusinessMessagesContext {
|
|
|
23
23
|
get isGroup(): boolean {
|
|
24
24
|
return this.chat.type === "group" || this.chat.type === "supergroup";
|
|
25
25
|
}
|
|
26
|
+
/** camel-case alias for `business_connection_id`. */
|
|
27
|
+
get businessConnectionId(): string {
|
|
28
|
+
return this.business_connection_id;
|
|
29
|
+
}
|
|
26
30
|
/** Use this method to send text messages. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
27
|
-
send(params: Omit<t.SendMessageParams, "chat_id">) {
|
|
28
|
-
return this.api.call<t.Message>("sendMessage", { chat_id: this.chat.id, ...params });
|
|
31
|
+
send(params: Omit<t.SendMessageParams, "business_connection_id" | "chat_id">) {
|
|
32
|
+
return this.api.call<t.Message>("sendMessage", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
29
33
|
}
|
|
30
34
|
/** Use this method to send photos. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
31
|
-
sendPhoto(params: Omit<t.SendPhotoParams, "chat_id">) {
|
|
32
|
-
return this.api.call<t.Message>("sendPhoto", { chat_id: this.chat.id, ...params });
|
|
35
|
+
sendPhoto(params: Omit<t.SendPhotoParams, "business_connection_id" | "chat_id">) {
|
|
36
|
+
return this.api.call<t.Message>("sendPhoto", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
33
37
|
}
|
|
34
38
|
/** Use this method to send live photos. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
35
|
-
sendLivePhoto(params: Omit<t.SendLivePhotoParams, "chat_id">) {
|
|
36
|
-
return this.api.call<t.Message>("sendLivePhoto", { chat_id: this.chat.id, ...params });
|
|
39
|
+
sendLivePhoto(params: Omit<t.SendLivePhotoParams, "business_connection_id" | "chat_id">) {
|
|
40
|
+
return this.api.call<t.Message>("sendLivePhoto", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
37
41
|
}
|
|
38
42
|
/** 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](https://core.telegram.org/bots/api/#message) is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. For sending voice messages, use the [sendVoice](https://core.telegram.org/bots/api/#sendvoice) method instead. */
|
|
39
|
-
sendAudio(params: Omit<t.SendAudioParams, "chat_id">) {
|
|
40
|
-
return this.api.call<t.Message>("sendAudio", { chat_id: this.chat.id, ...params });
|
|
43
|
+
sendAudio(params: Omit<t.SendAudioParams, "business_connection_id" | "chat_id">) {
|
|
44
|
+
return this.api.call<t.Message>("sendAudio", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
41
45
|
}
|
|
42
46
|
/** Use this method to send general files. On success, the sent [Message](https://core.telegram.org/bots/api/#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. */
|
|
43
|
-
sendDocument(params: Omit<t.SendDocumentParams, "chat_id">) {
|
|
44
|
-
return this.api.call<t.Message>("sendDocument", { chat_id: this.chat.id, ...params });
|
|
47
|
+
sendDocument(params: Omit<t.SendDocumentParams, "business_connection_id" | "chat_id">) {
|
|
48
|
+
return this.api.call<t.Message>("sendDocument", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
45
49
|
}
|
|
46
50
|
/** Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as [Document](https://core.telegram.org/bots/api/#document)). On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. */
|
|
47
|
-
sendVideo(params: Omit<t.SendVideoParams, "chat_id">) {
|
|
48
|
-
return this.api.call<t.Message>("sendVideo", { chat_id: this.chat.id, ...params });
|
|
51
|
+
sendVideo(params: Omit<t.SendVideoParams, "business_connection_id" | "chat_id">) {
|
|
52
|
+
return this.api.call<t.Message>("sendVideo", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
49
53
|
}
|
|
50
54
|
/** Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. */
|
|
51
|
-
sendAnimation(params: Omit<t.SendAnimationParams, "chat_id">) {
|
|
52
|
-
return this.api.call<t.Message>("sendAnimation", { chat_id: this.chat.id, ...params });
|
|
55
|
+
sendAnimation(params: Omit<t.SendAnimationParams, "business_connection_id" | "chat_id">) {
|
|
56
|
+
return this.api.call<t.Message>("sendAnimation", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
53
57
|
}
|
|
54
58
|
/** 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, or in .MP3 format, or in .M4A format (other formats may be sent as [Audio](https://core.telegram.org/bots/api/#audio) or [Document](https://core.telegram.org/bots/api/#document)). On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. */
|
|
55
|
-
sendVoice(params: Omit<t.SendVoiceParams, "chat_id">) {
|
|
56
|
-
return this.api.call<t.Message>("sendVoice", { chat_id: this.chat.id, ...params });
|
|
59
|
+
sendVoice(params: Omit<t.SendVoiceParams, "business_connection_id" | "chat_id">) {
|
|
60
|
+
return this.api.call<t.Message>("sendVoice", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
57
61
|
}
|
|
58
62
|
/** As of [v.4.0](https://telegram.org/blog/video-messages-and-telescope), Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
59
|
-
sendVideoNote(params: Omit<t.SendVideoNoteParams, "chat_id">) {
|
|
60
|
-
return this.api.call<t.Message>("sendVideoNote", { chat_id: this.chat.id, ...params });
|
|
63
|
+
sendVideoNote(params: Omit<t.SendVideoNoteParams, "business_connection_id" | "chat_id">) {
|
|
64
|
+
return this.api.call<t.Message>("sendVideoNote", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
61
65
|
}
|
|
62
66
|
/** Use this method to send paid media. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
63
|
-
sendPaidMedia(params: Omit<t.SendPaidMediaParams, "chat_id">) {
|
|
64
|
-
return this.api.call<t.Message>("sendPaidMedia", { chat_id: this.chat.id, ...params });
|
|
67
|
+
sendPaidMedia(params: Omit<t.SendPaidMediaParams, "business_connection_id" | "chat_id">) {
|
|
68
|
+
return this.api.call<t.Message>("sendPaidMedia", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
65
69
|
}
|
|
66
70
|
/** Use this method to send a group of photos, live 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 [Message](https://core.telegram.org/bots/api/#message) objects that were sent is returned. */
|
|
67
|
-
sendMediaGroup(params: Omit<t.SendMediaGroupParams, "chat_id">) {
|
|
68
|
-
return this.api.call<t.Message[]>("sendMediaGroup", { chat_id: this.chat.id, ...params });
|
|
71
|
+
sendMediaGroup(params: Omit<t.SendMediaGroupParams, "business_connection_id" | "chat_id">) {
|
|
72
|
+
return this.api.call<t.Message[]>("sendMediaGroup", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
69
73
|
}
|
|
70
74
|
/** Use this method to send point on the map. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
71
|
-
sendLocation(params: Omit<t.SendLocationParams, "chat_id">) {
|
|
72
|
-
return this.api.call<t.Message>("sendLocation", { chat_id: this.chat.id, ...params });
|
|
75
|
+
sendLocation(params: Omit<t.SendLocationParams, "business_connection_id" | "chat_id">) {
|
|
76
|
+
return this.api.call<t.Message>("sendLocation", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
73
77
|
}
|
|
74
78
|
/** Use this method to send information about a venue. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
75
|
-
sendVenue(params: Omit<t.SendVenueParams, "chat_id">) {
|
|
76
|
-
return this.api.call<t.Message>("sendVenue", { chat_id: this.chat.id, ...params });
|
|
79
|
+
sendVenue(params: Omit<t.SendVenueParams, "business_connection_id" | "chat_id">) {
|
|
80
|
+
return this.api.call<t.Message>("sendVenue", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
77
81
|
}
|
|
78
82
|
/** Use this method to send phone contacts. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
79
|
-
sendContact(params: Omit<t.SendContactParams, "chat_id">) {
|
|
80
|
-
return this.api.call<t.Message>("sendContact", { chat_id: this.chat.id, ...params });
|
|
83
|
+
sendContact(params: Omit<t.SendContactParams, "business_connection_id" | "chat_id">) {
|
|
84
|
+
return this.api.call<t.Message>("sendContact", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
81
85
|
}
|
|
82
86
|
/** Use this method to send a native poll. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
83
|
-
sendPoll(params: Omit<t.SendPollParams, "chat_id">) {
|
|
84
|
-
return this.api.call<t.Message>("sendPoll", { chat_id: this.chat.id, ...params });
|
|
87
|
+
sendPoll(params: Omit<t.SendPollParams, "business_connection_id" | "chat_id">) {
|
|
88
|
+
return this.api.call<t.Message>("sendPoll", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
85
89
|
}
|
|
86
90
|
/** Use this method to send a checklist on behalf of a connected business account. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
87
|
-
sendChecklist(params: Omit<t.SendChecklistParams, "chat_id">) {
|
|
88
|
-
return this.api.call<t.Message>("sendChecklist", { chat_id: this.chat.id, ...params });
|
|
91
|
+
sendChecklist(params: Omit<t.SendChecklistParams, "business_connection_id" | "chat_id">) {
|
|
92
|
+
return this.api.call<t.Message>("sendChecklist", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
89
93
|
}
|
|
90
94
|
/** Use this method to send an animated emoji that will display a random value. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
91
|
-
sendDice(params: Omit<t.SendDiceParams, "chat_id">) {
|
|
92
|
-
return this.api.call<t.Message>("sendDice", { chat_id: this.chat.id, ...params });
|
|
95
|
+
sendDice(params: Omit<t.SendDiceParams, "business_connection_id" | "chat_id">) {
|
|
96
|
+
return this.api.call<t.Message>("sendDice", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
93
97
|
}
|
|
94
98
|
/** Use this method to stream a partial message to a user while the message is being generated. Note that the streamed draft is ephemeral and acts as a temporary 30-second preview - once the output is finalized, you **must** call [sendMessage](https://core.telegram.org/bots/api/#sendmessage) with the complete message to persist it in the user's chat. Returns *True* on success. */
|
|
95
99
|
sendMessageDraft(params: Omit<t.SendMessageDraftParams, "chat_id">) {
|
|
96
100
|
return this.api.call<boolean>("sendMessageDraft", { chat_id: this.chat.id, ...params });
|
|
97
101
|
}
|
|
98
102
|
/** 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. Example: The [ImageBot](https://t.me/imagebot) needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use [sendChatAction](https://core.telegram.org/bots/api/#sendchataction) with *action* = *upload\_photo*. The user will see a “sending photo” status for the bot. We only recommend using this method when a response from the bot will take a **noticeable** amount of time to arrive. */
|
|
99
|
-
sendChatAction(params: Omit<t.SendChatActionParams, "chat_id">) {
|
|
100
|
-
return this.api.call<boolean>("sendChatAction", { chat_id: this.chat.id, ...params });
|
|
103
|
+
sendChatAction(params: Omit<t.SendChatActionParams, "business_connection_id" | "chat_id">) {
|
|
104
|
+
return this.api.call<boolean>("sendChatAction", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
101
105
|
}
|
|
102
106
|
/** Use this method to ban a channel chat in a supergroup or a channel. Until the chat is [unbanned](https://core.telegram.org/bots/api/#unbanchatsenderchat), the owner of the banned chat won't be able to send messages on behalf of **any of their channels**. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns *True* on success. */
|
|
103
107
|
banChatSenderChat(params: Omit<t.BanChatSenderChatParams, "chat_id">) {
|
|
@@ -152,8 +156,8 @@ export class DeletedBusinessMessagesContext {
|
|
|
152
156
|
return this.api.call<boolean>("setChatDescription", { chat_id: this.chat.id, ...params });
|
|
153
157
|
}
|
|
154
158
|
/** Use this method to remove a message from the list of pinned messages in a chat. In private chats and channel direct messages chats, all messages can be unpinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin messages in groups and channels respectively. Returns *True* on success. */
|
|
155
|
-
unpin(params: Omit<t.UnpinChatMessageParams, "chat_id">) {
|
|
156
|
-
return this.api.call<boolean>("unpinChatMessage", { chat_id: this.chat.id, ...params });
|
|
159
|
+
unpin(params: Omit<t.UnpinChatMessageParams, "business_connection_id" | "chat_id">) {
|
|
160
|
+
return this.api.call<boolean>("unpinChatMessage", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
157
161
|
}
|
|
158
162
|
/** Use this method to clear the list of pinned messages in a chat. In private chats and channel direct messages chats, no additional rights are required to unpin all pinned messages. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin all pinned messages in groups and channels respectively. Returns *True* on success. */
|
|
159
163
|
unpinAllChatMessages(params?: Omit<t.UnpinAllChatMessagesParams, "chat_id">) {
|
|
@@ -187,26 +191,6 @@ export class DeletedBusinessMessagesContext {
|
|
|
187
191
|
createForumTopic(params: Omit<t.CreateForumTopicParams, "chat_id">) {
|
|
188
192
|
return this.api.call<t.ForumTopic>("createForumTopic", { chat_id: this.chat.id, ...params });
|
|
189
193
|
}
|
|
190
|
-
/** Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the *can\_manage\_topics* administrator rights, unless it is the creator of the topic. Returns *True* on success. */
|
|
191
|
-
editForumTopic(params: Omit<t.EditForumTopicParams, "chat_id">) {
|
|
192
|
-
return this.api.call<boolean>("editForumTopic", { chat_id: this.chat.id, ...params });
|
|
193
|
-
}
|
|
194
|
-
/** Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can\_manage\_topics* administrator rights, unless it is the creator of the topic. Returns *True* on success. */
|
|
195
|
-
closeForumTopic(params: Omit<t.CloseForumTopicParams, "chat_id">) {
|
|
196
|
-
return this.api.call<boolean>("closeForumTopic", { chat_id: this.chat.id, ...params });
|
|
197
|
-
}
|
|
198
|
-
/** Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can\_manage\_topics* administrator rights, unless it is the creator of the topic. Returns *True* on success. */
|
|
199
|
-
reopenForumTopic(params: Omit<t.ReopenForumTopicParams, "chat_id">) {
|
|
200
|
-
return this.api.call<boolean>("reopenForumTopic", { chat_id: this.chat.id, ...params });
|
|
201
|
-
}
|
|
202
|
-
/** Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the *can\_delete\_messages* administrator rights. Returns *True* on success. */
|
|
203
|
-
deleteForumTopic(params: Omit<t.DeleteForumTopicParams, "chat_id">) {
|
|
204
|
-
return this.api.call<boolean>("deleteForumTopic", { chat_id: this.chat.id, ...params });
|
|
205
|
-
}
|
|
206
|
-
/** Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the *can\_pin\_messages* administrator right in the supergroup. Returns *True* on success. */
|
|
207
|
-
unpinAllForumTopicMessages(params: Omit<t.UnpinAllForumTopicMessagesParams, "chat_id">) {
|
|
208
|
-
return this.api.call<boolean>("unpinAllForumTopicMessages", { chat_id: this.chat.id, ...params });
|
|
209
|
-
}
|
|
210
194
|
/** Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can\_manage\_topics* administrator rights. Returns *True* on success. */
|
|
211
195
|
editGeneralForumTopic(params: Omit<t.EditGeneralForumTopicParams, "chat_id">) {
|
|
212
196
|
return this.api.call<boolean>("editGeneralForumTopic", { chat_id: this.chat.id, ...params });
|
|
@@ -231,6 +215,10 @@ export class DeletedBusinessMessagesContext {
|
|
|
231
215
|
unpinAllGeneralForumTopicMessages(params?: Omit<t.UnpinAllGeneralForumTopicMessagesParams, "chat_id">) {
|
|
232
216
|
return this.api.call<boolean>("unpinAllGeneralForumTopicMessages", { chat_id: this.chat.id, ...params });
|
|
233
217
|
}
|
|
218
|
+
/** Use this method to get information about the connection of the bot with a business account. Returns a [BusinessConnection](https://core.telegram.org/bots/api/#businessconnection) object on success. */
|
|
219
|
+
getBusinessConnection(params?: Omit<t.GetBusinessConnectionParams, "business_connection_id">) {
|
|
220
|
+
return this.api.call<t.BusinessConnection>("getBusinessConnection", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
221
|
+
}
|
|
234
222
|
/** Use this method to change the bot's menu button in a private chat, or the default menu button. Returns *True* on success. */
|
|
235
223
|
setChatMenuButton(params: Omit<t.SetChatMenuButtonParams, "chat_id">) {
|
|
236
224
|
return this.api.call<boolean>("setChatMenuButton", { chat_id: this.chat.id, ...params });
|
|
@@ -251,33 +239,101 @@ export class DeletedBusinessMessagesContext {
|
|
|
251
239
|
removeChatVerification(params?: Omit<t.RemoveChatVerificationParams, "chat_id">) {
|
|
252
240
|
return this.api.call<boolean>("removeChatVerification", { chat_id: this.chat.id, ...params });
|
|
253
241
|
}
|
|
242
|
+
/** Delete messages on behalf of a business account. Requires the *can\_delete\_sent\_messages* business bot right to delete messages sent by the bot itself, or the *can\_delete\_all\_messages* business bot right to delete any message. Returns *True* on success. */
|
|
243
|
+
deleteBusinessMessages(params: Omit<t.DeleteBusinessMessagesParams, "business_connection_id">) {
|
|
244
|
+
return this.api.call<boolean>("deleteBusinessMessages", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
245
|
+
}
|
|
246
|
+
/** Changes the first and last name of a managed business account. Requires the *can\_change\_name* business bot right. Returns *True* on success. */
|
|
247
|
+
setBusinessAccountName(params: Omit<t.SetBusinessAccountNameParams, "business_connection_id">) {
|
|
248
|
+
return this.api.call<boolean>("setBusinessAccountName", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
249
|
+
}
|
|
250
|
+
/** Changes the username of a managed business account. Requires the *can\_change\_username* business bot right. Returns *True* on success. */
|
|
251
|
+
setBusinessAccountUsername(params: Omit<t.SetBusinessAccountUsernameParams, "business_connection_id">) {
|
|
252
|
+
return this.api.call<boolean>("setBusinessAccountUsername", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
253
|
+
}
|
|
254
|
+
/** Changes the bio of a managed business account. Requires the *can\_change\_bio* business bot right. Returns *True* on success. */
|
|
255
|
+
setBusinessAccountBio(params: Omit<t.SetBusinessAccountBioParams, "business_connection_id">) {
|
|
256
|
+
return this.api.call<boolean>("setBusinessAccountBio", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
257
|
+
}
|
|
258
|
+
/** Changes the profile photo of a managed business account. Requires the *can\_edit\_profile\_photo* business bot right. Returns *True* on success. */
|
|
259
|
+
setBusinessAccountProfilePhoto(params: Omit<t.SetBusinessAccountProfilePhotoParams, "business_connection_id">) {
|
|
260
|
+
return this.api.call<boolean>("setBusinessAccountProfilePhoto", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
261
|
+
}
|
|
262
|
+
/** Removes the current profile photo of a managed business account. Requires the *can\_edit\_profile\_photo* business bot right. Returns *True* on success. */
|
|
263
|
+
removeBusinessAccountProfilePhoto(params: Omit<t.RemoveBusinessAccountProfilePhotoParams, "business_connection_id">) {
|
|
264
|
+
return this.api.call<boolean>("removeBusinessAccountProfilePhoto", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
265
|
+
}
|
|
266
|
+
/** Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the *can\_change\_gift\_settings* business bot right. Returns *True* on success. */
|
|
267
|
+
setBusinessAccountGiftSettings(params: Omit<t.SetBusinessAccountGiftSettingsParams, "business_connection_id">) {
|
|
268
|
+
return this.api.call<boolean>("setBusinessAccountGiftSettings", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
269
|
+
}
|
|
270
|
+
/** Returns the amount of Telegram Stars owned by a managed business account. Requires the *can\_view\_gifts\_and\_stars* business bot right. Returns [StarAmount](https://core.telegram.org/bots/api/#staramount) on success. */
|
|
271
|
+
getBusinessAccountStarBalance(params?: Omit<t.GetBusinessAccountStarBalanceParams, "business_connection_id">) {
|
|
272
|
+
return this.api.call<t.StarAmount>("getBusinessAccountStarBalance", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
273
|
+
}
|
|
274
|
+
/** Transfers Telegram Stars from the business account balance to the bot's balance. Requires the *can\_transfer\_stars* business bot right. Returns *True* on success. */
|
|
275
|
+
transferBusinessAccountStars(params: Omit<t.TransferBusinessAccountStarsParams, "business_connection_id">) {
|
|
276
|
+
return this.api.call<boolean>("transferBusinessAccountStars", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
277
|
+
}
|
|
278
|
+
/** Returns the gifts received and owned by a managed business account. Requires the *can\_view\_gifts\_and\_stars* business bot right. Returns [OwnedGifts](https://core.telegram.org/bots/api/#ownedgifts) on success. */
|
|
279
|
+
getBusinessAccountGifts(params: Omit<t.GetBusinessAccountGiftsParams, "business_connection_id">) {
|
|
280
|
+
return this.api.call<t.OwnedGifts>("getBusinessAccountGifts", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
281
|
+
}
|
|
254
282
|
/** Returns the gifts owned by a chat. Returns [OwnedGifts](https://core.telegram.org/bots/api/#ownedgifts) on success. */
|
|
255
283
|
getChatGifts(params: Omit<t.GetChatGiftsParams, "chat_id">) {
|
|
256
284
|
return this.api.call<t.OwnedGifts>("getChatGifts", { chat_id: this.chat.id, ...params });
|
|
257
285
|
}
|
|
286
|
+
/** Converts a given regular gift to Telegram Stars. Requires the *can\_convert\_gifts\_to\_stars* business bot right. Returns *True* on success. */
|
|
287
|
+
convertGiftToStars(params: Omit<t.ConvertGiftToStarsParams, "business_connection_id">) {
|
|
288
|
+
return this.api.call<boolean>("convertGiftToStars", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
289
|
+
}
|
|
290
|
+
/** Upgrades a given regular gift to a unique gift. Requires the *can\_transfer\_and\_upgrade\_gifts* business bot right. Additionally requires the *can\_transfer\_stars* business bot right if the upgrade is paid. Returns *True* on success. */
|
|
291
|
+
upgradeGift(params: Omit<t.UpgradeGiftParams, "business_connection_id">) {
|
|
292
|
+
return this.api.call<boolean>("upgradeGift", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
293
|
+
}
|
|
294
|
+
/** Transfers an owned unique gift to another user. Requires the *can\_transfer\_and\_upgrade\_gifts* business bot right. Requires *can\_transfer\_stars* business bot right if the transfer is paid. Returns *True* on success. */
|
|
295
|
+
transferGift(params: Omit<t.TransferGiftParams, "business_connection_id">) {
|
|
296
|
+
return this.api.call<boolean>("transferGift", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
297
|
+
}
|
|
298
|
+
/** Posts a story on behalf of a managed business account. Requires the *can\_manage\_stories* business bot right. Returns [Story](https://core.telegram.org/bots/api/#story) on success. */
|
|
299
|
+
postStory(params: Omit<t.PostStoryParams, "business_connection_id">) {
|
|
300
|
+
return this.api.call<t.Story>("postStory", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
301
|
+
}
|
|
302
|
+
/** Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted (or reposted) by the bot. Requires the *can\_manage\_stories* business bot right for both business accounts. Returns [Story](https://core.telegram.org/bots/api/#story) on success. */
|
|
303
|
+
repostStory(params: Omit<t.RepostStoryParams, "business_connection_id" | "from_chat_id">) {
|
|
304
|
+
return this.api.call<t.Story>("repostStory", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), from_chat_id: this.chat.id, ...params });
|
|
305
|
+
}
|
|
306
|
+
/** Edits a story previously posted by the bot on behalf of a managed business account. Requires the *can\_manage\_stories* business bot right. Returns [Story](https://core.telegram.org/bots/api/#story) on success. */
|
|
307
|
+
editStory(params: Omit<t.EditStoryParams, "business_connection_id">) {
|
|
308
|
+
return this.api.call<t.Story>("editStory", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
309
|
+
}
|
|
310
|
+
/** Deletes a story previously posted by the bot on behalf of a managed business account. Requires the *can\_manage\_stories* business bot right. Returns *True* on success. */
|
|
311
|
+
deleteStory(params: Omit<t.DeleteStoryParams, "business_connection_id">) {
|
|
312
|
+
return this.api.call<boolean>("deleteStory", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
313
|
+
}
|
|
258
314
|
/** Use this method to edit text, rich and [game](https://core.telegram.org/bots/api/#games) messages. On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api/#message) is returned, otherwise *True* is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. */
|
|
259
|
-
editText(params: Omit<t.EditMessageTextParams, "chat_id">) {
|
|
260
|
-
return this.api.call<t.Message | boolean>("editMessageText", { chat_id: this.chat.id, ...params });
|
|
315
|
+
editText(params: Omit<t.EditMessageTextParams, "business_connection_id" | "chat_id">) {
|
|
316
|
+
return this.api.call<t.Message | boolean>("editMessageText", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
261
317
|
}
|
|
262
318
|
/** Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api/#message) is returned, otherwise *True* is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. */
|
|
263
|
-
editCaption(params: Omit<t.EditMessageCaptionParams, "chat_id">) {
|
|
264
|
-
return this.api.call<t.Message | boolean>("editMessageCaption", { chat_id: this.chat.id, ...params });
|
|
319
|
+
editCaption(params: Omit<t.EditMessageCaptionParams, "business_connection_id" | "chat_id">) {
|
|
320
|
+
return this.api.call<t.Message | boolean>("editMessageCaption", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
265
321
|
}
|
|
266
322
|
/** Use this method to edit animation, audio, document, live photo, photo, or video messages, or to replace a text or a rich message with a media. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo, a live photo, or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api/#message) is returned, otherwise *True* is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. */
|
|
267
|
-
editMedia(params: Omit<t.EditMessageMediaParams, "chat_id">) {
|
|
268
|
-
return this.api.call<t.Message | boolean>("editMessageMedia", { chat_id: this.chat.id, ...params });
|
|
323
|
+
editMedia(params: Omit<t.EditMessageMediaParams, "business_connection_id" | "chat_id">) {
|
|
324
|
+
return this.api.call<t.Message | boolean>("editMessageMedia", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
269
325
|
}
|
|
270
326
|
/** 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](https://core.telegram.org/bots/api/#stopmessagelivelocation). On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api/#message) is returned, otherwise *True* is returned. */
|
|
271
|
-
editLiveLocation(params: Omit<t.EditMessageLiveLocationParams, "chat_id">) {
|
|
272
|
-
return this.api.call<t.Message | boolean>("editMessageLiveLocation", { chat_id: this.chat.id, ...params });
|
|
327
|
+
editLiveLocation(params: Omit<t.EditMessageLiveLocationParams, "business_connection_id" | "chat_id">) {
|
|
328
|
+
return this.api.call<t.Message | boolean>("editMessageLiveLocation", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
273
329
|
}
|
|
274
330
|
/** Use this method to stop updating a live location message before *live\_period* expires. On success, if the message is not an inline message, the edited [Message](https://core.telegram.org/bots/api/#message) is returned, otherwise *True* is returned. */
|
|
275
|
-
stopMessageLiveLocation(params: Omit<t.StopMessageLiveLocationParams, "chat_id">) {
|
|
276
|
-
return this.api.call<t.Message | boolean>("stopMessageLiveLocation", { chat_id: this.chat.id, ...params });
|
|
331
|
+
stopMessageLiveLocation(params: Omit<t.StopMessageLiveLocationParams, "business_connection_id" | "chat_id">) {
|
|
332
|
+
return this.api.call<t.Message | boolean>("stopMessageLiveLocation", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
277
333
|
}
|
|
278
334
|
/** Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api/#message) is returned, otherwise *True* is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. */
|
|
279
|
-
editReplyMarkup(params: Omit<t.EditMessageReplyMarkupParams, "chat_id">) {
|
|
280
|
-
return this.api.call<t.Message | boolean>("editMessageReplyMarkup", { chat_id: this.chat.id, ...params });
|
|
335
|
+
editReplyMarkup(params: Omit<t.EditMessageReplyMarkupParams, "business_connection_id" | "chat_id">) {
|
|
336
|
+
return this.api.call<t.Message | boolean>("editMessageReplyMarkup", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
281
337
|
}
|
|
282
338
|
/** Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns *True* on success. */
|
|
283
339
|
deleteMessages(params: Omit<t.DeleteMessagesParams, "chat_id">) {
|
|
@@ -288,12 +344,12 @@ export class DeletedBusinessMessagesContext {
|
|
|
288
344
|
return this.api.call<boolean>("deleteAllMessageReactions", { chat_id: this.chat.id, ...params });
|
|
289
345
|
}
|
|
290
346
|
/** Use this method to send static .WEBP, [animated](https://telegram.org/blog/animated-stickers) .TGS, or [video](https://telegram.org/blog/video-stickers-better-reactions) .WEBM stickers. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
291
|
-
sendSticker(params: Omit<t.SendStickerParams, "chat_id">) {
|
|
292
|
-
return this.api.call<t.Message>("sendSticker", { chat_id: this.chat.id, ...params });
|
|
347
|
+
sendSticker(params: Omit<t.SendStickerParams, "business_connection_id" | "chat_id">) {
|
|
348
|
+
return this.api.call<t.Message>("sendSticker", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
293
349
|
}
|
|
294
350
|
/** Use this method to send rich messages. If the message contains a block with a media element, then the bot must have the right to send the media to the chat. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
295
|
-
sendRichMessage(params: Omit<t.SendRichMessageParams, "chat_id">) {
|
|
296
|
-
return this.api.call<t.Message>("sendRichMessage", { chat_id: this.chat.id, ...params });
|
|
351
|
+
sendRichMessage(params: Omit<t.SendRichMessageParams, "business_connection_id" | "chat_id">) {
|
|
352
|
+
return this.api.call<t.Message>("sendRichMessage", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
297
353
|
}
|
|
298
354
|
/** Use this method to stream a partial rich message to a user while the message is being generated. Note that the streamed draft is ephemeral and acts as a temporary 30-second preview - once the output is finalized, you **must** call [sendRichMessage](https://core.telegram.org/bots/api/#sendrichmessage) with the complete message to persist it in the user's chat. Returns *True* on success. */
|
|
299
355
|
sendRichMessageDraft(params: Omit<t.SendRichMessageDraftParams, "chat_id">) {
|
|
@@ -303,8 +359,12 @@ export class DeletedBusinessMessagesContext {
|
|
|
303
359
|
sendInvoice(params: Omit<t.SendInvoiceParams, "chat_id">) {
|
|
304
360
|
return this.api.call<t.Message>("sendInvoice", { chat_id: this.chat.id, ...params });
|
|
305
361
|
}
|
|
362
|
+
/** Use this method to create a link for an invoice. Returns the created invoice link as *String* on success. */
|
|
363
|
+
createInvoiceLink(params: Omit<t.CreateInvoiceLinkParams, "business_connection_id">) {
|
|
364
|
+
return this.api.call<string>("createInvoiceLink", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), ...params });
|
|
365
|
+
}
|
|
306
366
|
/** Use this method to send a game. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
|
|
307
|
-
sendGame(params: Omit<t.SendGameParams, "chat_id">) {
|
|
308
|
-
return this.api.call<t.Message>("sendGame", { chat_id: this.chat.id, ...params });
|
|
367
|
+
sendGame(params: Omit<t.SendGameParams, "business_connection_id" | "chat_id">) {
|
|
368
|
+
return this.api.call<t.Message>("sendGame", { ...((this.business_connection_id) === undefined ? {} : { business_connection_id: this.business_connection_id }), chat_id: this.chat.id, ...params });
|
|
309
369
|
}
|
|
310
370
|
}
|