@mtkruto/node 0.1.132 → 0.1.133

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 (69) hide show
  1. package/esm/3_types.d.ts +3 -0
  2. package/esm/3_types.js +3 -0
  3. package/esm/4_constants.d.ts +2 -2
  4. package/esm/4_constants.js +2 -2
  5. package/esm/client/0_utilities.d.ts +2 -2
  6. package/esm/client/0_utilities.js +3 -5
  7. package/esm/client/3_types.d.ts +10 -5
  8. package/esm/client/4_composer.d.ts +4 -4
  9. package/esm/client/4_composer.js +13 -1
  10. package/esm/client/5_client.d.ts +36 -36
  11. package/esm/client/5_client.js +181 -177
  12. package/esm/tl/2_types.d.ts +313 -24
  13. package/esm/tl/2_types.js +982 -46
  14. package/esm/tl/3_functions.d.ts +95 -32
  15. package/esm/tl/3_functions.js +227 -66
  16. package/esm/types/0_chat_photo.d.ts +22 -21
  17. package/esm/types/0_giveaway_parameters.d.ts +9 -0
  18. package/esm/types/0_giveaway_parameters.js +9 -0
  19. package/esm/types/0_message_entity.d.ts +93 -74
  20. package/esm/types/0_reaction.d.ts +13 -10
  21. package/esm/types/0_reaction.js +16 -1
  22. package/esm/types/1_bot_command_scope.d.ts +32 -27
  23. package/esm/types/1_chat_p.d.ts +76 -68
  24. package/esm/types/1_giveaway.d.ts +8 -0
  25. package/esm/types/1_giveaway.js +7 -0
  26. package/esm/types/1_keyboard_button.d.ts +62 -56
  27. package/esm/types/1_keyboard_button.js +3 -0
  28. package/esm/types/1_message_reaction.d.ts +14 -0
  29. package/esm/types/1_message_reaction.js +22 -0
  30. package/esm/types/1_user.d.ts +2 -2
  31. package/esm/types/2_inline_keyboard_button.d.ts +44 -37
  32. package/esm/types/3_message.d.ts +170 -113
  33. package/esm/types/3_message.js +218 -121
  34. package/esm/types/4_chat.d.ts +32 -29
  35. package/package.json +1 -1
  36. package/script/3_types.d.ts +3 -0
  37. package/script/3_types.js +3 -0
  38. package/script/4_constants.d.ts +2 -2
  39. package/script/4_constants.js +2 -2
  40. package/script/client/0_utilities.d.ts +2 -2
  41. package/script/client/0_utilities.js +3 -5
  42. package/script/client/3_types.d.ts +10 -5
  43. package/script/client/4_composer.d.ts +4 -4
  44. package/script/client/4_composer.js +13 -1
  45. package/script/client/5_client.d.ts +36 -36
  46. package/script/client/5_client.js +180 -176
  47. package/script/tl/2_types.d.ts +313 -24
  48. package/script/tl/2_types.js +1169 -217
  49. package/script/tl/3_functions.d.ts +95 -32
  50. package/script/tl/3_functions.js +241 -77
  51. package/script/types/0_chat_photo.d.ts +22 -21
  52. package/script/types/0_giveaway_parameters.d.ts +9 -0
  53. package/script/types/0_giveaway_parameters.js +13 -0
  54. package/script/types/0_message_entity.d.ts +93 -74
  55. package/script/types/0_reaction.d.ts +13 -10
  56. package/script/types/0_reaction.js +19 -0
  57. package/script/types/1_bot_command_scope.d.ts +32 -27
  58. package/script/types/1_chat_p.d.ts +76 -68
  59. package/script/types/1_giveaway.d.ts +8 -0
  60. package/script/types/1_giveaway.js +11 -0
  61. package/script/types/1_keyboard_button.d.ts +62 -56
  62. package/script/types/1_keyboard_button.js +3 -0
  63. package/script/types/1_message_reaction.d.ts +14 -0
  64. package/script/types/1_message_reaction.js +26 -0
  65. package/script/types/1_user.d.ts +2 -2
  66. package/script/types/2_inline_keyboard_button.d.ts +44 -37
  67. package/script/types/3_message.d.ts +170 -113
  68. package/script/types/3_message.js +220 -122
  69. package/script/types/4_chat.d.ts +32 -29
