@mtkruto/node 0.1.132 → 0.1.134

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 (194) hide show
  1. package/esm/3_errors.d.ts +519 -510
  2. package/esm/3_errors.js +521 -509
  3. package/esm/3_types.d.ts +19 -7
  4. package/esm/3_types.js +19 -7
  5. package/esm/4_constants.d.ts +2 -2
  6. package/esm/4_constants.js +2 -2
  7. package/esm/4_errors.d.ts +7 -12
  8. package/esm/4_errors.js +6 -7
  9. package/esm/5_client.d.ts +3 -3
  10. package/esm/5_client.js +3 -3
  11. package/esm/client/0_utilities.d.ts +30 -2
  12. package/esm/client/0_utilities.js +13 -5
  13. package/esm/client/1_composer.d.ts +30 -0
  14. package/esm/client/{4_composer.js → 1_composer.js} +15 -2
  15. package/esm/client/2_client_plain.d.ts +1 -1
  16. package/esm/client/2_client_plain.js +1 -1
  17. package/esm/client/{3_types.d.ts → 3_params.d.ts} +68 -172
  18. package/esm/client/3_params.js +1 -0
  19. package/esm/client/{5_client.d.ts → 4_client.d.ts} +89 -57
  20. package/esm/client/{5_client.js → 4_client.js} +499 -308
  21. package/esm/client/5_composer.d.ts +4 -0
  22. package/esm/client/5_composer.js +3 -0
  23. package/esm/storage/0_storage.d.ts +4 -1
  24. package/esm/storage/0_storage.js +36 -7
  25. package/esm/storage/1_storage_indexed_db.d.ts +6 -2
  26. package/esm/storage/1_storage_indexed_db.js +7 -5
  27. package/esm/storage/1_storage_local_storage.d.ts +1 -1
  28. package/esm/storage/1_storage_local_storage.js +1 -1
  29. package/esm/storage/1_storage_memory.d.ts +1 -1
  30. package/esm/storage/1_storage_memory.js +1 -1
  31. package/esm/storage/1_storage_session_storage.d.ts +1 -1
  32. package/esm/storage/1_storage_session_storage.js +1 -1
  33. package/esm/tl/2_types.d.ts +313 -24
  34. package/esm/tl/2_types.js +982 -46
  35. package/esm/tl/3_functions.d.ts +95 -32
  36. package/esm/tl/3_functions.js +227 -66
  37. package/esm/tl/3_utilities.d.ts +1 -0
  38. package/esm/tl/3_utilities.js +14 -0
  39. package/esm/tl/6_message.js +1 -1
  40. package/esm/types/0_authorization_state.d.ts +5 -0
  41. package/esm/types/0_authorization_state.js +1 -0
  42. package/esm/types/0_chat_photo.d.ts +22 -21
  43. package/esm/types/0_connection_state.d.ts +17 -0
  44. package/esm/types/0_connection_state.js +1 -0
  45. package/esm/types/0_giveaway_parameters.d.ts +9 -0
  46. package/esm/types/0_giveaway_parameters.js +9 -0
  47. package/esm/types/0_login_url.d.ts +0 -4
  48. package/esm/types/0_mask_position.d.ts +0 -4
  49. package/esm/types/0_message_entity.d.ts +91 -74
  50. package/esm/types/0_message_identifier.d.ts +4 -0
  51. package/esm/types/0_message_identifier.js +1 -0
  52. package/esm/types/0_network_statistics_entry.d.ts +4 -0
  53. package/esm/types/0_network_statistics_entry.js +1 -0
  54. package/esm/types/0_reaction.d.ts +14 -10
  55. package/esm/types/0_reaction.js +29 -1
  56. package/esm/types/1__getters.d.ts +3 -0
  57. package/esm/types/1_bot_command_scope.d.ts +32 -27
  58. package/esm/types/1_chat_p.d.ts +77 -68
  59. package/esm/types/1_giveaway.d.ts +8 -0
  60. package/esm/types/1_giveaway.js +7 -0
  61. package/esm/types/1_keyboard_button.d.ts +41 -57
  62. package/esm/types/1_keyboard_button.js +3 -0
  63. package/esm/types/1_message_reaction.d.ts +14 -0
  64. package/esm/types/1_message_reaction.js +22 -0
  65. package/esm/types/1_network_statistics.d.ts +5 -0
  66. package/esm/types/1_network_statistics.js +1 -0
  67. package/esm/types/1_poll.d.ts +0 -13
  68. package/esm/types/1_reaction_count.d.ts +7 -0
  69. package/esm/types/1_reaction_count.js +6 -0
  70. package/esm/types/1_user.d.ts +2 -2
  71. package/esm/types/2_game.d.ts +0 -7
  72. package/esm/types/2_inline_keyboard_button.d.ts +36 -37
  73. package/esm/types/2_inline_query.d.ts +0 -6
  74. package/esm/types/2_message_interactions.d.ts +8 -0
  75. package/esm/types/2_message_interactions.js +1 -0
  76. package/esm/types/2_message_reaction_count.d.ts +8 -0
  77. package/esm/types/2_message_reaction_count.js +1 -0
  78. package/esm/types/2_reply_keyboard_markup.d.ts +0 -7
  79. package/esm/types/3_inline_keyboard_markup.d.ts +0 -2
  80. package/esm/types/4_message.d.ts +457 -0
  81. package/esm/types/{3_message.js → 4_message.js} +216 -129
  82. package/{script/types/4_callback_query.d.ts → esm/types/5_callback_query.d.ts} +1 -1
  83. package/esm/types/5_chat.d.ts +37 -0
  84. package/esm/types/{4_chat.js → 5_chat.js} +2 -2
  85. package/esm/types/6_update.d.ts +134 -0
  86. package/esm/types/6_update.js +1 -0
  87. package/package.json +1 -1
  88. package/script/3_errors.d.ts +519 -510
  89. package/script/3_errors.js +533 -520
  90. package/script/3_types.d.ts +19 -7
  91. package/script/3_types.js +19 -7
  92. package/script/4_constants.d.ts +2 -2
  93. package/script/4_constants.js +2 -2
  94. package/script/4_errors.d.ts +7 -12
  95. package/script/4_errors.js +5 -6
  96. package/script/5_client.d.ts +3 -3
  97. package/script/5_client.js +3 -3
  98. package/script/client/0_utilities.d.ts +30 -2
  99. package/script/client/0_utilities.js +15 -6
  100. package/script/client/1_composer.d.ts +30 -0
  101. package/script/client/{4_composer.js → 1_composer.js} +17 -4
  102. package/script/client/2_client_plain.d.ts +1 -1
  103. package/script/client/2_client_plain.js +2 -2
  104. package/script/client/{3_types.d.ts → 3_params.d.ts} +68 -172
  105. package/script/client/3_params.js +2 -0
  106. package/script/client/{5_client.d.ts → 4_client.d.ts} +89 -57
  107. package/script/client/{5_client.js → 4_client.js} +505 -314
  108. package/script/client/5_composer.d.ts +4 -0
  109. package/script/client/{6_composer.js → 5_composer.js} +2 -2
  110. package/script/storage/0_storage.d.ts +4 -1
  111. package/script/storage/0_storage.js +36 -7
  112. package/script/storage/1_storage_indexed_db.d.ts +6 -2
  113. package/script/storage/1_storage_indexed_db.js +7 -5
  114. package/script/storage/1_storage_local_storage.d.ts +1 -1
  115. package/script/storage/1_storage_local_storage.js +1 -1
  116. package/script/storage/1_storage_memory.d.ts +1 -1
  117. package/script/storage/1_storage_memory.js +1 -1
  118. package/script/storage/1_storage_session_storage.d.ts +1 -1
  119. package/script/storage/1_storage_session_storage.js +1 -1
  120. package/script/tl/2_types.d.ts +313 -24
  121. package/script/tl/2_types.js +1169 -217
  122. package/script/tl/3_functions.d.ts +95 -32
  123. package/script/tl/3_functions.js +241 -77
  124. package/script/tl/3_utilities.d.ts +1 -0
  125. package/script/tl/3_utilities.js +16 -1
  126. package/script/tl/6_message.js +1 -1
  127. package/script/types/0_authorization_state.d.ts +5 -0
  128. package/script/types/0_authorization_state.js +2 -0
  129. package/script/types/0_chat_photo.d.ts +22 -21
  130. package/script/types/0_connection_state.d.ts +17 -0
  131. package/script/types/0_connection_state.js +2 -0
  132. package/script/types/0_giveaway_parameters.d.ts +9 -0
  133. package/script/types/0_giveaway_parameters.js +13 -0
  134. package/script/types/0_login_url.d.ts +0 -4
  135. package/script/types/0_mask_position.d.ts +0 -4
  136. package/script/types/0_message_entity.d.ts +91 -74
  137. package/script/types/0_message_identifier.d.ts +4 -0
  138. package/script/types/0_message_identifier.js +2 -0
  139. package/script/types/0_network_statistics_entry.d.ts +4 -0
  140. package/script/types/0_network_statistics_entry.js +2 -0
  141. package/script/types/0_reaction.d.ts +14 -10
  142. package/script/types/0_reaction.js +33 -0
  143. package/script/types/1__getters.d.ts +3 -0
  144. package/script/types/1_bot_command_scope.d.ts +32 -27
  145. package/script/types/1_chat_p.d.ts +77 -68
  146. package/script/types/1_giveaway.d.ts +8 -0
  147. package/script/types/1_giveaway.js +11 -0
  148. package/script/types/1_keyboard_button.d.ts +41 -57
  149. package/script/types/1_keyboard_button.js +3 -0
  150. package/script/types/1_message_reaction.d.ts +14 -0
  151. package/script/types/1_message_reaction.js +26 -0
  152. package/script/types/1_network_statistics.d.ts +5 -0
  153. package/script/types/1_network_statistics.js +2 -0
  154. package/script/types/1_poll.d.ts +0 -13
  155. package/script/types/1_reaction_count.d.ts +7 -0
  156. package/script/types/1_reaction_count.js +10 -0
  157. package/script/types/1_user.d.ts +2 -2
  158. package/script/types/2_game.d.ts +0 -7
  159. package/script/types/2_inline_keyboard_button.d.ts +36 -37
  160. package/script/types/2_inline_query.d.ts +0 -6
  161. package/script/types/2_message_interactions.d.ts +8 -0
  162. package/script/types/2_message_interactions.js +2 -0
  163. package/script/types/2_message_reaction_count.d.ts +8 -0
  164. package/script/types/2_message_reaction_count.js +2 -0
  165. package/script/types/2_reply_keyboard_markup.d.ts +0 -7
  166. package/script/types/3_inline_keyboard_markup.d.ts +0 -2
  167. package/script/types/4_message.d.ts +457 -0
  168. package/script/types/{3_message.js → 4_message.js} +218 -130
  169. package/{esm/types/4_callback_query.d.ts → script/types/5_callback_query.d.ts} +1 -1
  170. package/script/types/5_chat.d.ts +37 -0
  171. package/script/types/{4_chat.js → 5_chat.js} +3 -3
  172. package/script/types/6_update.d.ts +134 -0
  173. package/script/types/6_update.js +2 -0
  174. package/esm/client/3_types.js +0 -11
  175. package/esm/client/4_composer.d.ts +0 -31
  176. package/esm/client/6_composer.d.ts +0 -4
  177. package/esm/client/6_composer.js +0 -3
  178. package/esm/types/3_message.d.ts +0 -182
  179. package/esm/types/4_chat.d.ts +0 -34
  180. package/script/client/3_types.js +0 -15
  181. package/script/client/4_composer.d.ts +0 -31
  182. package/script/client/6_composer.d.ts +0 -4
  183. package/script/types/3_message.d.ts +0 -182
  184. package/script/types/4_chat.d.ts +0 -34
  185. /package/esm/client/{1_client_abstract.d.ts → 0_client_abstract.d.ts} +0 -0
  186. /package/esm/client/{1_client_abstract.js → 0_client_abstract.js} +0 -0
  187. /package/esm/types/{0_audio.d.ts → 1_audio.d.ts} +0 -0
  188. /package/esm/types/{0_audio.js → 1_audio.js} +0 -0
  189. /package/esm/types/{4_callback_query.js → 5_callback_query.js} +0 -0
  190. /package/script/client/{1_client_abstract.d.ts → 0_client_abstract.d.ts} +0 -0
  191. /package/script/client/{1_client_abstract.js → 0_client_abstract.js} +0 -0
  192. /package/script/types/{0_audio.d.ts → 1_audio.d.ts} +0 -0
  193. /package/script/types/{0_audio.js → 1_audio.js} +0 -0
  194. /package/script/types/{4_callback_query.js → 5_callback_query.js} +0 -0
