@yaebal/contexts 0.0.2 → 0.0.4

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.
Files changed (143) hide show
  1. package/lib/generated/business-connection.d.ts +2 -2
  2. package/lib/generated/business-connection.js +2 -2
  3. package/lib/generated/business-message.d.ts +77 -33
  4. package/lib/generated/business-message.d.ts.map +1 -1
  5. package/lib/generated/business-message.js +130 -42
  6. package/lib/generated/business-message.js.map +1 -1
  7. package/lib/generated/callback-query.d.ts +73 -29
  8. package/lib/generated/callback-query.d.ts.map +1 -1
  9. package/lib/generated/callback-query.js +126 -38
  10. package/lib/generated/callback-query.js.map +1 -1
  11. package/lib/generated/channel-post.d.ts +77 -33
  12. package/lib/generated/channel-post.d.ts.map +1 -1
  13. package/lib/generated/channel-post.js +130 -42
  14. package/lib/generated/channel-post.js.map +1 -1
  15. package/lib/generated/chat-boost.d.ts +34 -20
  16. package/lib/generated/chat-boost.d.ts.map +1 -1
  17. package/lib/generated/chat-boost.js +51 -23
  18. package/lib/generated/chat-boost.js.map +1 -1
  19. package/lib/generated/chat-join-request.d.ts +63 -29
  20. package/lib/generated/chat-join-request.d.ts.map +1 -1
  21. package/lib/generated/chat-join-request.js +106 -38
  22. package/lib/generated/chat-join-request.js.map +1 -1
  23. package/lib/generated/chat-member.d.ts +63 -29
  24. package/lib/generated/chat-member.d.ts.map +1 -1
  25. package/lib/generated/chat-member.js +106 -38
  26. package/lib/generated/chat-member.js.map +1 -1
  27. package/lib/generated/chosen-inline-result.d.ts +29 -11
  28. package/lib/generated/chosen-inline-result.d.ts.map +1 -1
  29. package/lib/generated/chosen-inline-result.js +54 -18
  30. package/lib/generated/chosen-inline-result.js.map +1 -1
  31. package/lib/generated/deleted-business-messages.d.ts +34 -20
  32. package/lib/generated/deleted-business-messages.d.ts.map +1 -1
  33. package/lib/generated/deleted-business-messages.js +51 -23
  34. package/lib/generated/deleted-business-messages.js.map +1 -1
  35. package/lib/generated/edited-business-message.d.ts +77 -33
  36. package/lib/generated/edited-business-message.d.ts.map +1 -1
  37. package/lib/generated/edited-business-message.js +130 -42
  38. package/lib/generated/edited-business-message.js.map +1 -1
  39. package/lib/generated/edited-channel-post.d.ts +77 -33
  40. package/lib/generated/edited-channel-post.d.ts.map +1 -1
  41. package/lib/generated/edited-channel-post.js +130 -42
  42. package/lib/generated/edited-channel-post.js.map +1 -1
  43. package/lib/generated/edited-message.d.ts +77 -33
  44. package/lib/generated/edited-message.d.ts.map +1 -1
  45. package/lib/generated/edited-message.js +130 -42
  46. package/lib/generated/edited-message.js.map +1 -1
  47. package/lib/generated/guest-message.d.ts +254 -0
  48. package/lib/generated/guest-message.d.ts.map +1 -0
  49. package/lib/generated/guest-message.js +498 -0
  50. package/lib/generated/guest-message.js.map +1 -0
  51. package/lib/generated/index.d.ts +9 -2
  52. package/lib/generated/index.d.ts.map +1 -1
  53. package/lib/generated/index.js +8 -1
  54. package/lib/generated/index.js.map +1 -1
  55. package/lib/generated/inline-query.d.ts +30 -12
  56. package/lib/generated/inline-query.d.ts.map +1 -1
  57. package/lib/generated/inline-query.js +56 -20
  58. package/lib/generated/inline-query.js.map +1 -1
  59. package/lib/generated/managed-bot.d.ts +14 -0
  60. package/lib/generated/managed-bot.d.ts.map +1 -0
  61. package/lib/generated/managed-bot.js +18 -0
  62. package/lib/generated/managed-bot.js.map +1 -0
  63. package/lib/generated/message-reaction-count.d.ts +47 -23
  64. package/lib/generated/message-reaction-count.d.ts.map +1 -1
  65. package/lib/generated/message-reaction-count.js +74 -26
  66. package/lib/generated/message-reaction-count.js.map +1 -1
  67. package/lib/generated/message-reaction.d.ts +49 -25
  68. package/lib/generated/message-reaction.d.ts.map +1 -1
  69. package/lib/generated/message-reaction.js +76 -28
  70. package/lib/generated/message-reaction.js.map +1 -1
  71. package/lib/generated/message.d.ts +77 -33
  72. package/lib/generated/message.d.ts.map +1 -1
  73. package/lib/generated/message.js +130 -42
  74. package/lib/generated/message.js.map +1 -1
  75. package/lib/generated/my-chat-member.d.ts +63 -29
  76. package/lib/generated/my-chat-member.d.ts.map +1 -1
  77. package/lib/generated/my-chat-member.js +106 -38
  78. package/lib/generated/my-chat-member.js.map +1 -1
  79. package/lib/generated/poll-answer.d.ts +2 -2
  80. package/lib/generated/poll-answer.js +2 -2
  81. package/lib/generated/pre-checkout-query.d.ts +29 -11
  82. package/lib/generated/pre-checkout-query.d.ts.map +1 -1
  83. package/lib/generated/pre-checkout-query.js +54 -18
  84. package/lib/generated/pre-checkout-query.js.map +1 -1
  85. package/lib/generated/purchased-paid-media.d.ts +29 -11
  86. package/lib/generated/purchased-paid-media.d.ts.map +1 -1
  87. package/lib/generated/purchased-paid-media.js +54 -18
  88. package/lib/generated/purchased-paid-media.js.map +1 -1
  89. package/lib/generated/removed-chat-boost.d.ts +34 -20
  90. package/lib/generated/removed-chat-boost.d.ts.map +1 -1
  91. package/lib/generated/removed-chat-boost.js +51 -23
  92. package/lib/generated/removed-chat-boost.js.map +1 -1
  93. package/lib/generated/shipping-query.d.ts +29 -11
  94. package/lib/generated/shipping-query.d.ts.map +1 -1
  95. package/lib/generated/shipping-query.js +54 -18
  96. package/lib/generated/shipping-query.js.map +1 -1
  97. package/lib/index.test.js +32 -1
  98. package/lib/index.test.js.map +1 -1
  99. package/lib/sugar/business-message.d.ts +5 -0
  100. package/lib/sugar/business-message.d.ts.map +1 -1
  101. package/lib/sugar/channel-post.d.ts +5 -0
  102. package/lib/sugar/channel-post.d.ts.map +1 -1
  103. package/lib/sugar/edited-business-message.d.ts +5 -0
  104. package/lib/sugar/edited-business-message.d.ts.map +1 -1
  105. package/lib/sugar/edited-channel-post.d.ts +5 -0
  106. package/lib/sugar/edited-channel-post.d.ts.map +1 -1
  107. package/lib/sugar/edited-message.d.ts +5 -0
  108. package/lib/sugar/edited-message.d.ts.map +1 -1
  109. package/lib/sugar/guest-message.d.ts +13 -0
  110. package/lib/sugar/guest-message.d.ts.map +1 -0
  111. package/lib/sugar/guest-message.js +13 -0
  112. package/lib/sugar/guest-message.js.map +1 -0
  113. package/lib/sugar/message.d.ts +5 -0
  114. package/lib/sugar/message.d.ts.map +1 -1
  115. package/package.json +3 -3
  116. package/src/generated/business-connection.ts +3 -3
  117. package/src/generated/business-message.ts +132 -44
  118. package/src/generated/callback-query.ts +128 -40
  119. package/src/generated/channel-post.ts +132 -44
  120. package/src/generated/chat-boost.ts +53 -25
  121. package/src/generated/chat-join-request.ts +108 -40
  122. package/src/generated/chat-member.ts +108 -40
  123. package/src/generated/chosen-inline-result.ts +55 -19
  124. package/src/generated/deleted-business-messages.ts +53 -25
  125. package/src/generated/edited-business-message.ts +132 -44
  126. package/src/generated/edited-channel-post.ts +132 -44
  127. package/src/generated/edited-message.ts +132 -44
  128. package/src/generated/guest-message.ts +502 -0
  129. package/src/generated/index.ts +12 -3
  130. package/src/generated/inline-query.ts +57 -21
  131. package/src/generated/managed-bot.ts +22 -0
  132. package/src/generated/message-reaction-count.ts +76 -28
  133. package/src/generated/message-reaction.ts +78 -30
  134. package/src/generated/message.ts +132 -44
  135. package/src/generated/my-chat-member.ts +108 -40
  136. package/src/generated/poll-answer.ts +3 -3
  137. package/src/generated/poll.ts +1 -1
  138. package/src/generated/pre-checkout-query.ts +55 -19
  139. package/src/generated/purchased-paid-media.ts +55 -19
  140. package/src/generated/removed-chat-boost.ts +53 -25
  141. package/src/generated/shipping-query.ts +55 -19
  142. package/src/index.test.ts +34 -0
  143. package/src/sugar/guest-message.ts +20 -0