package/esm/3_types.d.ts CHANGED
@@ -8,6 +8,7 @@ export * from "./types/0_contact.js";
8
8
  export * from "./types/0_dice.js";
9
9
  export * from "./types/0__file_id.js";
10
10
  export * from "./types/0_force_reply.js";
11
+ export * from "./types/0_giveaway_parameters.js";
11
12
  export * from "./types/0_input_contact_message_content.js";
12
13
  export * from "./types/0_input_location_message_content.js";
13
14
  export * from "./types/0_input_venue_message_content.js";
@@ -30,11 +31,13 @@ export * from "./types/1_animation.js";
30
31
  export * from "./types/1_bot_command_scope.js";
31
32
  export * from "./types/1_chat_p.js";
32
33
  export * from "./types/1_document.js";
34
+ export * from "./types/1_giveaway.js";
33
35
  export * from "./types/1__getters.js";
34
36
  export * from "./types/1_inline_query_result_button.js";
35
37
  export * from "./types/1_input_invoice_message_content.js";
36
38
  export * from "./types/1_input_text_message_content.js";
37
39
  export * from "./types/1_keyboard_button.js";
40
+ export * from "./types/1_message_reaction.js";
38
41
  export * from "./types/1_photo.js";
39
42
  export * from "./types/1_poll.js";
40
43
  export * from "./types/1_reply_quote.js";
package/esm/3_types.js CHANGED
@@ -8,6 +8,7 @@ export * from "./types/0_contact.js";
8
8
  export * from "./types/0_dice.js";
9
9
  export * from "./types/0__file_id.js";
10
10
  export * from "./types/0_force_reply.js";
11
+ export * from "./types/0_giveaway_parameters.js";
11
12
  export * from "./types/0_input_contact_message_content.js";
12
13
  export * from "./types/0_input_location_message_content.js";
13
14
  export * from "./types/0_input_venue_message_content.js";
@@ -30,11 +31,13 @@ export * from "./types/1_animation.js";
30
31
  export * from "./types/1_bot_command_scope.js";
31
32
  export * from "./types/1_chat_p.js";
32
33
  export * from "./types/1_document.js";
34
+ export * from "./types/1_giveaway.js";
33
35
  export * from "./types/1__getters.js";
34
36
  export * from "./types/1_inline_query_result_button.js";
35
37
  export * from "./types/1_input_invoice_message_content.js";
36
38
  export * from "./types/1_input_text_message_content.js";
37
39
  export * from "./types/1_keyboard_button.js";
40
+ export * from "./types/1_message_reaction.js";
38
41
  export * from "./types/1_photo.js";
39
42
  export * from "./types/1_poll.js";
40
43
  export * from "./types/1_reply_quote.js";
@@ -3,8 +3,8 @@ export declare const ACK_THRESHOLD = 10;
3
3
  export type PublicKeys = readonly [bigint, [bigint, bigint]][];
4
4
  export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const INITIAL_DC: DC;
6
- export declare const LAYER = 167;
7
- export declare const APP_VERSION = "MTKruto 0.1.132";
6
+ export declare const LAYER = 169;
7
+ export declare const APP_VERSION = "MTKruto 0.1.133";
8
8
  export declare const DEVICE_MODEL: string;
9
9
  export declare const LANG_CODE: string;
10
10
  export declare const LANG_PACK = "";
@@ -52,8 +52,8 @@ export const PUBLIC_KEYS = Object.freeze([
52
52
  ],
53
53
  ]);
54
54
  export const INITIAL_DC = "2";
55
- export const LAYER = 167;
56
- export const APP_VERSION = "MTKruto 0.1.132";
55
+ export const LAYER = 169;
56
+ export const APP_VERSION = "MTKruto 0.1.133";
57
57
  // @ts-ignore: lib
58
58
  export const DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
59
59
  export const LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -1,8 +1,8 @@
1
1
  import { enums, types } from "../2_tl.js";
2
2
  export declare const resolve: () => Promise<void>;
3
3
  export type With<T, K extends keyof T> = T & Required<Pick<T, K>>;