@@ -2,12 +2,21 @@ import { MaybePromise } from "../1_utilities.js";
2
2
  import { functions, ReadObject, types } from "../2_tl.js";
3
3
  import { Storage } from "../3_storage.js";
4
4
  import { DC } from "../3_transport.js";
5
- import { BotCommand, CallbackQuery, Chat, ChatAction, ChatID, Document, InlineQuery, InlineQueryResult, Message, ParseMode, Reaction, User } from "../3_types.js";
5
+ import { BotCommand, Chat, ChatAction, ChatID, ChatP, Document, InlineQueryResult, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageLocation, MessagePhoto, MessagePoll, MessageText, MessageTypes, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, NetworkStatistics, ParseMode, Reaction, Update, UpdateIntersection, UpdateMap, User } from "../3_types.js";
6
6
  import { Migrate } from "../4_errors.js";
7
- import { FileSource, With } from "./0_utilities.js";
8
- import { ClientAbstract } from "./1_client_abstract.js";
9
- import { AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, ClientParams, DeleteMessageParams, DeleteMessagesParams, DownloadParams, EditMessageParams, FilterableUpdates, FilterUpdate, ForwardMessagesParams, GetChatsParams, GetHistoryParams, GetMyCommandsParams, InvokeErrorHandler, NetworkStatistics, ReplyParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetMyCommandsParams, Update, UploadParams } from "./3_types.js";
10
- import { Composer, Middleware } from "./4_composer.js";
7
+ import { ClientAbstract } from "./0_client_abstract.js";
8
+ import { FileSource, WithUpdate } from "./0_utilities.js";
9
+ import { Composer, Middleware } from "./1_composer.js";
10
+ import { AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, ClientParams, DeleteMessageParams, DeleteMessagesParams, DownloadParams, EditMessageParams, ForwardMessagesParams, GetChatsParams, GetHistoryParams, GetMyCommandsParams, ReplyParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetMyCommandsParams, SetReactionsParams, UploadParams } from "./3_params.js";
11
+ export type NextFn<T = void> = () => Promise<T>;
12
+ export interface InvokeErrorHandler<C> {
13
+ (ctx: {
14
+ client: C;
15
+ error: unknown;
16
+ function: types.Type | functions.Function<unknown>;
17
+ n: number;
18
+ }, next: NextFn<boolean>): MaybePromise<boolean>;
19
+ }
11
20
  declare const getEntity: unique symbol;