@@ -1,4 +1,4 @@
1
- // AUTO-GENERATED — do not edit by hand. Regenerate: pnpm --filter @yaebal/contexts generate
1
+ // AUTO-GENERATED — do not edit by hand. regenerate: pnpm --filter @yaebal/contexts generate
2
2
  import type { Api } from "@yaebal/core";
3
3
  import type * as t from "@yaebal/types";
4
4
 
@@ -11,11 +11,11 @@ export class CallbackQueryContextBase {
11
11
  this.update = update;
12
12
  Object.assign(this, update.callback_query ?? {});
13
13
  }
14
- /** Id of the user this update is from. */
14
+ /** id of the user this update is from. */
15
15
  get senderId(): number {
16
16
  return this.from.id;
17
17
  }
18
- /** First name of the user this update is from. */
18
+ /** first name of the user this update is from. */
19
19
  get firstName(): string | undefined {
20
20
  return this.from.first_name;
21
21
  }
@@ -27,6 +27,10 @@ export class CallbackQueryContextBase {
27
27
  sendPhoto(params: Omit<t.SendPhotoParams, "chat_id">) {
28
28
  return this.api.call<t.Message>("sendPhoto", { chat_id: this.message?.chat.id, ...params });
29
29
  }
30
+ /** Use this method to send live photos. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
31
+ sendLivePhoto(params: Omit<t.SendLivePhotoParams, "chat_id">) {
32
+ return this.api.call<t.Message>("sendLivePhoto", { chat_id: this.message?.chat.id, ...params });
33
+ }
30
34
  /** 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. */
31
35
  sendAudio(params: Omit<t.SendAudioParams, "chat_id">) {
32
36
  return this.api.call<t.Message>("sendAudio", { chat_id: this.message?.chat.id, ...params });
@@ -55,7 +59,7 @@ export class CallbackQueryContextBase {
55
59
  sendPaidMedia(params: Omit<t.SendPaidMediaParams, "chat_id">) {
56
60
  return this.api.call<t.Message>("sendPaidMedia", { chat_id: this.message?.chat.id, ...params });
57
61
  }
58
- /** 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](https://core.telegram.org/bots/api/#message) that were sent is returned. */
62
+ /** 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. */
59
63
  sendMediaGroup(params: Omit<t.SendMediaGroupParams, "chat_id">) {
60
64
  return this.api.call<t.Message[]>("sendMediaGroup", { chat_id: this.message?.chat.id, ...params });
61
65
  }
@@ -75,10 +79,18 @@ export class CallbackQueryContextBase {
75
79
  sendPoll(params: Omit<t.SendPollParams, "chat_id">) {
76
80
  return this.api.call<t.Message>("sendPoll", { chat_id: this.message?.chat.id, ...params });
77
81
  }
82
+ /** 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. */
83
+ sendChecklist(params: Omit<t.SendChecklistParams, "chat_id">) {
84
+ return this.api.call<t.Message>("sendChecklist", { chat_id: this.message?.chat.id, ...params });
85
+ }
78
86
  /** 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. */
79
87
  sendDice(params: Omit<t.SendDiceParams, "chat_id">) {
80
88
  return this.api.call<t.Message>("sendDice", { chat_id: this.message?.chat.id, ...params });
81
89
  }
90
+ /** 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. */
91
+ sendMessageDraft(params: Omit<t.SendMessageDraftParams, "chat_id">) {
92
+ return this.api.call<boolean>("sendMessageDraft", { chat_id: this.message?.chat.id, ...params });
93
+ }
82
94
  /** 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. */
83
95
  sendChatAction(params: Omit<t.SendChatActionParams, "chat_id">) {
84
96
  return this.api.call<boolean>("sendChatAction", { chat_id: this.message?.chat.id, ...params });
@@ -91,7 +103,11 @@ export class CallbackQueryContextBase {
91
103
  getUserProfilePhotos(params: Omit<t.GetUserProfilePhotosParams, "user_id">) {
92
104
  return this.api.call<t.UserProfilePhotos>("getUserProfilePhotos", { user_id: this.from.id, ...params });
93
105
  }
94
- /** Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method [requestEmojiStatusAccess](https://core.telegram.org/bots/webapps#initializing-mini-apps). Returns *True* on success. */
106
+ /** Use this method to get a list of profile audios for a user. Returns a [UserProfileAudios](https://core.telegram.org/bots/api/#userprofileaudios) object. */
107
+ getUserProfileAudios(params: Omit<t.GetUserProfileAudiosParams, "user_id">) {
108
+ return this.api.call<t.UserProfileAudios>("getUserProfileAudios", { user_id: this.from.id, ...params });
109
+ }
110
+ /** Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method [requestEmojiStatusAccess](/bots/webapps#initializing-mini-apps). Returns *True* on success. */
95
111
  setUserEmojiStatus(params: Omit<t.SetUserEmojiStatusParams, "user_id">) {
96
112
  return this.api.call<boolean>("setUserEmojiStatus", { user_id: this.from.id, ...params });
97
113
  }
@@ -115,6 +131,10 @@ export class CallbackQueryContextBase {
115
131
  setChatAdministratorCustomTitle(params: Omit<t.SetChatAdministratorCustomTitleParams, "chat_id" | "user_id">) {
116
132
  return this.api.call<boolean>("setChatAdministratorCustomTitle", { chat_id: this.message?.chat.id, user_id: this.from.id, ...params });
117
133
  }
134
+ /** Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the *can\_manage\_tags* administrator right. Returns *True* on success. */
135
+ setChatMemberTag(params: Omit<t.SetChatMemberTagParams, "chat_id" | "user_id">) {
136
+ return this.api.call<boolean>("setChatMemberTag", { chat_id: this.message?.chat.id, user_id: this.from.id, ...params });
137
+ }
118
138
  /** 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. */
119
139
  banChatSenderChat(params: Omit<t.BanChatSenderChatParams, "chat_id">) {
120
140
  return this.api.call<boolean>("banChatSenderChat", { chat_id: this.message?.chat.id, ...params });
@@ -175,15 +195,15 @@ export class CallbackQueryContextBase {
175
195
  setChatDescription(params: Omit<t.SetChatDescriptionParams, "chat_id">) {
176
196
  return this.api.call<boolean>("setChatDescription", { chat_id: this.message?.chat.id, ...params });
177
197
  }
178
- /** Use this method to add a message to 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. */
198
+ /** Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns *True* on success. */
179
199
  pin(params: Omit<t.PinChatMessageParams, "chat_id" | "message_id">) {
180
200
  return this.api.call<boolean>("pinChatMessage", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
181
201
  }
182
- /** 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. */
202
+ /** 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. */
183
203
  unpin(params: Omit<t.UnpinChatMessageParams, "chat_id" | "message_id">) {
184
204
  return this.api.call<boolean>("unpinChatMessage", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
185
205
  }
186
- /** Use this method to clear 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. */
206
+ /** 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. */
187
207
  unpinAllChatMessages(params?: Omit<t.UnpinAllChatMessagesParams, "chat_id">) {
188
208
  return this.api.call<boolean>("unpinAllChatMessages", { chat_id: this.message?.chat.id, ...params });
189
209
  }
@@ -195,8 +215,8 @@ export class CallbackQueryContextBase {
195
215
  getChat(params?: Omit<t.GetChatParams, "chat_id">) {
196
216
  return this.api.call<t.ChatFullInfo>("getChat", { chat_id: this.message?.chat.id, ...params });
197
217
  }
198
- /** Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of [ChatMember](https://core.telegram.org/bots/api/#chatmember) objects. */
199
- getChatAdministrators(params?: Omit<t.GetChatAdministratorsParams, "chat_id">) {
218
+ /** Use this method to get a list of administrators in a chat. Returns an Array of [ChatMember](https://core.telegram.org/bots/api/#chatmember) objects. */
219
+ getChatAdministrators(params: Omit<t.GetChatAdministratorsParams, "chat_id">) {
200
220
  return this.api.call<t.ChatMember[]>("getChatAdministrators", { chat_id: this.message?.chat.id, ...params });
201
221
  }
202
222
  /** Use this method to get the number of members in a chat. Returns *Int* on success. */
@@ -207,6 +227,10 @@ export class CallbackQueryContextBase {
207
227
  getChatMember(params?: Omit<t.GetChatMemberParams, "chat_id" | "user_id">) {
208
228
  return this.api.call<t.ChatMember>("getChatMember", { chat_id: this.message?.chat.id, user_id: this.from.id, ...params });
209
229
  }
230
+ /** Use this method to get the last messages from the personal chat (i.e., the chat currently added to their profile) of a given user. On success, an array of [Message](https://core.telegram.org/bots/api/#message) objects is returned. */
231
+ getUserPersonalChatMessages(params: Omit<t.GetUserPersonalChatMessagesParams, "user_id">) {
232
+ return this.api.call<t.Message[]>("getUserPersonalChatMessages", { user_id: this.from.id, ...params });
233
+ }
210
234
  /** Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field *can\_set\_sticker\_set* optionally returned in [getChat](https://core.telegram.org/bots/api/#getchat) requests to check if the bot can use this method. Returns *True* on success. */
211
235
  setChatStickerSet(params: Omit<t.SetChatStickerSetParams, "chat_id">) {
212
236
  return this.api.call<boolean>("setChatStickerSet", { chat_id: this.message?.chat.id, ...params });
@@ -215,11 +239,11 @@ export class CallbackQueryContextBase {
215
239
  deleteChatStickerSet(params?: Omit<t.DeleteChatStickerSetParams, "chat_id">) {
216
240
  return this.api.call<boolean>("deleteChatStickerSet", { chat_id: this.message?.chat.id, ...params });
217
241
  }
218
- /** Use this method to create a 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 information about the created topic as a [ForumTopic](https://core.telegram.org/bots/api/#forumtopic) object. */
242
+ /** Use this method to create 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 right. Returns information about the created topic as a [ForumTopic](https://core.telegram.org/bots/api/#forumtopic) object. */
219
243
  createForumTopic(params: Omit<t.CreateForumTopicParams, "chat_id">) {
220
244
  return this.api.call<t.ForumTopic>("createForumTopic", { chat_id: this.message?.chat.id, ...params });
221
245
  }
222
- /** Use this method to edit name and icon of a 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. */
246
+ /** 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. */
223
247
  editForumTopic(params: Omit<t.EditForumTopicParams, "chat_id">) {
224
248
  return this.api.call<boolean>("editForumTopic", { chat_id: this.message?.chat.id, ...params });
225
249
  }
@@ -231,11 +255,11 @@ export class CallbackQueryContextBase {
231
255
  reopenForumTopic(params: Omit<t.ReopenForumTopicParams, "chat_id">) {
232
256
  return this.api.call<boolean>("reopenForumTopic", { chat_id: this.message?.chat.id, ...params });
233
257
  }
234
- /** Use this method to delete a forum topic along with all its messages in a forum 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. */
258
+ /** 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. */
235
259
  deleteForumTopic(params: Omit<t.DeleteForumTopicParams, "chat_id">) {
236
260
  return this.api.call<boolean>("deleteForumTopic", { chat_id: this.message?.chat.id, ...params });
237
261
  }
238
- /** Use this method to clear the list of pinned messages in a forum topic. 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. */
262
+ /** 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. */
239
263
  unpinAllForumTopicMessages(params: Omit<t.UnpinAllForumTopicMessagesParams, "chat_id">) {
240
264
  return this.api.call<boolean>("unpinAllForumTopicMessages", { chat_id: this.message?.chat.id, ...params });
241
265
  }
@@ -263,7 +287,7 @@ export class CallbackQueryContextBase {
263
287
  unpinAllGeneralForumTopicMessages(params?: Omit<t.UnpinAllGeneralForumTopicMessagesParams, "chat_id">) {
264
288
  return this.api.call<boolean>("unpinAllGeneralForumTopicMessages", { chat_id: this.message?.chat.id, ...params });
265
289
  }
266
- /** Use this method to send answers to callback queries sent from [inline keyboards](https://core.telegram.org/bots/features#inline-keyboards). The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, *True* is returned. Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via [@BotFather](https://t.me/botfather) and accept the terms. Otherwise, you may use links like `t.me/your_bot?start=XXXX` that open your bot with a parameter. */
290
+ /** Use this method to send answers to callback queries sent from [inline keyboards](/bots/features#inline-keyboards). The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, *True* is returned. Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via [@BotFather](https://t.me/botfather) and accept the terms. Otherwise, you may use links like `t.me/your_bot?start=XXXX` that open your bot with a parameter. */
267
291
  answer(params: Omit<t.AnswerCallbackQueryParams, "callback_query_id">) {
268
292
  return this.api.call<boolean>("answerCallbackQuery", { callback_query_id: this.id, ...params });
269
293
  }
@@ -271,6 +295,22 @@ export class CallbackQueryContextBase {
271
295
  getUserChatBoosts(params?: Omit<t.GetUserChatBoostsParams, "chat_id" | "user_id">) {
272
296
  return this.api.call<t.UserChatBoosts>("getUserChatBoosts", { chat_id: this.message?.chat.id, user_id: this.from.id, ...params });
273
297
  }
298
+ /** Use this method to get the token of a managed bot. Returns the token as *String* on success. */
299
+ getManagedBotToken(params?: Omit<t.GetManagedBotTokenParams, "user_id">) {
300
+ return this.api.call<string>("getManagedBotToken", { user_id: this.from.id, ...params });
301
+ }
302
+ /** Use this method to revoke the current token of a managed bot and generate a new one. Returns the new token as *String* on success. */
303
+ replaceManagedBotToken(params?: Omit<t.ReplaceManagedBotTokenParams, "user_id">) {
304
+ return this.api.call<string>("replaceManagedBotToken", { user_id: this.from.id, ...params });
305
+ }
306
+ /** Use this method to get the access settings of a managed bot. Returns a [BotAccessSettings](https://core.telegram.org/bots/api/#botaccesssettings) object on success. */
307
+ getManagedBotAccessSettings(params?: Omit<t.GetManagedBotAccessSettingsParams, "user_id">) {
308
+ return this.api.call<t.BotAccessSettings>("getManagedBotAccessSettings", { user_id: this.from.id, ...params });
309
+ }
310
+ /** Use this method to change the access settings of a managed bot. Returns *True* on success. */
311
+ setManagedBotAccessSettings(params: Omit<t.SetManagedBotAccessSettingsParams, "user_id">) {
312
+ return this.api.call<boolean>("setManagedBotAccessSettings", { user_id: this.from.id, ...params });
313
+ }
274
314
  /** Use this method to change the bot's menu button in a private chat, or the default menu button. Returns *True* on success. */
275
315
  setChatMenuButton(params: Omit<t.SetChatMenuButtonParams, "chat_id">) {
276
316
  return this.api.call<boolean>("setChatMenuButton", { chat_id: this.message?.chat.id, ...params });
@@ -279,7 +319,51 @@ export class CallbackQueryContextBase {
279
319
  getChatMenuButton(params?: Omit<t.GetChatMenuButtonParams, "chat_id">) {
280
320
  return this.api.call<t.MenuButton>("getChatMenuButton", { chat_id: this.message?.chat.id, ...params });
281
321
  }
282
- /** Use this method to edit text 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. */
322
+ /** Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns *True* on success. */
323
+ sendGift(params: Omit<t.SendGiftParams, "user_id" | "chat_id">) {
324
+ return this.api.call<boolean>("sendGift", { user_id: this.from.id, chat_id: this.message?.chat.id, ...params });
325
+ }
326
+ /** Gifts a Telegram Premium subscription to the given user. Returns *True* on success. */
327
+ giftPremiumSubscription(params: Omit<t.GiftPremiumSubscriptionParams, "user_id">) {
328
+ return this.api.call<boolean>("giftPremiumSubscription", { user_id: this.from.id, ...params });
329
+ }
330
+ /** Verifies a user [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot. Returns *True* on success. */
331
+ verifyUser(params: Omit<t.VerifyUserParams, "user_id">) {
332
+ return this.api.call<boolean>("verifyUser", { user_id: this.from.id, ...params });
333
+ }
334
+ /** Verifies a chat [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot. Returns *True* on success. */
335
+ verifyChat(params: Omit<t.VerifyChatParams, "chat_id">) {
336
+ return this.api.call<boolean>("verifyChat", { chat_id: this.message?.chat.id, ...params });
337
+ }
338
+ /** Removes verification from a user who is currently verified [on behalf of the organization](https://telegram.org/verify#third-party-verification) represented by the bot. Returns *True* on success. */
339
+ removeUserVerification(params?: Omit<t.RemoveUserVerificationParams, "user_id">) {
340
+ return this.api.call<boolean>("removeUserVerification", { user_id: this.from.id, ...params });
341
+ }
342
+ /** Removes verification from a chat that is currently verified [on behalf of the organization](https://telegram.org/verify#third-party-verification) represented by the bot. Returns *True* on success. */
343
+ removeChatVerification(params?: Omit<t.RemoveChatVerificationParams, "chat_id">) {
344
+ return this.api.call<boolean>("removeChatVerification", { chat_id: this.message?.chat.id, ...params });
345
+ }
346
+ /** Marks incoming message as read on behalf of a business account. Requires the *can\_read\_messages* business bot right. Returns *True* on success. */
347
+ readBusinessMessage(params: Omit<t.ReadBusinessMessageParams, "chat_id" | "message_id">) {
348
+ return this.api.call<boolean>("readBusinessMessage", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
349
+ }
350
+ /** Returns the gifts owned and hosted by a user. Returns [OwnedGifts](https://core.telegram.org/bots/api/#ownedgifts) on success. */
351
+ getUserGifts(params: Omit<t.GetUserGiftsParams, "user_id">) {
352
+ return this.api.call<t.OwnedGifts>("getUserGifts", { user_id: this.from.id, ...params });
353
+ }
354
+ /** Returns the gifts owned by a chat. Returns [OwnedGifts](https://core.telegram.org/bots/api/#ownedgifts) on success. */
355
+ getChatGifts(params: Omit<t.GetChatGiftsParams, "chat_id">) {
356
+ return this.api.call<t.OwnedGifts>("getChatGifts", { chat_id: this.message?.chat.id, ...params });
357
+ }
358
+ /** Stores a message that can be sent by a user of a Mini App. Returns a [PreparedInlineMessage](https://core.telegram.org/bots/api/#preparedinlinemessage) object. */
359
+ savePreparedInlineMessage(params: Omit<t.SavePreparedInlineMessageParams, "user_id">) {
360
+ return this.api.call<t.PreparedInlineMessage>("savePreparedInlineMessage", { user_id: this.from.id, ...params });
361
+ }
362
+ /** Stores a keyboard button that can be used by a user within a Mini App. Returns a [PreparedKeyboardButton](https://core.telegram.org/bots/api/#preparedkeyboardbutton) object. */
363
+ savePreparedKeyboardButton(params: Omit<t.SavePreparedKeyboardButtonParams, "user_id">) {
364
+ return this.api.call<t.PreparedKeyboardButton>("savePreparedKeyboardButton", { user_id: this.from.id, ...params });
365
+ }
366
+ /** 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. */
283
367
  editText(params: Omit<t.EditMessageTextParams, "chat_id" | "message_id">) {
284
368
  return this.api.call<t.Message | boolean>("editMessageText", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
285
369
  }
@@ -287,7 +371,7 @@ export class CallbackQueryContextBase {
287
371
  editCaption(params: Omit<t.EditMessageCaptionParams, "chat_id" | "message_id">) {
288
372
  return this.api.call<t.Message | boolean>("editMessageCaption", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
289
373
  }
290
- /** Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. 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 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. */
374
+ /** 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. */
291
375
  editMedia(params: Omit<t.EditMessageMediaParams, "chat_id" | "message_id">) {
292
376
  return this.api.call<t.Message | boolean>("editMessageMedia", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
293
377
  }
@@ -299,6 +383,10 @@ export class CallbackQueryContextBase {
299
383
  stopMessageLiveLocation(params: Omit<t.StopMessageLiveLocationParams, "chat_id" | "message_id">) {
300
384
  return this.api.call<t.Message | boolean>("stopMessageLiveLocation", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
301
385
  }
386
+ /** Use this method to edit a checklist on behalf of a connected business account. On success, the edited [Message](https://core.telegram.org/bots/api/#message) is returned. */
387
+ editMessageChecklist(params: Omit<t.EditMessageChecklistParams, "chat_id" | "message_id">) {
388
+ return this.api.call<t.Message>("editMessageChecklist", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
389
+ }
302
390
  /** 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. */
303
391
  editReplyMarkup(params: Omit<t.EditMessageReplyMarkupParams, "chat_id" | "message_id">) {
304
392
  return this.api.call<t.Message | boolean>("editMessageReplyMarkup", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
@@ -307,7 +395,15 @@ export class CallbackQueryContextBase {
307
395
  stopPoll(params: Omit<t.StopPollParams, "chat_id" | "message_id">) {
308
396
  return this.api.call<t.Poll>("stopPoll", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
309
397
  }
310
- /** Use this method to delete a message, including service messages, with the following limitations: \- A message can only be deleted if it was sent less than 48 hours ago. \- Service messages about a supergroup, channel, or forum topic creation can't be deleted. \- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago. \- Bots can delete outgoing messages in private chats, groups, and supergroups. \- Bots can delete incoming messages in private chats. \- Bots granted *can\_post\_messages* permissions can delete outgoing messages in channels. \- If the bot is an administrator of a group, it can delete any message there. \- If the bot has *can\_delete\_messages* permission in a supergroup or a channel, it can delete any message there. Returns *True* on success. */
398
+ /** Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns *True* on success. */
399
+ approveSuggestedPost(params: Omit<t.ApproveSuggestedPostParams, "chat_id" | "message_id">) {
400
+ return this.api.call<boolean>("approveSuggestedPost", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
401
+ }
402
+ /** Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns *True* on success. */
403
+ declineSuggestedPost(params: Omit<t.DeclineSuggestedPostParams, "chat_id" | "message_id">) {
404
+ return this.api.call<boolean>("declineSuggestedPost", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
405
+ }
406
+ /** Use this method to delete a message, including service messages, with the following limitations: - A message can only be deleted if it was sent less than 48 hours ago. - Service messages about a supergroup, channel, or forum topic creation can't be deleted. - A dice message in a private chat can only be deleted if it was sent more than 24 hours ago. - Bots can delete outgoing messages in private chats, groups, and supergroups. - Bots can delete incoming messages in private chats. - Bots granted *can\_post\_messages* permissions can delete outgoing messages in channels. - If the bot is an administrator of a group, it can delete any message there. - If the bot has *can\_delete\_messages* administrator right in a supergroup or a channel, it can delete any message there. - If the bot has *can\_manage\_direct\_messages* administrator right in a channel, it can delete any message in the corresponding direct messages chat. Returns *True* on success. */
311
407
  delete(params?: Omit<t.DeleteMessageParams, "chat_id" | "message_id">) {
312
408
  return this.api.call<boolean>("deleteMessage", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, ...params });
313
409
  }
@@ -315,6 +411,14 @@ export class CallbackQueryContextBase {
315
411
  deleteMessages(params: Omit<t.DeleteMessagesParams, "chat_id">) {
316
412
  return this.api.call<boolean>("deleteMessages", { chat_id: this.message?.chat.id, ...params });
317
413
  }
414
+ /** Use this method to remove a reaction from a message in a group or a supergroup chat. The bot must have the 'can_delete_messages' administrator right in the chat. Returns *True* on success. */
415
+ deleteMessageReaction(params: Omit<t.DeleteMessageReactionParams, "chat_id" | "message_id" | "user_id">) {
416
+ return this.api.call<boolean>("deleteMessageReaction", { chat_id: this.message?.chat.id, message_id: this.message?.message_id, user_id: this.from.id, ...params });
417
+ }
418
+ /** Use this method to remove up to 10000 recent reactions in a group or a supergroup chat added by a given user or chat. The bot must have the 'can_delete_messages' administrator right in the chat. Returns *True* on success. */
419
+ deleteAllMessageReactions(params: Omit<t.DeleteAllMessageReactionsParams, "chat_id" | "user_id">) {
420
+ return this.api.call<boolean>("deleteAllMessageReactions", { chat_id: this.message?.chat.id, user_id: this.from.id, ...params });
421
+ }
318
422
  /** 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. */
319
423
  sendSticker(params: Omit<t.SendStickerParams, "chat_id">) {
320
424
  return this.api.call<t.Message>("sendSticker", { chat_id: this.message?.chat.id, ...params });
@@ -339,29 +443,13 @@ export class CallbackQueryContextBase {
339
443
  setStickerSetThumbnail(params: Omit<t.SetStickerSetThumbnailParams, "user_id">) {
340
444
  return this.api.call<boolean>("setStickerSetThumbnail", { user_id: this.from.id, ...params });
341
445
  }
342
- /** Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns *True* on success. */
343
- sendGift(params: Omit<t.SendGiftParams, "user_id" | "chat_id">) {
344
- return this.api.call<boolean>("sendGift", { user_id: this.from.id, chat_id: this.message?.chat.id, ...params });
446
+ /** 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. */
447
+ sendRichMessage(params: Omit<t.SendRichMessageParams, "chat_id">) {
448
+ return this.api.call<t.Message>("sendRichMessage", { chat_id: this.message?.chat.id, ...params });
345
449
  }
346
- /** Verifies a user [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot. Returns *True* on success. */
347
- verifyUser(params: Omit<t.VerifyUserParams, "user_id">) {
348
- return this.api.call<boolean>("verifyUser", { user_id: this.from.id, ...params });
349
- }
350
- /** Verifies a chat [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot. Returns *True* on success. */
351
- verifyChat(params: Omit<t.VerifyChatParams, "chat_id">) {
352
- return this.api.call<boolean>("verifyChat", { chat_id: this.message?.chat.id, ...params });
353
- }
354
- /** Removes verification from a user who is currently verified [on behalf of the organization](https://telegram.org/verify#third-party-verification) represented by the bot. Returns *True* on success. */
355
- removeUserVerification(params?: Omit<t.RemoveUserVerificationParams, "user_id">) {
356
- return this.api.call<boolean>("removeUserVerification", { user_id: this.from.id, ...params });
357
- }
358
- /** Removes verification from a chat that is currently verified [on behalf of the organization](https://telegram.org/verify#third-party-verification) represented by the bot. Returns *True* on success. */
359
- removeChatVerification(params?: Omit<t.RemoveChatVerificationParams, "chat_id">) {
360
- return this.api.call<boolean>("removeChatVerification", { chat_id: this.message?.chat.id, ...params });
361
- }
362
- /** Stores a message that can be sent by a user of a Mini App. Returns a [PreparedInlineMessage](https://core.telegram.org/bots/api/#preparedinlinemessage) object. */
363
- savePreparedInlineMessage(params: Omit<t.SavePreparedInlineMessageParams, "user_id">) {
364
- return this.api.call<t.PreparedInlineMessage>("savePreparedInlineMessage", { user_id: this.from.id, ...params });
450
+ /** 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. */
451
+ sendRichMessageDraft(params: Omit<t.SendRichMessageDraftParams, "chat_id">) {
452
+ return this.api.call<boolean>("sendRichMessageDraft", { chat_id: this.message?.chat.id, ...params });
365
453
  }
366
454
  /** Use this method to send invoices. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. */
367
455
  sendInvoice(params: Omit<t.SendInvoiceParams, "chat_id">) {