4
- export declare function isPtsUpdate(v: enums.Update | enums.Updates): v is types.UpdateShortMessage | types.UpdateShortChatMessage | types.UpdateShortSentMessage | types.UpdateNewMessage | types.UpdateDeleteMessages | types.UpdateReadHistoryInbox | types.UpdateReadHistoryOutbox | types.UpdatePinnedChannelMessages | types.UpdatePinnedMessages | types.UpdateFolderPeers | types.UpdateChannelWebPage | types.UpdateEditMessage | types.UpdateReadMessagesContents | types.UpdateWebPage;
5
- export declare function isChannelPtsUpdate(v: enums.Update | enums.Updates): v is types.UpdateNewChannelMessage | types.UpdateEditChannelMessage | types.UpdateDeleteChannelMessages;
4
+ export declare function isPtsUpdate(v: enums.Update): v is types.UpdateNewMessage | types.UpdateDeleteMessages | types.UpdateReadHistoryInbox | types.UpdateReadHistoryOutbox | types.UpdatePinnedChannelMessages | types.UpdatePinnedMessages | types.UpdateFolderPeers | types.UpdateChannelWebPage | types.UpdateEditMessage | types.UpdateReadMessagesContents | types.UpdateWebPage;
5
+ export declare function isChannelPtsUpdate(v: enums.Update | enums.Updates): v is types.UpdateNewChannelMessage | types.UpdateEditChannelMessage | types.UpdateDeleteChannelMessages | types.UpdateChannelTooLong;
6
6
  /**
7
7
  * Source to a file. Can be a file ID, a file path, URL, or a `Uint8Array`, unless otherwise noted.
8
8
  */
@@ -4,10 +4,7 @@ import { UNREACHABLE } from "../1_utilities.js";
4
4
  import { types } from "../2_tl.js";
5
5
  export const resolve = () => Promise.resolve();