12
21
  declare const getStickerSetName: unique symbol;
13
22
  export declare const handleMigrationError: unique symbol;
@@ -25,62 +34,65 @@ export type Api = {
25
34
  } ? Promisify<Functions[K][K_]["__F"]> : Functions[K][K_];
26
35
  };
27
36
  };
28
- export interface Context extends Update {
37
+ export interface Context {
29
38
  /** The client that received the update. */
30
39
  client: Client;
31
- me: undefined extends this["connectionState"] ? undefined extends this["authorizationState"] ? User : (User | undefined) : (User | undefined);
32
- /** Resolves to `ctx.message ?? ctx.editedMessage ?? ctx.callbackQuery?.message`. */
33
- msg: undefined extends this["message"] ? undefined extends this["editedMessage"] ? undefined extends this["callbackQuery"] ? never : this["callbackQuery"] extends With<CallbackQuery, "message"> ? this["callbackQuery"]["message"] : this["callbackQuery"] extends With<CallbackQuery, "inlineMessageId"> ? never : (Message | undefined) : this["editedMessage"] : this["message"];
34
- /** Resolves to `effectiveMessage?.chat`. */
35
- chat: this["msg"] extends never ? never : this["msg"]["chat"];
36
- /** Resolves to `(ctx.message ?? ctx.editedMessage)?.from ?? ctx.callbackQuery?.from ?? ctx.inlineQuery?.from`. */
37
- from: this["message"] extends Message ? this["message"]["from"] : this["editedMessage"] extends Message ? this["editedMessage"]["from"] : this["callbackQuery"] extends CallbackQuery ? this["callbackQuery"]["from"] : this["inlineQuery"] extends InlineQuery ? this["inlineQuery"]["from"] : never;
38
- /** Resolves to `effectiveMessage?.senderChat`. */
39
- senderChat: this["msg"] extends never ? never : this["msg"]["senderChat"];
40
+ /** The currently authorized user. */
41
+ me?: User;
42
+ /** Resolves to `message`, `editedMessage`, or the `message` field of `callbackQuery`. */
43
+ msg?: Message;
44
+ /** Resolves to `msg?.chat`. TODO */
45
+ chat?: ChatP;
46
+ /** Resolves to the `from` field of `message`, `editedMessage`, `callbackQuery`, or `inlineQuery`. */
47
+ from?: User;
48
+ /** Resolves to `msg?.senderChat`. */
49
+ senderChat?: ChatP;
40
50
  /** Reply the received message with a text message. */
41
- reply: (text: string, params?: Omit<SendMessageParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "text">>;
51
+ reply: (text: string, params?: Omit<SendMessageParams, "replyToMessageId"> & ReplyParams) => Promise<MessageText>;
42
52
  /** Reply the received message with a poll. */
43
- replyPoll: (question: string, options: [string, string, ...string[]], params?: Omit<SendPollParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "poll">>;
53
+ replyPoll: (question: string, options: [string, string, ...string[]], params?: Omit<SendPollParams, "replyToMessageId"> & ReplyParams) => Promise<MessagePoll>;
44
54
  /** Reply the received message with a photo. */
45
- replyPhoto: (photo: FileSource, params?: Omit<SendPhotoParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "photo">>;
55
+ replyPhoto: (photo: FileSource, params?: Omit<SendPhotoParams, "replyToMessageId"> & ReplyParams) => Promise<MessagePhoto>;
46
56
  /** Reply the received message with a document. */
47
- replyDocument: (document: FileSource, params?: Omit<SendDocumentParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "document">>;
57
+ replyDocument: (document: FileSource, params?: Omit<SendDocumentParams, "replyToMessageId"> & ReplyParams) => Promise<MessageDocument>;
48
58
  /** Reply the received message with a location. */
49
- replyLocation: (latitude: number, longitude: number, params?: Omit<SendLocationParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "location">>;
59
+ replyLocation: (latitude: number, longitude: number, params?: Omit<SendLocationParams, "replyToMessageId"> & ReplyParams) => Promise<MessageLocation>;
50
60
  /** Reply the received message with a dice. */
51
- replyDice: (params?: Omit<SendDiceParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "dice">>;
61
+ replyDice: (params?: Omit<SendDiceParams, "replyToMessageId"> & ReplyParams) => Promise<MessageDice>;
52
62
  /** Reply the received message with a venue. */
53
- replyVenue: (latitude: number, longitude: number, title: string, address: string, params?: Omit<SendVenueParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "venue">>;
63
+ replyVenue: (latitude: number, longitude: number, title: string, address: string, params?: Omit<SendVenueParams, "replyToMessageId"> & ReplyParams) => Promise<MessageVenue>;
54
64
  /** Reply the received message with a contact. */
55
- replyContact: (firstName: string, number: string, params?: Omit<SendContactParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "contact">>;
65
+ replyContact: (firstName: string, number: string, params?: Omit<SendContactParams, "replyToMessageId"> & ReplyParams) => Promise<MessageContact>;
56
66
  /** Reply the received message with a video. */
57
- replyVideo: (video: FileSource, params?: Omit<SendVideoParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "video">>;
67
+ replyVideo: (video: FileSource, params?: Omit<SendVideoParams, "replyToMessageId"> & ReplyParams) => Promise<MessageVideo>;
58
68
  /** Reply the received message with an animation. */
59
- replyAnimation: (animation: FileSource, params?: Omit<SendAnimationParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "animation">>;
69
+ replyAnimation: (animation: FileSource, params?: Omit<SendAnimationParams, "replyToMessageId"> & ReplyParams) => Promise<MessageAnimation>;
60
70
  /** Reply the received message with a voice message. */
61
- replyVoice: (voice: FileSource, params?: Omit<SendVoiceParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "voice">>;
71
+ replyVoice: (voice: FileSource, params?: Omit<SendVoiceParams, "replyToMessageId"> & ReplyParams) => Promise<MessageVoice>;
62
72
  /** Reply the received message with an audio file. */
63
- replyAudio: (audio: FileSource, params?: Omit<SendAudioParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "audio">>;
73
+ replyAudio: (audio: FileSource, params?: Omit<SendAudioParams, "replyToMessageId"> & ReplyParams) => Promise<MessageAudio>;
64
74
  /** Reply the received message with a video note. */
65
- replyVideoNote: (videoNote: FileSource, params?: Omit<SendVideoNoteParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "videoNote">>;
75
+ replyVideoNote: (videoNote: FileSource, params?: Omit<SendVideoNoteParams, "replyToMessageId"> & ReplyParams) => Promise<MessageVideoNote>;
66
76
  /** Delete the received message. */
67
77
  delete: () => Promise<void>;
68
78
  /** Forward the received message. */
69
79
  forward: (to: ChatID, params?: ForwardMessagesParams) => Promise<this["msg"]>;
80
+ /** Change the reactions made to the received message. */
81
+ react: (reactions: Reaction[], params?: SetReactionsParams) => Promise<void>;
70
82
  /** Send a chat action to the chat which the message was received from. */
71
83
  sendChatAction: (action: ChatAction, params?: {
72
84
  messageThreadId?: number;
73
85
  }) => Promise<void>;
74
86
  /** Edit a message in the chat which the message was received from. */
75
- editMessageText: (messageId: number, text: string, params?: EditMessageParams) => Promise<With<Message, "text">>;
87
+ editMessageText: (messageId: number, text: string, params?: EditMessageParams) => Promise<MessageText>;
76
88
  /** Answer the received callback query. */
77
89
  answerCallbackQuery: (params?: AnswerCallbackQueryParams) => Promise<void>;
78
90
  /** Answer the received inline query. */
79
91
  answerInlineQuery: (results: InlineQueryResult[], params?: AnswerInlineQueryParams) => Promise<void>;
80
92
  /** Retrieve a single message of the chat which the message was received from. */
81
- getMessage: (messageId: number) => Promise<Omit<Message, "replyToMessage"> | null>;
93
+ getMessage: (messageId: number) => Promise<Message | null>;
82
94
  /** Retrieve multiple messages of the chat which the message was received from. */
83
- getMessages: (messageIds: number[]) => Promise<Omit<Message, "replyToMessage">[]>;
95
+ getMessages: (messageIds: number[]) => Promise<Message[]>;
84
96
  /** Forward a message of the chat which the message was received from. */
85
97
  forwardMessage: (to: ChatID, messageId: number, params?: ForwardMessagesParams) => Promise<Message>;
86
98
  /** Forward multiple messages of the chat which the message was received from. */
@@ -93,6 +105,10 @@ export interface Context extends Update {
93
105
  setAvailableReactions: (availableReactions: "none" | "all" | Reaction[]) => Promise<void>;
94
106
  /** Add a reaction to a message of the chat which the message was received from. */
95
107
  addReaction: (messageId: number, reaction: Reaction, params?: AddReactionParams) => Promise<void>;
108
+ /** Remove a reaction from a message of the chat which the message was received from. */
109
+ removeReaction: (messageId: number, reaction: Reaction) => Promise<void>;
110
+ /** Change the reactions made to a message of the chat which the message was received from. */
111
+ setReactions: (messageId: number, reactions: Reaction[], params?: SetReactionsParams) => Promise<void>;
96
112
  toJSON: () => Update;
97
113
  }
98
114
  export declare function skipInvoke<C extends Context>(): InvokeErrorHandler<Client<C>>;
@@ -189,7 +205,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
189
205
  * @param text The message's text.
190
206
  * @returns The sent text message.
191
207
  */
192
- sendMessage(chatId: ChatID, text: string, params?: SendMessageParams): Promise<With<Message, "text">>;
208
+ sendMessage(chatId: ChatID, text: string, params?: SendMessageParams): Promise<MessageText>;
193
209
  /**
194
210
  * Edit a message's text.
195
211
  *
@@ -199,7 +215,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
199
215
  * @param text The new text of the message.
200
216
  * @returns The edited text message.
201
217
  */
202
- editMessageText(chatId: ChatID, messageId: number, text: string, params?: EditMessageParams): Promise<With<Message, "text">>;
218
+ editMessageText(chatId: ChatID, messageId: number, text: string, params?: EditMessageParams): Promise<MessageText>;
203
219
  /**
204
220
  * Retrieve multiple messages.
205
221
  *
@@ -211,7 +227,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
211
227
  * ```
212
228
  * @returns The retrieved messages.
213
229
  */
214
- getMessages(chatId: ChatID, messageIds: number[]): Promise<Omit<Message, "replyToMessage">[]>;
230
+ getMessages(chatId: ChatID, messageIds: number[]): Promise<Message[]>;
215
231
  private [getMessageWithReply];
216
232
  /**
217
233
  * Retrieve a single message.
@@ -224,7 +240,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
224
240
  * ```
225
241
  * @returns The retrieved message.
226
242
  */
227
- getMessage(chatId: ChatID, messageId: number): Promise<Omit<Message, "replyToMessage"> | null>;
243
+ getMessage(chatId: ChatID, messageId: number): Promise<Message | null>;
228
244
  /**
229
245
  * Download a file.
230
246
  *
@@ -281,7 +297,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
281
297
  * @param options The poll's options.
282
298
  * @returns The sent poll.
283
299
  */
284
- sendPoll(chatId: ChatID, question: string, options: [string, string, ...string[]], params?: SendPollParams): Promise<With<Message, "poll">>;
300
+ sendPoll(chatId: ChatID, question: string, options: [string, string, ...string[]], params?: SendPollParams): Promise<MessagePoll>;
285
301
  /**
286
302
  * Send a chat action.
287
303
  *
@@ -319,21 +335,21 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
319
335
  * @param results The results to answer with.
320
336
  */
321
337
  answerInlineQuery(id: string, results: InlineQueryResult[], params?: AnswerInlineQueryParams): Promise<void>;
322
- use(...middleware: Middleware<C>[]): Composer<C>;
323
- branch(predicate: (ctx: C) => MaybePromise<boolean>, trueHandler_: Middleware<C>, falseHandler_: Middleware<C>): Composer<C>;
324
- filter<D extends C>(predicate: (ctx: C) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
325
- filter(predicate: (ctx: C) => MaybePromise<boolean>, ...middleware: Middleware<C>[]): Composer<C>;
326
- on<T extends keyof Update, F extends string>(filter: T extends FilterableUpdates ? T | [T, F, ...F[]] : T, ...middleawre: Middleware<FilterUpdate<C, T, F>>[]): Composer<FilterUpdate<C, T, F>>;
338
+ use(...middleware: Middleware<UpdateIntersection<C>>[]): Composer<UpdateIntersection<C>>;
339
+ branch(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, trueHandler_: Middleware<UpdateIntersection<C>>, falseHandler_: Middleware<UpdateIntersection<C>>): Composer<UpdateIntersection<C>>;
340
+ filter<D extends C>(predicate: (ctx: UpdateIntersection<C>) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
341
+ filter(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, ...middleware: Middleware<UpdateIntersection<C>>[]): Composer<C>;
342
+ on<T extends keyof UpdateMap, F extends string, K extends keyof MessageTypes>(filter: T extends "message" | "editedMessage" ? T | [T, K, ...F[]] : T, ...middleawre: Middleware<WithUpdate<C, T, K, F>>[]): Composer<WithUpdate<C, T, K, F>>;
327
343
  command(commands: string | RegExp | (string | RegExp)[] | {
328
344
  names: string | RegExp | (string | RegExp)[];
329
345
  prefixes: string | string[];
330
- }, ...middleawre: Middleware<FilterUpdate<C, "message", "text">>[]): Composer<FilterUpdate<C, "message", "text">>;
346
+ }, ...middleawre: Middleware<WithUpdate<C, "message", "text">>[]): Composer<WithUpdate<C, "message", "text", string>>;
331
347
  /**
332
348
  * Set the bot's description in the given language. Bot-only.
333
349
  *
334
350
  * @method
335
351
  */
336
- setMyDescription({ description, languageCode }: {
352
+ setMyDescription(params?: {
337
353
  description?: string;
338
354
  languageCode?: string;
339
355
  }): Promise<void>;
@@ -342,7 +358,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
342
358
  *
343
359
  * @method
344
360
  */
345
- setMyName({ name, languageCode }: {
361
+ setMyName(params?: {
346
362
  name?: string;
347
363
  languageCode?: string;
348
364
  }): Promise<void>;
@@ -351,7 +367,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
351
367
  *
352
368
  * @method
353
369
  */
354
- setMyShortDescription({ shortDescription: about, languageCode }: {
370
+ setMyShortDescription(params?: {
355
371
  shortDescription?: string;
356
372
  languageCode?: string;
357
373
  }): Promise<void>;
@@ -402,7 +418,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
402
418
  * @param chatId The chat to send the photo to.
403
419
  * @param photo The photo to send.
404
420
  */
405
- sendPhoto(chatId: ChatID, photo: FileSource, params?: SendPhotoParams): Promise<With<Message, "photo">>;
421
+ sendPhoto(chatId: ChatID, photo: FileSource, params?: SendPhotoParams): Promise<MessagePhoto>;
406
422
  /**
407
423
  * Send a document.
408
424
  *
@@ -410,7 +426,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
410
426
  * @param chatId The chat to send the document to.
411
427
  * @param document The document to send.
412
428
  */
413
- sendDocument(chatId: ChatID, document: FileSource, params?: SendDocumentParams): Promise<With<Message, "document">>;
429
+ sendDocument(chatId: ChatID, document: FileSource, params?: SendDocumentParams): Promise<MessageDocument>;
414
430
  /**
415
431
  * Send a video.
416
432
  *
@@ -418,7 +434,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
418
434
  * @param chatId The chat to send the video to.
419
435
  * @param video The video to send.
420
436
  */
421
- sendVideo(chatId: ChatID, video: FileSource, params?: SendVideoParams): Promise<With<Message, "video">>;
437
+ sendVideo(chatId: ChatID, video: FileSource, params?: SendVideoParams): Promise<MessageVideo>;
422
438
  /**
423
439
  * Send an animation.
424
440
  *
@@ -426,7 +442,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
426
442
  * @param chatId The chat to send the animation to.
427
443
  * @param animation The animation to send.
428
444
  */
429
- sendAnimation(chatId: ChatID, animation: FileSource, params?: SendAnimationParams): Promise<With<Message, "animation">>;
445
+ sendAnimation(chatId: ChatID, animation: FileSource, params?: SendAnimationParams): Promise<MessageAnimation>;
430
446
  /**
431
447
  * Send a voice message.
432
448
  *
@@ -434,7 +450,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
434
450
  * @param chatId The chat to send the voice message to.
435
451
  * @param voice The voice to send.
436
452
  */
437
- sendVoice(chatId: ChatID, voice: FileSource, params?: SendVoiceParams): Promise<With<Message, "voice">>;
453
+ sendVoice(chatId: ChatID, voice: FileSource, params?: SendVoiceParams): Promise<MessageVoice>;
438
454
  /**
439
455
  * Send an audio file.
440
456
  *
@@ -442,7 +458,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
442
458
  * @param chatId The chat to send the audio file to.
443
459
  * @param audio The audio to send.
444
460
  */
445
- sendAudio(chatId: ChatID, audio: FileSource, params?: SendAudioParams): Promise<With<Message, "audio">>;
461
+ sendAudio(chatId: ChatID, audio: FileSource, params?: SendAudioParams): Promise<MessageAudio>;
446
462
  /**
447
463
  * Send a video note.
448
464
  *
@@ -450,7 +466,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
450
466
  * @param chatId The chat to send the video note to.
451
467
  * @param videoNote The video note to send.
452
468
  */
453
- sendVideoNote(chatId: ChatID, audio: FileSource, params?: SendVideoNoteParams): Promise<With<Message, "videoNote">>;
469
+ sendVideoNote(chatId: ChatID, audio: FileSource, params?: SendVideoNoteParams): Promise<MessageVideoNote>;
454
470
  /**
455
471
  * Send a location.
456
472
  *
@@ -459,7 +475,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
459
475
  * @param latitude The location's latitude.
460
476
  * @param longitude The location's longitude.
461
477
  */
462
- sendLocation(chatId: ChatID, latitude: number, longitude: number, params?: SendLocationParams): Promise<With<Message, "location">>;
478
+ sendLocation(chatId: ChatID, latitude: number, longitude: number, params?: SendLocationParams): Promise<MessageLocation>;
463
479
  /**
464
480
  * Send a contact.
465
481
  *
@@ -468,14 +484,14 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
468
484
  * @param firstName The contact's first name.
469
485
  * @param number The contact's phone number.
470
486
  */
471
- sendContact(chatId: ChatID, firstName: string, number: string, params?: SendContactParams): Promise<With<Message, "contact">>;
487
+ sendContact(chatId: ChatID, firstName: string, number: string, params?: SendContactParams): Promise<MessageContact>;
472
488
  /**
473
489
  * Send a dice.
474
490
  *
475
491
  * @method
476
492
  * @param chatId The chat to send the dice to.
477
493
  */
478
- sendDice(chatId: ChatID, params?: SendDiceParams): Promise<With<Message, "dice">>;
494
+ sendDice(chatId: ChatID, params?: SendDiceParams): Promise<MessageDice>;
479
495
  /**
480
496
  * Send a venue.
481
497
  *
@@ -486,7 +502,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
486
502
  * @param title The title of the venue.
487
503
  * @param address The written address of the venue.
488
504
  */
489
- sendVenue(chatId: ChatID, latitude: number, longitude: number, title: string, address: string, params?: SendVenueParams): Promise<With<Message, "dice">>;
505
+ sendVenue(chatId: ChatID, latitude: number, longitude: number, title: string, address: string, params?: SendVenueParams): Promise<MessageVenue>;
490
506
  /**
491
507
  * Get network statistics. This might not always be available.
492
508
  *
@@ -528,12 +544,28 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
528
544
  */
529
545
  setAvailableReactions(chatId: ChatID, availableReactions: "none" | "all" | Reaction[]): Promise<void>;
530
546
  /**
531
- * Add a reaction to a message.
547
+ * Change reactions made to a message.
548
+ *
549
+ * @param chatId The identifier of the chat which the message belongs to.
550
+ * @param messageId The identifier of the message to add the reaction to.
551
+ * @param reactions The new reactions.
552
+ */
553
+ setReactions(chatId: number, messageId: number, reactions: Reaction[], params?: SetReactionsParams): Promise<void>;
554
+ /**
555
+ * Make a reaction to a message.
532
556
  *
533
557
  * @param chatId The identifier of the chat which the message belongs to.
534
558
  * @param messageId The identifier of the message to add the reaction to.
535
559
  * @param reaction The reaction to add.
536
560
  */
537
561
  addReaction(chatId: number, messageId: number, reaction: Reaction, params?: AddReactionParams): Promise<void>;
562
+ /**
563
+ * Undo a reaction made to a message.
564
+ *
565
+ * @param chatId The identifier of the chat which the message belongs to.
566
+ * @param messageId The identifier of the message which the reaction was made to.
567
+ * @param reaction The reaction to remove.
568
+ */
569
+ removeReaction(chatId: number, messageId: number, reaction: Reaction): Promise<void>;
538
570
  }
539
571
  export {};