@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
@@ -0,0 +1,134 @@
1
+ import { AuthorizationState } from "./0_authorization_state.js";
2
+ import { ConnectionState } from "./0_connection_state.js";
3
+ import { MessageIdentifier } from "./0_message_identifier.js";
4
+ import { ChosenInlineResult } from "./2_chosen_inline_result.js";
5
+ import { InlineQuery } from "./2_inline_query.js";
6
+ import { MessageInteractions } from "./2_message_interactions.js";
7
+ import { MessageReactionCount } from "./2_message_reaction_count.js";
8
+ import { Message } from "./4_message.js";
9
+ import { CallbackQuery } from "./5_callback_query.js";
10
+ import { Chat } from "./5_chat.js";
11
+ /**
12
+ * The client's connection state was changed.
13
+ * @unlisted
14
+ */
15
+ export interface UpdateConnectionState {
16
+ /** The client's new connection state. */
17
+ connectionState: ConnectionState;
18
+ }
19
+ /**
20
+ * The client's authorization state was changed.
21
+ * @unlisted
22
+ */
23
+ export interface UpdateAuthorizationState {
24
+ /** The client's new authorization state. */
25
+ authorizationState: AuthorizationState;
26
+ }
27
+ /**
28
+ * A message was sent or received.
29
+ * @unlisted
30
+ */
31
+ export interface UpdateNewMessage {
32
+ /** The sent or received message. */
33
+ message: Message;
34
+ }
35
+ /**
36
+ * A message was edited.
37
+ * @unlisted
38
+ */
39
+ export interface UpdateEditedMessage {
40
+ /** The edited message. */
41
+ editedMessage: Message;
42
+ }
43
+ /**
44
+ * One or more messages were deleted.
45
+ * @unlisted
46
+ */
47
+ export interface UpdateDeletedMessages {
48
+ /** The deleted messages. */
49
+ deletedMessages: MessageIdentifier[];
50
+ }
51
+ /**
52
+ * A callback query was received. Bot-only.
53
+ * @unlisted
54
+ */
55
+ export interface UpdateCallbackQuery {
56
+ /** The received callback query. */
57
+ callbackQuery: CallbackQuery;
58
+ }
59
+ /**
60
+ * An inline query was received. Bot-only.
61
+ * @unlisted
62
+ */
63
+ export interface UpdateInlineQuery {
64
+ /** The received inline query. */
65
+ inlineQuery: InlineQuery;
66
+ }
67
+ /**
68
+ * An inline result was chosen. Bot-only.
69
+ * @unlisted
70
+ */
71
+ export interface UpdateChosenInlineResult {
72
+ /** The chosen inline result. */
73
+ chosenInlineResult: ChosenInlineResult;
74
+ }
75
+ /**
76
+ * A new chat was added. User-only.
77
+ * @unlisted
78
+ */
79
+ export interface UpdateNewChat {
80
+ /** The newly added chat. */
81
+ newChat: Chat;
82
+ }
83
+ /**
84
+ * A chat was deleted. User-only.
85
+ * @unlisted
86
+ */
87
+ export interface UpdateEditedChat {
88
+ editedChat: Chat;
89
+ }
90
+ /**
91
+ * A chat was deleted. User-only.
92
+ * @unlisted
93
+ */
94
+ export interface UpdateDeletedChat {
95
+ /** The chat that was deleted. */
96
+ deletedChat: {
97
+ chatId: number;
98
+ };
99
+ }
100
+ /**
101
+ * The interactions of a message were updated. User-only.
102
+ * @unlisted
103
+ */
104
+ export interface UpdateMessageInteractions {
105
+ /** The new message interactions. */
106
+ messageInteractions: MessageInteractions;
107
+ }
108
+ /**
109
+ * The anonymous reactions made to a message were changed. Bot-only.
110
+ * @unlisted
111
+ */
112
+ export interface UpdateMessageReactionCount {
113
+ /** The new message reactions. */
114
+ messageReactionCount: MessageReactionCount;
115
+ }
116
+ /** @unlisted */
117
+ export interface UpdateMap {
118
+ message: UpdateNewMessage;
119
+ editedMessage: UpdateEditedMessage;
120
+ connectionState: UpdateConnectionState;
121
+ authorizationState: UpdateAuthorizationState;
122
+ deletedMessages: UpdateDeletedMessages;
123
+ callbackQuery: UpdateCallbackQuery;
124
+ inlineQuery: UpdateInlineQuery;
125
+ chosenInlineResult: UpdateChosenInlineResult;
126
+ newChat: UpdateNewChat;
127
+ editedChat: UpdateEditedChat;
128
+ deletedChat: UpdateDeletedChat;
129
+ messageInteractions: UpdateMessageInteractions;
130
+ messageReactionCount: UpdateMessageReactionCount;
131
+ }
132
+ /** @unlisted */
133
+ export type UpdateIntersection<T> = T & Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateEditedMessage & UpdateDeletedMessages & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount>;
134
+ export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateEditedMessage | UpdateDeletedMessages | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
1
- import { UNREACHABLE } from "../1_utilities.js";
2
- export function getChatListId(chatList) {
3
- switch (chatList) {
4
- case "main":
5
- return 0;
6
- case "archived":
7
- return 1;
8
- default:
9
- UNREACHABLE();
10
- }
11
- }
@@ -1,31 +0,0 @@
1
- import { User } from "../3_types.js";
2
- import { FilterableUpdates, FilterUpdate, Update as Update_ } from "./3_types.js";
3
- interface Update extends Update_ {
4
- me: undefined extends this["connectionState"] ? undefined extends this["authorizationState"] ? User : (User | undefined) : (User | undefined);
5
- }
6
- type MaybePromise<T> = T | Promise<T>;
7
- export type NextFunction = () => Promise<void>;
8
- export type MiddlewareFn<C extends Update = Update> = (ctx: C, next: NextFunction) => MaybePromise<unknown>;
9
- export interface MiddlewareObj<C extends Update = Update> {
10
- middleware: () => MiddlewareFn<C>;
11
- }
12
- export type Middleware<C extends Update = Update> = MiddlewareFn<C> | MiddlewareObj<C>;
13
- export declare function flatten<C extends Update = Update>(mw: Middleware<C>): MiddlewareFn<C>;
14
- export declare function concat<C extends Update = Update>(left: MiddlewareFn<C>, right: MiddlewareFn<C>): MiddlewareFn<C>;
15
- export declare const skip: MiddlewareFn;
16
- export declare class Composer<C extends Update> implements MiddlewareObj<C> {
17
- #private;
18
- set prefixes(value: string | string[]);
19
- constructor(...middleware: Middleware<C>[]);
20
- middleware(): MiddlewareFn<C>;
21
- use(...middleware: Middleware<C>[]): Composer<C>;
22
- branch(predicate: (ctx: C) => MaybePromise<boolean>, trueHandler_: Middleware<C>, falseHandler_: Middleware<C>): Composer<C>;
23
- filter<D extends C>(predicate: (ctx: C) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
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>>;
26
- command(commands: string | RegExp | (string | RegExp)[] | {
27
- names: string | RegExp | (string | RegExp)[];
28
- prefixes: string | string[];
29
- }, ...middleawre: Middleware<FilterUpdate<C, "message", "text">>[]): Composer<FilterUpdate<C, "message", "text">>;
30
- }
31
- export {};
@@ -1,4 +0,0 @@
1
- import { Composer as Composer_ } from "./4_composer.js";
2
- import { Context } from "./5_client.js";
3
- export declare class Composer<C extends Context = Context> extends Composer_<C> {
4
- }
@@ -1,3 +0,0 @@
1
- import { Composer as Composer_ } from "./4_composer.js";
2
- export class Composer extends Composer_ {
3
- }
@@ -1,182 +0,0 @@
1
- import { MaybePromise } from "../1_utilities.js";
2
- import { enums } from "../2_tl.js";
3
- import { Audio } from "./0_audio.js";
4
- import { Contact } from "./0_contact.js";
5
- import { Dice } from "./0_dice.js";
6
- import { ForceReply } from "./0_force_reply.js";
7
- import { Location } from "./0_location.js";
8
- import { MessageEntity } from "./0_message_entity.js";
9
- import { ReplyKeyboardRemove } from "./0_reply_keyboard_remove.js";
10
- import { Venue } from "./0_venue.js";
11
- import { Voice } from "./0_voice.js";
12
- import { EntityGetter } from "./1__getters.js";
13
- import { Animation } from "./1_animation.js";
14
- import { ReplyQuote } from "./1_reply_quote.js";
15
- import { ChatP } from "./1_chat_p.js";
16
- import { Document } from "./1_document.js";
17
- import { Photo } from "./1_photo.js";
18
- import { Poll } from "./1_poll.js";
19
- import { Sticker, StickerSetNameGetter } from "./1_sticker.js";
20
- import { User } from "./1_user.js";
21
- import { VideoNote } from "./1_video_note.js";
22
- import { Video } from "./1_video.js";
23
- import { Game } from "./2_game.js";
24
- import { ReplyKeyboardMarkup } from "./2_reply_keyboard_markup.js";
25
- import { InlineKeyboardMarkup } from "./3_inline_keyboard_markup.js";
26
- /** This object represents a message. */
27
- export interface Message {
28
- /** Whether the message is outgoing */
29
- out: boolean;
30
- /** Unique message identifier inside this chat */
31
- id: number;
32
- /** Unique identifier of a message thread to which the message belongs; for supergroups only */
33
- threadId?: number;
34
- /** Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
35
- from?: User;
36
- /** Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
37
- senderChat?: ChatP;
38
- /** Date the message was sent in Unix time */
39
- date: Date;
40
- /** Conversation the message belongs to */
41
- chat: ChatP;
42
- /** A link to the message */
43
- link?: string;
44
- /** For forwarded messages, sender of the original message */
45
- forwardFrom?: User;
46
- /** For messages forwarded from channels or from anonymous administrators, information about the original sender chat */
47
- forwardFromChat?: ChatP;
48
- /** For messages forwarded from channels, identifier of the original message in the channel */
49
- forwardId?: number;
50
- /** For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present */
51
- forwardSignature?: string;
52
- /** Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages */
53
- forwardSenderName?: string;
54
- /** For forwarded messages, date the original message was sent in Unix time */
55
- forwardDate?: Date;
56
- /** True, if the message is sent to a forum topic */
57
- isTopicMessage: boolean;
58
- /** True, if the message is a channel post that was automatically forwarded to the connected discussion group */
59
- isAutomaticForward?: boolean;
60
- /** For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */
61
- replyToMessage?: Omit<Message, "replyToMessage">;
62
- replyToMessageId?: number;
63
- replyQuote?: ReplyQuote;
64
- /** Bot through which the message was sent */
65
- viaBot?: User;
66
- /** Date the message was last edited in Unix time */
67
- editDate?: Date;
68
- /** True, if the message can't be forwarded */
69
- hasProtectedContent?: boolean;
70
- /** The unique identifier of a media message group this message belongs to */
71
- mediaGroupId?: string;
72
- /** Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */
73
- authorSignature?: string;
74
- /** For text messages, the actual UTF-8 text of the message */
75
- text?: string;
76
- /** For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text */
77
- entities?: MessageEntity[];
78
- /** Caption for the animation, audio, document, photo, video or voice */
79
- caption?: string;
80
- /** For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption */
81
- captionEntities?: MessageEntity[];
82
- /** True, if the message media is covered by a spoiler animation */
83
- hasMediaSpoiler?: boolean;
84
- /** View count for channel posts */
85
- views?: number;
86
- /** Inline keyboard attached to the message. `login_url` buttons are represented as ordinary `url` buttons. */
87
- replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
88
- /** Message is a photo, available sizes of the photo */
89
- photo?: Photo;
90
- /** Message is a general file, information about the file */
91
- document?: Document;
92
- /** Message is a video, information about the video */
93
- video?: Video;
94
- /** Message is a sticker, information about the sticker */
95
- sticker?: Sticker;
96
- /** Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set */
97
- animation?: Animation;
98
- /** Message is a voice message, information about the file */
99
- voice?: Voice;
100
- /** Message is an audio file, information about the file */
101
- audio?: Audio;
102
- /** Message is a dice with random value */
103
- dice?: Dice;
104
- /** Message is a [video note](https://telegram.org/blog/video-messages-and-telescope), information about the video message */
105
- videoNote?: VideoNote;
106
- /** Message is a shared contact, information about the contact */
107
- contact?: Contact;
108
- /** Message is a game, information about the game. */
109
- game?: Game;
110
- /** New poll state. Bots receive only updates about stopped polls and polls, which were sent by the bot. */
111
- poll?: Poll;
112
- /** Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set */
113
- venue?: Venue;
114
- /** Message is a shared location, information about the location */
115
- location?: Location;
116
- /** New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) */
117
- newChatMembers?: User[];
118
- /** A member was removed from the group, information about them (this member may be the bot itself) */
119
- leftChatMember?: User;
120
- /** A chat title was changed to this value */
121
- newChatTitle?: string;
122
- /** A chat photo was change to this value */
123
- newChatPhoto?: Photo;
124
- /** Service message: the chat photo was deleted */
125
- deletedChatPhoto?: true;
126
- /** Service message: the group has been created */
127
- groupCreated?: true;
128
- /** Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. */
129
- supergroupCreated?: true;
130
- /** Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. */
131
- channelCreated?: true;
132
- /** Service message: auto-delete timer settings changed in the chat */
133
- messageAutoDeleteTimerChanged?: {
134
- messageAutoDeleteTime: number;
135
- };
136
- /** The group has been migrated to a supergroup with the specified identifier */
137
- chatMigratedTo?: number;
138
- /** The supergroup has been migrated from a group with the specified identifier */
139
- chatMigratedFrom?: number;
140
- /** Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. */
141
- pinnedMessage?: Message;
142
- /** Service message: a user was shared with the bot */
143
- userShared?: {
144
- requestId: number;
145
- userId: number;
146
- };
147
- /** Service message: the user allowed the bot added to the attachment menu to write messages */
148
- writeAccessAllowed?: {
149
- webAppName?: string;
150
- };
151
- /** Service message: forum topic created */
152
- forumTopicCreated?: {
153
- name: string;
154
- iconColor: string;
155
- iconCutsomEmojiId?: string;
156
- };
157
- /** Service message: forum topic edited */
158
- forumTopicEdited?: {
159
- name?: string;
160
- iconCutsomEmojiId?: string;
161
- };
162
- /** Service message: forum topic closed */
163
- forumTopicClosed?: Record<never, never>;
164
- /** Service message: forum topic reopened */
165
- forumTopicReopened?: Record<never, never>;
166
- /** Service message: video chat scheduled */
167
- videoChatScheduled?: {
168
- startDate: Date;
169
- };
170
- /** Service message: video chat started */
171
- videoChatStarted?: Record<never, never>;
172
- /** Service message: video chat ended */
173
- videoChatEnded?: {
174
- duration: number;
175
- };
176
- }
177
- export interface MessageGetter<O extends keyof Message | null = null> {
178
- (chatId: number, messageId: number): MaybePromise<(O extends keyof Message ? Omit<Message, O> : Message) | null>;
179
- }
180
- type Message_MessageGetter = MessageGetter<"replyToMessage"> | null;
181
- export declare function constructMessage(message_: enums.Message, getEntity: EntityGetter, getMessage: Message_MessageGetter, getStickerSetName: StickerSetNameGetter, getReply_?: boolean): Promise<Message>;
182
- export {};
@@ -1,34 +0,0 @@
1
- import { enums, types } from "../2_tl.js";
2
- import { ChatP } from "./1_chat_p.js";
3
- import { ChatPhoto } from "./0_chat_photo.js";
4
- import { Message, MessageGetter } from "./3_message.js";
5
- import { StickerSetNameGetter } from "./1_sticker.js";
6
- import { EntityGetter } from "./1__getters.js";
7
- export declare namespace Chat {
8
- interface Base {
9
- order: string;
10
- lastMessage?: Message;
11
- pinned: number;
12
- }
13
- interface Channel extends Base, ChatP.Channel {
14
- also?: string[];
15
- photo?: ChatPhoto.Chat;
16
- }
17
- interface Supergroup extends Base, ChatP.Supergroup {
18
- also?: string[];
19
- photo?: ChatPhoto.Chat;
20
- }
21
- interface Group extends Base, ChatP.Group {
22
- photo?: ChatPhoto.Chat;
23
- }
24
- interface Private extends Base, ChatP.Private {
25
- also?: string[];
26
- photo?: ChatPhoto.User;
27
- }
28
- }
29
- export type Chat = Chat.Channel | Chat.Supergroup | Chat.Group | Chat.Private;
30
- export declare function getChatOrder(lastMessage: Message | undefined, pinned: number): string;
31
- export declare function constructChat(dialog: enums.Dialog, dialogs: types.messages.Dialogs | types.messages.DialogsSlice, pinnedChats: number[], getEntity: EntityGetter, getMessage: MessageGetter<"replyToMessage">, getStickerSetName: StickerSetNameGetter): Promise<Chat>;
32
- export declare function constructChat2(entity: types.User | types.Chat | types.ChatForbidden | types.Channel | types.ChannelForbidden, pinned: number, lastMessage: Message | undefined): Chat;
33
- export declare function constructChat3(chatId: number, pinned: number, lastMessage: Message | undefined, getEntity: EntityGetter): Promise<Chat | null>;
34
- export declare function constructChat4(chatId: number, pinned: number, lastMessageId: number, getEntity: EntityGetter, getMessage: MessageGetter<"replyToMessage">): Promise<Chat | null>;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getChatListId = void 0;
4
- const _1_utilities_js_1 = require("../1_utilities.js");
5
- function getChatListId(chatList) {
6
- switch (chatList) {
7
- case "main":
8
- return 0;
9
- case "archived":
10
- return 1;
11
- default:
12
- (0, _1_utilities_js_1.UNREACHABLE)();
13
- }
14
- }
15
- exports.getChatListId = getChatListId;
@@ -1,31 +0,0 @@
1
- import { User } from "../3_types.js";
2
- import { FilterableUpdates, FilterUpdate, Update as Update_ } from "./3_types.js";
3
- interface Update extends Update_ {
4
- me: undefined extends this["connectionState"] ? undefined extends this["authorizationState"] ? User : (User | undefined) : (User | undefined);
5
- }
6
- type MaybePromise<T> = T | Promise<T>;
7
- export type NextFunction = () => Promise<void>;
8
- export type MiddlewareFn<C extends Update = Update> = (ctx: C, next: NextFunction) => MaybePromise<unknown>;
9
- export interface MiddlewareObj<C extends Update = Update> {
10
- middleware: () => MiddlewareFn<C>;
11
- }
12
- export type Middleware<C extends Update = Update> = MiddlewareFn<C> | MiddlewareObj<C>;
13
- export declare function flatten<C extends Update = Update>(mw: Middleware<C>): MiddlewareFn<C>;
14
- export declare function concat<C extends Update = Update>(left: MiddlewareFn<C>, right: MiddlewareFn<C>): MiddlewareFn<C>;
15
- export declare const skip: MiddlewareFn;
16
- export declare class Composer<C extends Update> implements MiddlewareObj<C> {
17
- #private;
18
- set prefixes(value: string | string[]);
19
- constructor(...middleware: Middleware<C>[]);
20
- middleware(): MiddlewareFn<C>;
21
- use(...middleware: Middleware<C>[]): Composer<C>;
22
- branch(predicate: (ctx: C) => MaybePromise<boolean>, trueHandler_: Middleware<C>, falseHandler_: Middleware<C>): Composer<C>;
23
- filter<D extends C>(predicate: (ctx: C) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
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>>;
26
- command(commands: string | RegExp | (string | RegExp)[] | {
27
- names: string | RegExp | (string | RegExp)[];
28
- prefixes: string | string[];
29
- }, ...middleawre: Middleware<FilterUpdate<C, "message", "text">>[]): Composer<FilterUpdate<C, "message", "text">>;
30
- }
31
- export {};
@@ -1,4 +0,0 @@
1
- import { Composer as Composer_ } from "./4_composer.js";
2
- import { Context } from "./5_client.js";
3
- export declare class Composer<C extends Context = Context> extends Composer_<C> {
4
- }
@@ -1,182 +0,0 @@
1
- import { MaybePromise } from "../1_utilities.js";
2
- import { enums } from "../2_tl.js";
3
- import { Audio } from "./0_audio.js";
4
- import { Contact } from "./0_contact.js";
5
- import { Dice } from "./0_dice.js";
6
- import { ForceReply } from "./0_force_reply.js";
7
- import { Location } from "./0_location.js";
8
- import { MessageEntity } from "./0_message_entity.js";
9
- import { ReplyKeyboardRemove } from "./0_reply_keyboard_remove.js";
10
- import { Venue } from "./0_venue.js";
11
- import { Voice } from "./0_voice.js";
12
- import { EntityGetter } from "./1__getters.js";
13
- import { Animation } from "./1_animation.js";
14
- import { ReplyQuote } from "./1_reply_quote.js";
15
- import { ChatP } from "./1_chat_p.js";
16
- import { Document } from "./1_document.js";
17
- import { Photo } from "./1_photo.js";
18
- import { Poll } from "./1_poll.js";
19
- import { Sticker, StickerSetNameGetter } from "./1_sticker.js";
20
- import { User } from "./1_user.js";
21
- import { VideoNote } from "./1_video_note.js";
22
- import { Video } from "./1_video.js";
23
- import { Game } from "./2_game.js";
24
- import { ReplyKeyboardMarkup } from "./2_reply_keyboard_markup.js";
25
- import { InlineKeyboardMarkup } from "./3_inline_keyboard_markup.js";
26
- /** This object represents a message. */
27
- export interface Message {
28
- /** Whether the message is outgoing */
29
- out: boolean;
30
- /** Unique message identifier inside this chat */
31
- id: number;
32
- /** Unique identifier of a message thread to which the message belongs; for supergroups only */
33
- threadId?: number;
34
- /** Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
35
- from?: User;
36
- /** Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
37
- senderChat?: ChatP;
38
- /** Date the message was sent in Unix time */
39
- date: Date;
40
- /** Conversation the message belongs to */
41
- chat: ChatP;
42
- /** A link to the message */
43
- link?: string;
44
- /** For forwarded messages, sender of the original message */
45
- forwardFrom?: User;
46
- /** For messages forwarded from channels or from anonymous administrators, information about the original sender chat */
47
- forwardFromChat?: ChatP;
48
- /** For messages forwarded from channels, identifier of the original message in the channel */
49
- forwardId?: number;
50
- /** For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present */
51
- forwardSignature?: string;
52
- /** Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages */
53
- forwardSenderName?: string;
54
- /** For forwarded messages, date the original message was sent in Unix time */
55
- forwardDate?: Date;
56
- /** True, if the message is sent to a forum topic */
57
- isTopicMessage: boolean;
58
- /** True, if the message is a channel post that was automatically forwarded to the connected discussion group */
59
- isAutomaticForward?: boolean;
60
- /** For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */
61
- replyToMessage?: Omit<Message, "replyToMessage">;
62
- replyToMessageId?: number;
63
- replyQuote?: ReplyQuote;
64
- /** Bot through which the message was sent */
65
- viaBot?: User;
66
- /** Date the message was last edited in Unix time */
67
- editDate?: Date;
68
- /** True, if the message can't be forwarded */
69
- hasProtectedContent?: boolean;
70
- /** The unique identifier of a media message group this message belongs to */
71
- mediaGroupId?: string;
72
- /** Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */
73
- authorSignature?: string;
74
- /** For text messages, the actual UTF-8 text of the message */
75
- text?: string;
76
- /** For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text */
77
- entities?: MessageEntity[];
78
- /** Caption for the animation, audio, document, photo, video or voice */
79
- caption?: string;
80
- /** For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption */
81
- captionEntities?: MessageEntity[];
82
- /** True, if the message media is covered by a spoiler animation */
83
- hasMediaSpoiler?: boolean;
84
- /** View count for channel posts */
85
- views?: number;
86
- /** Inline keyboard attached to the message. `login_url` buttons are represented as ordinary `url` buttons. */
87
- replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
88
- /** Message is a photo, available sizes of the photo */
89
- photo?: Photo;
90
- /** Message is a general file, information about the file */
91
- document?: Document;
92
- /** Message is a video, information about the video */
93
- video?: Video;
94
- /** Message is a sticker, information about the sticker */
95
- sticker?: Sticker;
96
- /** Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set */
97
- animation?: Animation;
98
- /** Message is a voice message, information about the file */
99
- voice?: Voice;
100
- /** Message is an audio file, information about the file */
101
- audio?: Audio;
102
- /** Message is a dice with random value */
103
- dice?: Dice;
104
- /** Message is a [video note](https://telegram.org/blog/video-messages-and-telescope), information about the video message */
105
- videoNote?: VideoNote;
106
- /** Message is a shared contact, information about the contact */
107
- contact?: Contact;
108
- /** Message is a game, information about the game. */
109
- game?: Game;
110
- /** New poll state. Bots receive only updates about stopped polls and polls, which were sent by the bot. */
111
- poll?: Poll;
112
- /** Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set */
113
- venue?: Venue;
114
- /** Message is a shared location, information about the location */
115
- location?: Location;
116
- /** New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) */
117
- newChatMembers?: User[];
118
- /** A member was removed from the group, information about them (this member may be the bot itself) */
119
- leftChatMember?: User;
120
- /** A chat title was changed to this value */
121
- newChatTitle?: string;
122
- /** A chat photo was change to this value */
123
- newChatPhoto?: Photo;
124
- /** Service message: the chat photo was deleted */
125
- deletedChatPhoto?: true;
126
- /** Service message: the group has been created */
127
- groupCreated?: true;
128
- /** Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. */
129
- supergroupCreated?: true;
130
- /** Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. */
131
- channelCreated?: true;
132
- /** Service message: auto-delete timer settings changed in the chat */
133
- messageAutoDeleteTimerChanged?: {
134
- messageAutoDeleteTime: number;
135
- };
136
- /** The group has been migrated to a supergroup with the specified identifier */
137
- chatMigratedTo?: number;
138
- /** The supergroup has been migrated from a group with the specified identifier */
139
- chatMigratedFrom?: number;
140
- /** Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. */
141
- pinnedMessage?: Message;
142
- /** Service message: a user was shared with the bot */
143
- userShared?: {
144
- requestId: number;
145
- userId: number;
146
- };
147
- /** Service message: the user allowed the bot added to the attachment menu to write messages */
148
- writeAccessAllowed?: {
149
- webAppName?: string;
150
- };
151
- /** Service message: forum topic created */
152
- forumTopicCreated?: {
153
- name: string;
154
- iconColor: string;
155
- iconCutsomEmojiId?: string;
156
- };
157
- /** Service message: forum topic edited */
158
- forumTopicEdited?: {
159
- name?: string;
160
- iconCutsomEmojiId?: string;
161
- };
162
- /** Service message: forum topic closed */
163
- forumTopicClosed?: Record<never, never>;
164
- /** Service message: forum topic reopened */
165
- forumTopicReopened?: Record<never, never>;
166
- /** Service message: video chat scheduled */
167
- videoChatScheduled?: {
168
- startDate: Date;
169
- };
170
- /** Service message: video chat started */
171
- videoChatStarted?: Record<never, never>;
172
- /** Service message: video chat ended */
173
- videoChatEnded?: {
174
- duration: number;
175
- };
176
- }
177
- export interface MessageGetter<O extends keyof Message | null = null> {
178
- (chatId: number, messageId: number): MaybePromise<(O extends keyof Message ? Omit<Message, O> : Message) | null>;
179
- }
180
- type Message_MessageGetter = MessageGetter<"replyToMessage"> | null;
181
- export declare function constructMessage(message_: enums.Message, getEntity: EntityGetter, getMessage: Message_MessageGetter, getStickerSetName: StickerSetNameGetter, getReply_?: boolean): Promise<Message>;
182
- export {};