6
6
  export function isPtsUpdate(v) {
7
- return v instanceof types.UpdateShortMessage ||
8
- v instanceof types.UpdateShortChatMessage ||
9
- v instanceof types.UpdateShortSentMessage ||
10
- v instanceof types.UpdateNewMessage ||
7
+ return v instanceof types.UpdateNewMessage ||
11
8
  v instanceof types.UpdateDeleteMessages ||
12
9
  v instanceof types.UpdateReadHistoryInbox ||
13
10
  v instanceof types.UpdateReadHistoryOutbox ||
@@ -22,7 +19,8 @@ export function isPtsUpdate(v) {
22
19
  export function isChannelPtsUpdate(v) {
23
20
  return v instanceof types.UpdateNewChannelMessage ||
24
21
  v instanceof types.UpdateEditChannelMessage ||
25
- v instanceof types.UpdateDeleteChannelMessages;
22
+ v instanceof types.UpdateDeleteChannelMessages ||
23
+ v instanceof types.UpdateChannelTooLong;
26
24
  }
27
25
  export async function getFileContents(source, fileName = "") {
28
26
  fileName = fileName.trim() || "file";
@@ -1,7 +1,7 @@
1
1
  import { FileSource } from "./0_utilities.js";
2
2
  import { MaybePromise } from "../1_utilities.js";
3
3
  import { functions, types } from "../2_tl.js";
4
- import { BotCommandScope, CallbackQuery, Chat, ChatID, ChosenInlineResult, ForceReply, InlineKeyboardMarkup, InlineQuery, InlineQueryResultButton, Message, MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove, ReplyQuote } from "../3_types.js";
4
+ import { BotCommandScope, CallbackQuery, Chat, ChatID, ChosenInlineResult, ForceReply, InlineKeyboardMarkup, InlineQuery, InlineQueryResultButton, Message, MessageEntity, MessageReaction, ReplyKeyboardMarkup, ReplyKeyboardRemove, ReplyQuote } from "../3_types.js";
5
5
  import { ClientPlainParams } from "./2_client_plain.js";
6
6
  import { ParseMode } from "../3_types.js";
7
7
  export interface ClientParams extends ClientPlainParams {
@@ -315,7 +315,7 @@ export interface AddReactionParams {
315
315
  big?: boolean;
316
316
  addToRecents?: boolean;
317
317
  }
318
- export type FilterableUpdates = "message" | "editedMessage" | "callbackQuery" | "inlineQuery" | "chosenInlineResult" | "editedChat" | "newChat";
318
+ export type MessageUpdates = "message" | "editedMessage";
319
319
  export interface Update {
320
320
  message?: Message;
321
321
  editedMessage?: Message;
@@ -330,6 +330,11 @@ export interface Update {
330
330
  deletedChat?: {
331
331
  chatId: number;
332
332
  };
333
+ reactions?: {
334
+ chatId: number;
335
+ messageId: number;
336
+ reactions: MessageReaction[];
337
+ };
333
338
  }
334
339
  export type NextFn<T = void> = () => Promise<T>;
335
340
  export interface Handler<C> {
@@ -344,10 +349,10 @@ export interface InvokeErrorHandler<C> {
344
349
  }, next: NextFn<boolean>): MaybePromise<boolean>;
345
350
  }
346
351
  type Update_ = Update;
347
- export type FilterUpdate<Update extends Update_, Type extends keyof Update_, Field extends string, TypeType extends NonNullable<Update_[Type]> = NonNullable<Update_[Type]>> = Update & {
348
- [Type_ in Type]-?: TypeType & {
352
+ export type FilterUpdate<U extends Update_, Type extends keyof Update_, Field extends string, TypeType = NonNullable<Update_[Type]>> = Omit<U, keyof Update_> & Omit<Update_, Type> & {
353
+ [Type_ in Type]-?: Field extends keyof TypeType ? TypeType & {
349
354
  [Field_ in Field]-?: Field extends keyof TypeType ? NonNullable<TypeType[Field]> : never;
350
- };
355
+ } : NonNullable<TypeType>;
351
356
  };
352
357
  export interface NetworkStatisticsEntry {
353
358
  sent: number;
@@ -1,5 +1,5 @@
1
- import { User } from "../3_types.js";
2
- import { FilterableUpdates, FilterUpdate, Update as Update_ } from "./3_types.js";
1
+ import { MessageTypes, User } from "../3_types.js";
2
+ import { FilterUpdate, MessageUpdates, Update as Update_ } from "./3_types.js";
3
3
  interface Update extends Update_ {
4
4
  me: undefined extends this["connectionState"] ? undefined extends this["authorizationState"] ? User : (User | undefined) : (User | undefined);
5
5
  }
@@ -22,10 +22,10 @@ export declare class Composer<C extends Update> implements MiddlewareObj<C> {
22
22
  branch(predicate: (ctx: C) => MaybePromise<boolean>, trueHandler_: Middleware<C>, falseHandler_: Middleware<C>): Composer<C>;
23
23
  filter<D extends C>(predicate: (ctx: C) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
24
24
  filter(predicate: (ctx: C) => MaybePromise<boolean>, ...middleware: Middleware<C>[]): Composer<C>;
25
- 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>>;
25
+ on<T extends keyof Update_, F extends string, K extends keyof MessageTypes | null = null>(filter: T extends MessageUpdates ? T | [T, K, ...F[]] : T, ...middleawre: Middleware<FilterUpdate<C, T, F, K extends keyof MessageTypes ? MessageTypes[K] : C[T]>>[]): Composer<FilterUpdate<C, T, F, K extends keyof MessageTypes ? MessageTypes[K] : C[T]>>;
26
26
  command(commands: string | RegExp | (string | RegExp)[] | {
27
27
  names: string | RegExp | (string | RegExp)[];
28
28
  prefixes: string | string[];
29
- }, ...middleawre: Middleware<FilterUpdate<C, "message", "text">>[]): Composer<FilterUpdate<C, "message", "text">>;
29
+ }, ...middleawre: Middleware<FilterUpdate<C, "message", "text">>[]): Composer<FilterUpdate<C, "message", string, import("../3_types.js").MessageText>>;
30
30
  }
31
31
  export {};
@@ -10,6 +10,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
10
10
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
11
  };
12
12
  var _Composer_handle, _Composer_prefixes;
13
+ import { assertMessageType } from "../3_types.js";
13
14
  export function flatten(mw) {
14
15
  return typeof mw === "function" ? mw : (ctx, next) => mw.middleware()(ctx, next);
15
16
  }
@@ -67,9 +68,19 @@ export class Composer {
67
68
  }
68
69
  on(filter, ...middleawre) {
69
70
  const type = typeof filter === "string" ? filter : filter[0];
70
- const keys = Array.isArray(filter) ? filter.slice(1) : [];
71
+ let keys = Array.isArray(filter) ? filter.slice(1) : [];
72
+ let messageType = null;
73
+ if (type == "message") {
74
+ messageType = keys[0];
75
+ keys = keys.slice(1);
76
+ }
71
77
  return this.filter((ctx) => {
72
78
  if (type in ctx) {
79
+ if (messageType != null) {
80
+ // deno-lint-ignore ban-ts-comment
81
+ // @ts-ignore
82
+ assertMessageType(ctx[type], messageType);
83
+ }
73
84
  if (keys.length > 0) {
74
85
  for (const key of keys) {
75
86
  // deno-lint-ignore ban-ts-comment
@@ -84,6 +95,7 @@ export class Composer {
84
95
  else {
85
96
  return false;
86
97
  }
98
+ // deno-lint-ignore no-explicit-any
87
99
  }, ...middleawre);
88
100
  }
89
101
  command(commands, ...middleawre) {
@@ -2,11 +2,11 @@ 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, CallbackQuery, Chat, ChatAction, ChatID, Document, InlineQuery, InlineQueryResult, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageLocation, MessagePhoto, MessagePoll, MessageText, MessageTypes, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, ParseMode, Reaction, User } from "../3_types.js";
6
6
  import { Migrate } from "../4_errors.js";
7
7
  import { FileSource, With } from "./0_utilities.js";
8
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";
9
+ import { AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, ClientParams, DeleteMessageParams, DeleteMessagesParams, DownloadParams, EditMessageParams, FilterUpdate, ForwardMessagesParams, GetChatsParams, GetHistoryParams, GetMyCommandsParams, InvokeErrorHandler, MessageUpdates, NetworkStatistics, ReplyParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetMyCommandsParams, Update, UploadParams } from "./3_types.js";
10
10
  import { Composer, Middleware } from "./4_composer.js";
11
11
  declare const getEntity: unique symbol;
12
12
  declare const getStickerSetName: unique symbol;
@@ -38,31 +38,31 @@ export interface Context extends Update {
38
38
  /** Resolves to `effectiveMessage?.senderChat`. */
39
39
  senderChat: this["msg"] extends never ? never : this["msg"]["senderChat"];
40
40
  /** Reply the received message with a text message. */
41
- reply: (text: string, params?: Omit<SendMessageParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "text">>;
41
+ reply: (text: string, params?: Omit<SendMessageParams, "replyToMessageId"> & ReplyParams) => Promise<MessageText>;
42
42
  /** Reply the received message with a poll. */
43
- replyPoll: (question: string, options: [string, string, ...string[]], params?: Omit<SendPollParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "poll">>;
43
+ replyPoll: (question: string, options: [string, string, ...string[]], params?: Omit<SendPollParams, "replyToMessageId"> & ReplyParams) => Promise<MessagePoll>;
44
44
  /** Reply the received message with a photo. */
45
- replyPhoto: (photo: FileSource, params?: Omit<SendPhotoParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "photo">>;
45
+ replyPhoto: (photo: FileSource, params?: Omit<SendPhotoParams, "replyToMessageId"> & ReplyParams) => Promise<MessagePhoto>;
46
46
  /** Reply the received message with a document. */
47
- replyDocument: (document: FileSource, params?: Omit<SendDocumentParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "document">>;
47
+ replyDocument: (document: FileSource, params?: Omit<SendDocumentParams, "replyToMessageId"> & ReplyParams) => Promise<MessageDocument>;
48
48
  /** Reply the received message with a location. */
49
- replyLocation: (latitude: number, longitude: number, params?: Omit<SendLocationParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "location">>;
49
+ replyLocation: (latitude: number, longitude: number, params?: Omit<SendLocationParams, "replyToMessageId"> & ReplyParams) => Promise<MessageLocation>;
50
50
  /** Reply the received message with a dice. */
51
- replyDice: (params?: Omit<SendDiceParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "dice">>;
51
+ replyDice: (params?: Omit<SendDiceParams, "replyToMessageId"> & ReplyParams) => Promise<MessageDice>;
52
52
  /** 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">>;
53
+ replyVenue: (latitude: number, longitude: number, title: string, address: string, params?: Omit<SendVenueParams, "replyToMessageId"> & ReplyParams) => Promise<MessageVenue>;
54
54
  /** Reply the received message with a contact. */
55
- replyContact: (firstName: string, number: string, params?: Omit<SendContactParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "contact">>;
55
+ replyContact: (firstName: string, number: string, params?: Omit<SendContactParams, "replyToMessageId"> & ReplyParams) => Promise<MessageContact>;
56
56
  /** Reply the received message with a video. */
57
- replyVideo: (video: FileSource, params?: Omit<SendVideoParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "video">>;
57
+ replyVideo: (video: FileSource, params?: Omit<SendVideoParams, "replyToMessageId"> & ReplyParams) => Promise<MessageVideo>;
58
58
  /** Reply the received message with an animation. */
59
- replyAnimation: (animation: FileSource, params?: Omit<SendAnimationParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "animation">>;
59
+ replyAnimation: (animation: FileSource, params?: Omit<SendAnimationParams, "replyToMessageId"> & ReplyParams) => Promise<MessageAnimation>;
60
60
  /** Reply the received message with a voice message. */
61
- replyVoice: (voice: FileSource, params?: Omit<SendVoiceParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "voice">>;
61
+ replyVoice: (voice: FileSource, params?: Omit<SendVoiceParams, "replyToMessageId"> & ReplyParams) => Promise<MessageVoice>;
62
62
  /** Reply the received message with an audio file. */
63
- replyAudio: (audio: FileSource, params?: Omit<SendAudioParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "audio">>;
63
+ replyAudio: (audio: FileSource, params?: Omit<SendAudioParams, "replyToMessageId"> & ReplyParams) => Promise<MessageAudio>;
64
64
  /** Reply the received message with a video note. */
65
- replyVideoNote: (videoNote: FileSource, params?: Omit<SendVideoNoteParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "videoNote">>;
65
+ replyVideoNote: (videoNote: FileSource, params?: Omit<SendVideoNoteParams, "replyToMessageId"> & ReplyParams) => Promise<MessageVideoNote>;
66
66
  /** Delete the received message. */
67
67
  delete: () => Promise<void>;
68
68
  /** Forward the received message. */
@@ -72,15 +72,15 @@ export interface Context extends Update {
72
72
  messageThreadId?: number;
73
73
  }) => Promise<void>;
74
74
  /** Edit a message in the chat which the message was received from. */
75
- editMessageText: (messageId: number, text: string, params?: EditMessageParams) => Promise<With<Message, "text">>;
75
+ editMessageText: (messageId: number, text: string, params?: EditMessageParams) => Promise<MessageText>;
76
76
  /** Answer the received callback query. */
77
77
  answerCallbackQuery: (params?: AnswerCallbackQueryParams) => Promise<void>;
78
78
  /** Answer the received inline query. */
79
79
  answerInlineQuery: (results: InlineQueryResult[], params?: AnswerInlineQueryParams) => Promise<void>;
80
80
  /** Retrieve a single message of the chat which the message was received from. */
81
- getMessage: (messageId: number) => Promise<Omit<Message, "replyToMessage"> | null>;
81
+ getMessage: (messageId: number) => Promise<Message | null>;
82
82
  /** Retrieve multiple messages of the chat which the message was received from. */
83
- getMessages: (messageIds: number[]) => Promise<Omit<Message, "replyToMessage">[]>;
83
+ getMessages: (messageIds: number[]) => Promise<Message[]>;
84
84
  /** Forward a message of the chat which the message was received from. */
85
85
  forwardMessage: (to: ChatID, messageId: number, params?: ForwardMessagesParams) => Promise<Message>;
86
86
  /** Forward multiple messages of the chat which the message was received from. */
@@ -189,7 +189,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
189
189
  * @param text The message's text.
190
190
  * @returns The sent text message.
191
191
  */
192
- sendMessage(chatId: ChatID, text: string, params?: SendMessageParams): Promise<With<Message, "text">>;
192
+ sendMessage(chatId: ChatID, text: string, params?: SendMessageParams): Promise<MessageText>;
193
193
  /**
194
194
  * Edit a message's text.
195
195
  *
@@ -199,7 +199,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
199
199
  * @param text The new text of the message.
200
200
  * @returns The edited text message.
201
201
  */
202
- editMessageText(chatId: ChatID, messageId: number, text: string, params?: EditMessageParams): Promise<With<Message, "text">>;
202
+ editMessageText(chatId: ChatID, messageId: number, text: string, params?: EditMessageParams): Promise<MessageText>;
203
203
  /**
204
204
  * Retrieve multiple messages.
205
205
  *
@@ -211,7 +211,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
211
211
  * ```
212
212
  * @returns The retrieved messages.
213
213
  */
214
- getMessages(chatId: ChatID, messageIds: number[]): Promise<Omit<Message, "replyToMessage">[]>;
214
+ getMessages(chatId: ChatID, messageIds: number[]): Promise<Message[]>;
215
215
  private [getMessageWithReply];
216
216
  /**
217
217
  * Retrieve a single message.
@@ -224,7 +224,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
224
224
  * ```
225
225
  * @returns The retrieved message.
226
226
  */
227
- getMessage(chatId: ChatID, messageId: number): Promise<Omit<Message, "replyToMessage"> | null>;
227
+ getMessage(chatId: ChatID, messageId: number): Promise<Message | null>;
228
228
  /**
229
229
  * Download a file.
230
230
  *
@@ -281,7 +281,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
281
281
  * @param options The poll's options.
282
282
  * @returns The sent poll.
283
283
  */
284
- sendPoll(chatId: ChatID, question: string, options: [string, string, ...string[]], params?: SendPollParams): Promise<With<Message, "poll">>;
284
+ sendPoll(chatId: ChatID, question: string, options: [string, string, ...string[]], params?: SendPollParams): Promise<MessagePoll>;
285
285
  /**
286
286
  * Send a chat action.
287
287
  *
@@ -323,11 +323,11 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
323
323
  branch(predicate: (ctx: C) => MaybePromise<boolean>, trueHandler_: Middleware<C>, falseHandler_: Middleware<C>): Composer<C>;
324
324
  filter<D extends C>(predicate: (ctx: C) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
325
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>>;
326
+ on<T extends keyof Update, F extends string, K extends keyof MessageTypes | null = null>(filter: T extends MessageUpdates ? T | [T, K, ...F[]] : T, ...middleawre: Middleware<FilterUpdate<C, T, F, K extends keyof MessageTypes ? MessageTypes[K] : C[T]>>[]): Composer<FilterUpdate<C, T, F, K extends keyof MessageTypes ? MessageTypes[K] : C[T]>>;
327
327
  command(commands: string | RegExp | (string | RegExp)[] | {
328
328
  names: string | RegExp | (string | RegExp)[];
329
329
  prefixes: string | string[];
330
- }, ...middleawre: Middleware<FilterUpdate<C, "message", "text">>[]): Composer<FilterUpdate<C, "message", "text">>;
330
+ }, ...middleawre: Middleware<FilterUpdate<C, "message", "text">>[]): Composer<FilterUpdate<C, "message", string, MessageText>>;
331
331
  /**
332
332
  * Set the bot's description in the given language. Bot-only.
333
333
  *
@@ -402,7 +402,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
402
402
  * @param chatId The chat to send the photo to.
403
403
  * @param photo The photo to send.
404
404
  */
405
- sendPhoto(chatId: ChatID, photo: FileSource, params?: SendPhotoParams): Promise<With<Message, "photo">>;
405
+ sendPhoto(chatId: ChatID, photo: FileSource, params?: SendPhotoParams): Promise<MessagePhoto>;
406
406
  /**
407
407
  * Send a document.
408
408
  *
@@ -410,7 +410,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
410
410
  * @param chatId The chat to send the document to.
411
411
  * @param document The document to send.
412
412
  */
413
- sendDocument(chatId: ChatID, document: FileSource, params?: SendDocumentParams): Promise<With<Message, "document">>;
413
+ sendDocument(chatId: ChatID, document: FileSource, params?: SendDocumentParams): Promise<MessageDocument>;
414
414
  /**
415
415
  * Send a video.
416
416
  *
@@ -418,7 +418,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
418
418
  * @param chatId The chat to send the video to.
419
419
  * @param video The video to send.
420
420
  */
421
- sendVideo(chatId: ChatID, video: FileSource, params?: SendVideoParams): Promise<With<Message, "video">>;
421
+ sendVideo(chatId: ChatID, video: FileSource, params?: SendVideoParams): Promise<MessageVideo>;
422
422
  /**
423
423
  * Send an animation.
424
424
  *
@@ -426,7 +426,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
426
426
  * @param chatId The chat to send the animation to.
427
427
  * @param animation The animation to send.
428
428
  */
429
- sendAnimation(chatId: ChatID, animation: FileSource, params?: SendAnimationParams): Promise<With<Message, "animation">>;
429
+ sendAnimation(chatId: ChatID, animation: FileSource, params?: SendAnimationParams): Promise<MessageAnimation>;
430
430
  /**
431
431
  * Send a voice message.
432
432
  *
@@ -434,7 +434,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
434
434
  * @param chatId The chat to send the voice message to.
435
435
  * @param voice The voice to send.
436
436
  */
437
- sendVoice(chatId: ChatID, voice: FileSource, params?: SendVoiceParams): Promise<With<Message, "voice">>;
437
+ sendVoice(chatId: ChatID, voice: FileSource, params?: SendVoiceParams): Promise<MessageVoice>;
438
438
  /**
439
439
  * Send an audio file.
440
440
  *
@@ -442,7 +442,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
442
442
  * @param chatId The chat to send the audio file to.
443
443
  * @param audio The audio to send.
444
444
  */
445
- sendAudio(chatId: ChatID, audio: FileSource, params?: SendAudioParams): Promise<With<Message, "audio">>;
445
+ sendAudio(chatId: ChatID, audio: FileSource, params?: SendAudioParams): Promise<MessageAudio>;
446
446
  /**
447
447
  * Send a video note.
448
448
  *
@@ -450,7 +450,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
450
450
  * @param chatId The chat to send the video note to.
451
451
  * @param videoNote The video note to send.
452
452
  */
453
- sendVideoNote(chatId: ChatID, audio: FileSource, params?: SendVideoNoteParams): Promise<With<Message, "videoNote">>;
453
+ sendVideoNote(chatId: ChatID, audio: FileSource, params?: SendVideoNoteParams): Promise<MessageVideoNote>;
454
454
  /**
455
455
  * Send a location.
456
456
  *
@@ -459,7 +459,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
459
459
  * @param latitude The location's latitude.
460
460
  * @param longitude The location's longitude.
461
461
  */
462
- sendLocation(chatId: ChatID, latitude: number, longitude: number, params?: SendLocationParams): Promise<With<Message, "location">>;
462
+ sendLocation(chatId: ChatID, latitude: number, longitude: number, params?: SendLocationParams): Promise<MessageLocation>;
463
463
  /**
464
464
  * Send a contact.
465
465
  *
@@ -468,14 +468,14 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
468
468
  * @param firstName The contact's first name.
469
469
  * @param number The contact's phone number.
470
470
  */
471
- sendContact(chatId: ChatID, firstName: string, number: string, params?: SendContactParams): Promise<With<Message, "contact">>;
471
+ sendContact(chatId: ChatID, firstName: string, number: string, params?: SendContactParams): Promise<MessageContact>;
472
472
  /**
473
473
  * Send a dice.
474
474
  *
475
475
  * @method
476
476
  * @param chatId The chat to send the dice to.
477
477
  */
478
- sendDice(chatId: ChatID, params?: SendDiceParams): Promise<With<Message, "dice">>;
478
+ sendDice(chatId: ChatID, params?: SendDiceParams): Promise<MessageDice>;
479
479
  /**
480
480
  * Send a venue.
481
481
  *
@@ -486,7 +486,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
486
486
  * @param title The title of the venue.
487
487
  * @param address The written address of the venue.
488
488
  */
489
- sendVenue(chatId: ChatID, latitude: number, longitude: number, title: string, address: string, params?: SendVenueParams): Promise<With<Message, "dice">>;
489
+ sendVenue(chatId: ChatID, latitude: number, longitude: number, title: string, address: string, params?: SendVenueParams): Promise<MessageVenue>;
490
490
  /**
491
491
  * Get network statistics. This might not always be available.
492
492
  *