@mtkruto/node 0.1.139 → 0.1.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/3_types.d.ts +10 -36
- package/esm/3_types.js +10 -36
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.js +1 -1
- package/esm/5_client.d.ts +1 -1
- package/esm/5_client.js +1 -1
- package/esm/_dnt.polyfills.d.ts +6 -0
- package/esm/client/0_filters.d.ts +60 -0
- package/esm/client/0_filters.js +27 -0
- package/esm/client/0_message.js +2 -2
- package/esm/client/{3_params.d.ts → 0_params.d.ts} +30 -33
- package/esm/client/0_types.d.ts +39 -0
- package/esm/client/0_types.js +2 -0
- package/esm/client/0_utilities.d.ts +1 -47
- package/esm/client/0_utilities.js +0 -27
- package/esm/client/1_composer.d.ts +1 -1
- package/esm/client/1_composer.js +1 -1
- package/esm/client/1_file_manager.d.ts +10 -0
- package/esm/client/1_file_manager.js +241 -0
- package/esm/client/1_update_manager.d.ts +18 -0
- package/esm/client/1_update_manager.js +553 -0
- package/esm/client/2_message_manager.d.ts +40 -0
- package/esm/client/2_message_manager.js +621 -0
- package/esm/client/3_chat_list_manager.d.ts +21 -0
- package/esm/client/3_chat_list_manager.js +353 -0
- package/esm/client/3_reaction_manager.d.ts +16 -0
- package/esm/client/3_reaction_manager.js +61 -0
- package/esm/client/4_client.d.ts +187 -60
- package/esm/client/4_client.js +492 -1698
- package/esm/connection/1_connection_web_socket.js +6 -6
- package/esm/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.d.ts +1 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.js +1 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.d.ts +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.js +524 -0
- package/esm/mod.d.ts +1 -0
- package/esm/mod.js +1 -0
- package/esm/storage/0_storage.d.ts +5 -3
- package/esm/storage/0_storage.js +14 -4
- package/esm/tl/1_tl_object.d.ts +1 -0
- package/esm/tl/1_tl_object.js +24 -0
- package/esm/types/0_bot_command.d.ts +1 -0
- package/esm/types/0_chat_member_rights.d.ts +37 -0
- package/esm/types/0_chat_photo.d.ts +4 -4
- package/esm/types/0_file_source.d.ts +5 -0
- package/esm/types/0_giveaway_parameters.js +2 -1
- package/esm/types/0_id.d.ts +4 -0
- package/esm/types/0_message_entity.d.ts +20 -20
- package/esm/types/1__getters.d.ts +2 -2
- package/esm/types/1_animation.d.ts +1 -1
- package/esm/types/1_bot_command_scope.d.ts +5 -4
- package/esm/types/1_chat_p.d.ts +5 -6
- package/esm/types/1_document.d.ts +1 -0
- package/esm/types/1_input_message_content.d.ts +88 -0
- package/esm/types/1_photo.d.ts +1 -1
- package/esm/types/1_sticker.d.ts +1 -1
- package/esm/types/1_user.d.ts +1 -1
- package/esm/types/1_video.d.ts +1 -1
- package/esm/types/1_video_note.d.ts +1 -1
- package/esm/types/2_inline_keyboard_button.d.ts +10 -10
- package/esm/types/2_message_reaction_count.d.ts +3 -0
- package/esm/types/2_message_reaction_count.js +17 -1
- package/esm/types/2_message_reactions.d.ts +15 -0
- package/esm/types/2_message_reactions.js +37 -0
- package/esm/types/3_reply_markup.d.ts +42 -0
- package/esm/types/3_reply_markup.js +117 -0
- package/esm/types/4_inline_query_result.d.ts +193 -0
- package/esm/types/{5_inline_query_result.js → 4_inline_query_result.js} +2 -2
- package/esm/types/4_message.d.ts +36 -39
- package/esm/types/4_message.js +7 -24
- package/esm/types/5_callback_query.d.ts +2 -1
- package/esm/types/5_chat.d.ts +8 -5
- package/esm/types/6_update.d.ts +12 -2
- package/esm/utilities/0_buffer.js +9 -6
- package/esm/utilities/0_object.d.ts +1 -1
- package/esm/utilities/0_object.js +1 -6
- package/esm/utilities/1_misc.d.ts +2 -0
- package/esm/utilities/1_misc.js +6 -0
- package/package.json +1 -2
- package/script/3_types.d.ts +10 -36
- package/script/3_types.js +10 -36
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.js +1 -1
- package/script/5_client.d.ts +1 -1
- package/script/5_client.js +1 -1
- package/script/_dnt.polyfills.d.ts +6 -0
- package/script/client/0_filters.d.ts +60 -0
- package/script/client/0_filters.js +31 -0
- package/script/client/0_message.js +1 -1
- package/script/client/{3_params.d.ts → 0_params.d.ts} +30 -33
- package/script/client/0_types.d.ts +39 -0
- package/script/client/0_types.js +6 -0
- package/script/client/0_utilities.d.ts +1 -47
- package/script/client/0_utilities.js +1 -29
- package/script/client/1_composer.d.ts +1 -1
- package/script/client/1_composer.js +2 -2
- package/script/client/1_file_manager.d.ts +10 -0
- package/script/client/1_file_manager.js +245 -0
- package/script/client/1_update_manager.d.ts +18 -0
- package/script/client/1_update_manager.js +557 -0
- package/script/client/2_message_manager.d.ts +40 -0
- package/script/client/2_message_manager.js +625 -0
- package/script/client/3_chat_list_manager.d.ts +21 -0
- package/script/client/3_chat_list_manager.js +357 -0
- package/script/client/3_reaction_manager.d.ts +16 -0
- package/script/client/3_reaction_manager.js +65 -0
- package/script/client/4_client.d.ts +187 -60
- package/script/client/4_client.js +491 -1698
- package/script/connection/1_connection_web_socket.js +5 -5
- package/script/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.d.ts +1 -1
- package/script/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.js +2 -2
- package/script/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.d.ts +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.js +550 -0
- package/script/mod.d.ts +1 -0
- package/script/mod.js +1 -0
- package/script/storage/0_storage.d.ts +5 -3
- package/script/storage/0_storage.js +14 -4
- package/script/tl/1_tl_object.d.ts +1 -0
- package/script/tl/1_tl_object.js +24 -0
- package/script/types/0_bot_command.d.ts +1 -0
- package/script/types/0_chat_member_rights.d.ts +37 -0
- package/script/types/0_chat_photo.d.ts +4 -4
- package/script/types/0_file_source.d.ts +5 -0
- package/script/types/0_giveaway_parameters.js +2 -1
- package/script/types/0_id.d.ts +4 -0
- package/script/types/0_message_entity.d.ts +20 -20
- package/script/types/1__getters.d.ts +2 -2
- package/script/types/1_animation.d.ts +1 -1
- package/script/types/1_bot_command_scope.d.ts +5 -4
- package/script/types/1_chat_p.d.ts +5 -6
- package/script/types/1_document.d.ts +1 -0
- package/script/types/1_input_message_content.d.ts +88 -0
- package/script/types/1_photo.d.ts +1 -1
- package/script/types/1_sticker.d.ts +1 -1
- package/script/types/1_user.d.ts +1 -1
- package/script/types/1_video.d.ts +1 -1
- package/script/types/1_video_note.d.ts +1 -1
- package/script/types/2_inline_keyboard_button.d.ts +10 -10
- package/script/types/2_message_reaction_count.d.ts +3 -0
- package/script/types/2_message_reaction_count.js +19 -0
- package/script/types/2_message_reactions.d.ts +15 -0
- package/script/types/2_message_reactions.js +41 -0
- package/script/types/3_reply_markup.d.ts +42 -0
- package/script/types/3_reply_markup.js +122 -0
- package/script/types/4_inline_query_result.d.ts +193 -0
- package/script/types/{5_inline_query_result.js → 4_inline_query_result.js} +3 -3
- package/script/types/4_message.d.ts +36 -39
- package/script/types/4_message.js +6 -23
- package/script/types/5_callback_query.d.ts +2 -1
- package/script/types/5_chat.d.ts +8 -5
- package/script/types/6_update.d.ts +12 -2
- package/script/utilities/0_buffer.js +9 -6
- package/script/utilities/0_object.d.ts +1 -1
- package/script/utilities/0_object.js +1 -6
- package/script/utilities/1_misc.d.ts +2 -0
- package/script/utilities/1_misc.js +9 -1
- package/esm/types/0_chat_id.d.ts +0 -4
- package/esm/types/0_force_reply.d.ts +0 -12
- package/esm/types/0_force_reply.js +0 -17
- package/esm/types/0_input_contact_message_content.d.ts +0 -11
- package/esm/types/0_input_location_message_content.d.ts +0 -15
- package/esm/types/0_input_venue_message_content.d.ts +0 -19
- package/esm/types/0_reply_keyboard_remove.d.ts +0 -10
- package/esm/types/0_reply_keyboard_remove.js +0 -8
- package/esm/types/1_input_invoice_message_content.d.ts +0 -23
- package/esm/types/1_input_text_message_content.d.ts +0 -8
- package/esm/types/1_input_text_message_content.js +0 -1
- package/esm/types/2_input_message_content.d.ts +0 -6
- package/esm/types/2_input_message_content.js +0 -1
- package/esm/types/2_reply_keyboard_markup.d.ts +0 -12
- package/esm/types/2_reply_keyboard_markup.js +0 -37
- package/esm/types/3_inline_keyboard_markup.d.ts +0 -8
- package/esm/types/3_inline_keyboard_markup.js +0 -24
- package/esm/types/4_inline_query_result_article.d.ts +0 -15
- package/esm/types/4_inline_query_result_article.js +0 -1
- package/esm/types/4_inline_query_result_audio.d.ts +0 -17
- package/esm/types/4_inline_query_result_audio.js +0 -1
- package/esm/types/4_inline_query_result_cached_audio.d.ts +0 -14
- package/esm/types/4_inline_query_result_cached_audio.js +0 -1
- package/esm/types/4_inline_query_result_cached_document.d.ts +0 -15
- package/esm/types/4_inline_query_result_cached_document.js +0 -1
- package/esm/types/4_inline_query_result_cached_gif.d.ts +0 -15
- package/esm/types/4_inline_query_result_cached_gif.js +0 -1
- package/esm/types/4_inline_query_result_cached_mpeg4_gif.d.ts +0 -15
- package/esm/types/4_inline_query_result_cached_mpeg4_gif.js +0 -1
- package/esm/types/4_inline_query_result_cached_photo.d.ts +0 -16
- package/esm/types/4_inline_query_result_cached_photo.js +0 -1
- package/esm/types/4_inline_query_result_cached_sticker.d.ts +0 -9
- package/esm/types/4_inline_query_result_cached_sticker.js +0 -1
- package/esm/types/4_inline_query_result_cached_video.d.ts +0 -16
- package/esm/types/4_inline_query_result_cached_video.js +0 -1
- package/esm/types/4_inline_query_result_cached_voice.d.ts +0 -15
- package/esm/types/4_inline_query_result_cached_voice.js +0 -1
- package/esm/types/4_inline_query_result_contact.d.ts +0 -15
- package/esm/types/4_inline_query_result_contact.js +0 -1
- package/esm/types/4_inline_query_result_document.d.ts +0 -18
- package/esm/types/4_inline_query_result_document.js +0 -1
- package/esm/types/4_inline_query_result_game.d.ts +0 -7
- package/esm/types/4_inline_query_result_game.js +0 -1
- package/esm/types/4_inline_query_result_gif.d.ts +0 -20
- package/esm/types/4_inline_query_result_gif.js +0 -1
- package/esm/types/4_inline_query_result_location.d.ts +0 -18
- package/esm/types/4_inline_query_result_location.js +0 -1
- package/esm/types/4_inline_query_result_mpeg4_gif.d.ts +0 -20
- package/esm/types/4_inline_query_result_mpeg4_gif.js +0 -1
- package/esm/types/4_inline_query_result_photo.d.ts +0 -19
- package/esm/types/4_inline_query_result_photo.js +0 -1
- package/esm/types/4_inline_query_result_venue.d.ts +0 -19
- package/esm/types/4_inline_query_result_venue.js +0 -1
- package/esm/types/4_inline_query_result_video.d.ts +0 -21
- package/esm/types/4_inline_query_result_video.js +0 -1
- package/esm/types/4_inline_query_result_voice.d.ts +0 -16
- package/esm/types/4_inline_query_result_voice.js +0 -1
- package/esm/types/4_reply_markup.d.ts +0 -7
- package/esm/types/4_reply_markup.js +0 -22
- package/esm/types/5_inline_query_result.d.ts +0 -28
- package/script/types/0_chat_id.d.ts +0 -4
- package/script/types/0_force_reply.d.ts +0 -12
- package/script/types/0_force_reply.js +0 -22
- package/script/types/0_input_contact_message_content.d.ts +0 -11
- package/script/types/0_input_location_message_content.d.ts +0 -15
- package/script/types/0_input_venue_message_content.d.ts +0 -19
- package/script/types/0_reply_keyboard_remove.d.ts +0 -10
- package/script/types/0_reply_keyboard_remove.js +0 -13
- package/script/types/1_input_invoice_message_content.d.ts +0 -23
- package/script/types/1_input_text_message_content.d.ts +0 -8
- package/script/types/1_input_text_message_content.js +0 -2
- package/script/types/2_input_message_content.d.ts +0 -6
- package/script/types/2_input_message_content.js +0 -2
- package/script/types/2_reply_keyboard_markup.d.ts +0 -12
- package/script/types/2_reply_keyboard_markup.js +0 -42
- package/script/types/3_inline_keyboard_markup.d.ts +0 -8
- package/script/types/3_inline_keyboard_markup.js +0 -29
- package/script/types/4_inline_query_result_article.d.ts +0 -15
- package/script/types/4_inline_query_result_article.js +0 -2
- package/script/types/4_inline_query_result_audio.d.ts +0 -17
- package/script/types/4_inline_query_result_audio.js +0 -2
- package/script/types/4_inline_query_result_cached_audio.d.ts +0 -14
- package/script/types/4_inline_query_result_cached_audio.js +0 -2
- package/script/types/4_inline_query_result_cached_document.d.ts +0 -15
- package/script/types/4_inline_query_result_cached_document.js +0 -2
- package/script/types/4_inline_query_result_cached_gif.d.ts +0 -15
- package/script/types/4_inline_query_result_cached_gif.js +0 -2
- package/script/types/4_inline_query_result_cached_mpeg4_gif.d.ts +0 -15
- package/script/types/4_inline_query_result_cached_mpeg4_gif.js +0 -2
- package/script/types/4_inline_query_result_cached_photo.d.ts +0 -16
- package/script/types/4_inline_query_result_cached_photo.js +0 -2
- package/script/types/4_inline_query_result_cached_sticker.d.ts +0 -9
- package/script/types/4_inline_query_result_cached_sticker.js +0 -2
- package/script/types/4_inline_query_result_cached_video.d.ts +0 -16
- package/script/types/4_inline_query_result_cached_video.js +0 -2
- package/script/types/4_inline_query_result_cached_voice.d.ts +0 -15
- package/script/types/4_inline_query_result_cached_voice.js +0 -2
- package/script/types/4_inline_query_result_contact.d.ts +0 -15
- package/script/types/4_inline_query_result_contact.js +0 -2
- package/script/types/4_inline_query_result_document.d.ts +0 -18
- package/script/types/4_inline_query_result_document.js +0 -2
- package/script/types/4_inline_query_result_game.d.ts +0 -7
- package/script/types/4_inline_query_result_game.js +0 -2
- package/script/types/4_inline_query_result_gif.d.ts +0 -20
- package/script/types/4_inline_query_result_gif.js +0 -2
- package/script/types/4_inline_query_result_location.d.ts +0 -18
- package/script/types/4_inline_query_result_location.js +0 -2
- package/script/types/4_inline_query_result_mpeg4_gif.d.ts +0 -20
- package/script/types/4_inline_query_result_mpeg4_gif.js +0 -2
- package/script/types/4_inline_query_result_photo.d.ts +0 -19
- package/script/types/4_inline_query_result_photo.js +0 -2
- package/script/types/4_inline_query_result_venue.d.ts +0 -19
- package/script/types/4_inline_query_result_venue.js +0 -2
- package/script/types/4_inline_query_result_video.d.ts +0 -21
- package/script/types/4_inline_query_result_video.js +0 -2
- package/script/types/4_inline_query_result_voice.d.ts +0 -16
- package/script/types/4_inline_query_result_voice.js +0 -2
- package/script/types/4_reply_markup.d.ts +0 -7
- package/script/types/4_reply_markup.js +0 -26
- package/script/types/5_inline_query_result.d.ts +0 -28
- /package/esm/{client/3_params.js → _dnt.polyfills.js} +0 -0
- /package/esm/{types/0_chat_id.js → client/0_params.js} +0 -0
- /package/esm/types/{0_input_contact_message_content.js → 0_chat_member_rights.js} +0 -0
- /package/esm/types/{0_input_location_message_content.js → 0_file_source.js} +0 -0
- /package/esm/types/{0_input_venue_message_content.js → 0_id.js} +0 -0
- /package/esm/types/{1_input_invoice_message_content.js → 1_input_message_content.js} +0 -0
- /package/script/{client/3_params.js → _dnt.polyfills.js} +0 -0
- /package/script/{types/0_chat_id.js → client/0_params.js} +0 -0
- /package/script/types/{0_input_contact_message_content.js → 0_chat_member_rights.js} +0 -0
- /package/script/types/{0_input_location_message_content.js → 0_file_source.js} +0 -0
- /package/script/types/{0_input_venue_message_content.js → 0_id.js} +0 -0
- /package/script/types/{1_input_invoice_message_content.js → 1_input_message_content.js} +0 -0
package/esm/tl/1_tl_object.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare abstract class TLObject {
|
|
|
33
33
|
get [length](): number;
|
|
34
34
|
[serialize](): Uint8Array;
|
|
35
35
|
[as]<T extends TLObjectConstructor<InstanceType<T>>>(constructor: T): InstanceType<T>;
|
|
36
|
+
toJSON(): Record<string, any>;
|
|
36
37
|
}
|
|
37
38
|
export interface TLObjectConstructor<T = TLObject> {
|
|
38
39
|
new (params: any): T;
|
package/esm/tl/1_tl_object.js
CHANGED
|
@@ -171,6 +171,30 @@ export class TLObject {
|
|
|
171
171
|
throw new TypeError(`Expected ${constructor[name]} but received ${this[name]}`);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
+
toJSON() {
|
|
175
|
+
// deno-lint-ignore no-explicit-any
|
|
176
|
+
const r = { _: this[name] + `#${this[id].toString(16).toUpperCase()}` };
|
|
177
|
+
const desc = this.constructor[paramDesc];
|
|
178
|
+
for (const [name] of desc) {
|
|
179
|
+
const n = name;
|
|
180
|
+
if (n in this && this[n] !== undefined) {
|
|
181
|
+
if (typeof this[n] === "bigint") {
|
|
182
|
+
r[name] = String(this[n]);
|
|
183
|
+
}
|
|
184
|
+
else if (this[n] instanceof Uint8Array) {
|
|
185
|
+
const buffer = this[n];
|
|
186
|
+
r[name] = "";
|
|
187
|
+
for (const b of buffer) {
|
|
188
|
+
r[name] += b.toString(16).padStart(2, "0").toUpperCase();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
r[name] = this[n];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return r;
|
|
197
|
+
}
|
|
174
198
|
}
|
|
175
199
|
export function isTLObjectConstructor(t) {
|
|
176
200
|
// deno-lint-ignore no-explicit-any
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** The rights of a chat member. */
|
|
2
|
+
export interface ChatMemberRights {
|
|
3
|
+
/** Whether messages are allowed to be sent. */
|
|
4
|
+
canSendMessages?: boolean;
|
|
5
|
+
/** Whether audio files are allowed to be sent. */
|
|
6
|
+
canSendAudio?: boolean;
|
|
7
|
+
/** Whether files are allowed to be sent. */
|
|
8
|
+
canSendDocuments?: boolean;
|
|
9
|
+
/** Whether photos are allowed to be sent. */
|
|
10
|
+
canSendPhotos?: boolean;
|
|
11
|
+
/** Whether videos are allowed to be sent. */
|
|
12
|
+
canSendVideos?: boolean;
|
|
13
|
+
/** Whether video notes are allowed to be sent. */
|
|
14
|
+
canSendVideoNotes?: boolean;
|
|
15
|
+
/** Whether voice messages are allowed to be sent. */
|
|
16
|
+
canSendVoice?: boolean;
|
|
17
|
+
/** Whether polls are allowed to be sent. */
|
|
18
|
+
canSendPolls?: boolean;
|
|
19
|
+
/** Whether stickers are allowed to be sent. */
|
|
20
|
+
canSendStickers?: boolean;
|
|
21
|
+
/** Whether animations are allowed to be sent. */
|
|
22
|
+
canSendAnimations?: boolean;
|
|
23
|
+
/** Whether games are allowed to be sent. */
|
|
24
|
+
canSendGames?: boolean;
|
|
25
|
+
/** Whether inline bot results are allowed to be sent. */
|
|
26
|
+
canSendInlineBotResults?: boolean;
|
|
27
|
+
/** Whether it is allowed to add web page previews. */
|
|
28
|
+
canAddWebPagePreviews?: boolean;
|
|
29
|
+
/** Whether it is allowed to change the chat info. Ignored for supergroups. */
|
|
30
|
+
canChangeInfo?: boolean;
|
|
31
|
+
/** Whether it is allowed to invite users. */
|
|
32
|
+
canInviteUsers?: boolean;
|
|
33
|
+
/** Whether it is allowed to pin messages. */
|
|
34
|
+
canPinMessages?: boolean;
|
|
35
|
+
/** Whether it is allowed to manage topics. */
|
|
36
|
+
canManageTopics?: boolean;
|
|
37
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
2
|
/** @unlisted */
|
|
3
|
-
export interface
|
|
3
|
+
export interface _ChatPhotoBase {
|
|
4
4
|
/** A file identifier that can be used to download or reuse the small version of the chat photo (160x160). */
|
|
5
5
|
smallFileId: string;
|
|
6
6
|
/** A file identifier that can be used to identify the small version of the chat photo (160x160). */
|
|
@@ -13,13 +13,13 @@ export interface ChatPhotoBase {
|
|
|
13
13
|
hasVideo: boolean;
|
|
14
14
|
}
|
|
15
15
|
/** @unlisted */
|
|
16
|
-
export interface ChatPhotoUser extends
|
|
16
|
+
export interface ChatPhotoUser extends _ChatPhotoBase {
|
|
17
17
|
/** Differentiates between user profile photos. */
|
|
18
18
|
personal: true;
|
|
19
19
|
}
|
|
20
20
|
/** @unlisted */
|
|
21
|
-
export type ChatPhotoChat =
|
|
22
|
-
/**
|
|
21
|
+
export type ChatPhotoChat = _ChatPhotoBase;
|
|
22
|
+
/** A chat photo. */
|
|
23
23
|
export type ChatPhoto = ChatPhotoUser | ChatPhotoChat;
|
|
24
24
|
export declare function constructChatPhoto(photo: types.ChatPhoto, chatId: number, chatAccessHash: bigint): ChatPhotoChat;
|
|
25
25
|
export declare function constructChatPhoto(photo: types.UserProfilePhoto, chatId: number, chatAccessHash: bigint): ChatPhotoUser;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { fromUnixTimestamp } from "../1_utilities.js";
|
|
1
2
|
import { peerToChatId, types } from "../2_tl.js";
|
|
2
3
|
export function constructGiveawayParameters(g) {
|
|
3
4
|
const countries = g.countries_iso2 ?? [];
|
|
4
5
|
const boostedChatId = peerToChatId(new types.PeerChannel({ channel_id: g.channels[0] }));
|
|
5
6
|
const additionalChatIds = g.channels.slice(1).map((v) => peerToChatId(new types.PeerChannel({ channel_id: v })));
|
|
6
7
|
const onlyNewMembers = g.only_new_subscribers ? true : false;
|
|
7
|
-
const winnerSelectionDate =
|
|
8
|
+
const winnerSelectionDate = fromUnixTimestamp(g.until_date);
|
|
8
9
|
return { boostedChatId, additionalChatIds, winnerSelectionDate, onlyNewMembers, countries };
|
|
9
10
|
}
|
|
@@ -2,91 +2,91 @@ import { enums } from "../2_tl.js";
|
|
|
2
2
|
/** @unlisted */
|
|
3
3
|
export type MessageEntityType = "mention" | "hashtag" | "botCommand" | "url" | "email" | "bold" | "italic" | "code" | "pre" | "textLink" | "textMention" | "cashtag" | "phoneNumber" | "underline" | "strikethrough" | "blockquote" | "bankCard" | "spoiler" | "customEmoji";
|
|
4
4
|
/** @unlisted */
|
|
5
|
-
export interface
|
|
5
|
+
export interface _MessageEntityBase {
|
|
6
6
|
type: MessageEntityType;
|
|
7
7
|
offset: number;
|
|
8
8
|
length: number;
|
|
9
9
|
}
|
|
10
10
|
/** @unlisted */
|
|
11
|
-
export interface MessageEntityMention extends
|
|
11
|
+
export interface MessageEntityMention extends _MessageEntityBase {
|
|
12
12
|
type: "mention";
|
|
13
13
|
}
|
|
14
14
|
/** @unlisted */
|
|
15
|
-
export interface MessageEntityHashtag extends
|
|
15
|
+
export interface MessageEntityHashtag extends _MessageEntityBase {
|
|
16
16
|
type: "hashtag";
|
|
17
17
|
}
|
|
18
18
|
/** @unlisted */
|
|
19
|
-
export interface MessageEntityBotCommand extends
|
|
19
|
+
export interface MessageEntityBotCommand extends _MessageEntityBase {
|
|
20
20
|
type: "botCommand";
|
|
21
21
|
}
|
|
22
22
|
/** @unlisted */
|
|
23
|
-
export interface MessageEntityURL extends
|
|
23
|
+
export interface MessageEntityURL extends _MessageEntityBase {
|
|
24
24
|
type: "url";
|
|
25
25
|
}
|
|
26
26
|
/** @unlisted */
|
|
27
|
-
export interface MessageEntityEmailAddress extends
|
|
27
|
+
export interface MessageEntityEmailAddress extends _MessageEntityBase {
|
|
28
28
|
type: "email";
|
|
29
29
|
}
|
|
30
30
|
/** @unlisted */
|
|
31
|
-
export interface MessageEntityBold extends
|
|
31
|
+
export interface MessageEntityBold extends _MessageEntityBase {
|
|
32
32
|
type: "bold";
|
|
33
33
|
}
|
|
34
34
|
/** @unlisted */
|
|
35
|
-
export interface MessageEntityItalic extends
|
|
35
|
+
export interface MessageEntityItalic extends _MessageEntityBase {
|
|
36
36
|
type: "italic";
|
|
37
37
|
}
|
|
38
38
|
/** @unlisted */
|
|
39
|
-
export interface MessageEntityPre extends
|
|
39
|
+
export interface MessageEntityPre extends _MessageEntityBase {
|
|
40
40
|
type: "pre";
|
|
41
41
|
/** The language identifier of the code. */
|
|
42
42
|
language: string;
|
|
43
43
|
}
|
|
44
44
|
/** @unlisted */
|
|
45
|
-
export interface MessageEntityCode extends
|
|
45
|
+
export interface MessageEntityCode extends _MessageEntityBase {
|
|
46
46
|
type: "code";
|
|
47
47
|
}
|
|
48
48
|
/** @unlisted */
|
|
49
|
-
export interface MessageEntityTextLink extends
|
|
49
|
+
export interface MessageEntityTextLink extends _MessageEntityBase {
|
|
50
50
|
type: "textLink";
|
|
51
51
|
/** A URL that will be opened after the text is tapped. */
|
|
52
52
|
url: string;
|
|
53
53
|
}
|
|
54
54
|
/** @unlisted */
|
|
55
|
-
export interface MessageEntityTextMention extends
|
|
55
|
+
export interface MessageEntityTextMention extends _MessageEntityBase {
|
|
56
56
|
type: "textMention";
|
|
57
57
|
/** The identifier of the user to mention. */
|
|
58
58
|
userId: number;
|
|
59
59
|
}
|
|
60
60
|
/** @unlisted */
|
|
61
|
-
export interface MessageEntityCashtag extends
|
|
61
|
+
export interface MessageEntityCashtag extends _MessageEntityBase {
|
|
62
62
|
type: "cashtag";
|
|
63
63
|
}
|
|
64
64
|
/** @unlisted */
|
|
65
|
-
export interface MessageEntityPhoneNumber extends
|
|
65
|
+
export interface MessageEntityPhoneNumber extends _MessageEntityBase {
|
|
66
66
|
type: "phoneNumber";
|
|
67
67
|
}
|
|
68
68
|
/** @unlisted */
|
|
69
|
-
export interface MessageEntityUnderline extends
|
|
69
|
+
export interface MessageEntityUnderline extends _MessageEntityBase {
|
|
70
70
|
type: "underline";
|
|
71
71
|
}
|
|
72
72
|
/** @unlisted */
|
|
73
|
-
export interface MessageEntityStrikethrough extends
|
|
73
|
+
export interface MessageEntityStrikethrough extends _MessageEntityBase {
|
|
74
74
|
type: "strikethrough";
|
|
75
75
|
}
|
|
76
76
|
/** @unlisted */
|
|
77
|
-
export interface MessageEntityBlockquote extends
|
|
77
|
+
export interface MessageEntityBlockquote extends _MessageEntityBase {
|
|
78
78
|
type: "blockquote";
|
|
79
79
|
}
|
|
80
80
|
/** @unlisted */
|
|
81
|
-
export interface MessageEntityBankCard extends
|
|
81
|
+
export interface MessageEntityBankCard extends _MessageEntityBase {
|
|
82
82
|
type: "bankCard";
|
|
83
83
|
}
|
|
84
84
|
/** @unlisted */
|
|
85
|
-
export interface MessageEntitySpoiler extends
|
|
85
|
+
export interface MessageEntitySpoiler extends _MessageEntityBase {
|
|
86
86
|
type: "spoiler";
|
|
87
87
|
}
|
|
88
88
|
/** @unlisted */
|
|
89
|
-
export interface MessageEntityCustomEmoji extends
|
|
89
|
+
export interface MessageEntityCustomEmoji extends _MessageEntityBase {
|
|
90
90
|
type: "customEmoji";
|
|
91
91
|
/** The identifier of the custom emoji. */
|
|
92
92
|
customEmojiId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MaybePromise } from "../1_utilities.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ID } from "./0_id.js";
|
|
4
4
|
/** @unlisted */
|
|
5
5
|
export interface EntityGetter {
|
|
6
6
|
(peer: types.PeerUser): MaybePromise<types.User | null>;
|
|
@@ -10,7 +10,7 @@ export interface EntityGetter {
|
|
|
10
10
|
}
|
|
11
11
|
/** @unlisted */
|
|
12
12
|
export interface InputPeerGetter {
|
|
13
|
-
(id:
|
|
13
|
+
(id: ID): Promise<types.InputPeerUser | types.InputPeerChannel | types.InputPeerChat>;
|
|
14
14
|
}
|
|
15
15
|
/** @unlisted */
|
|
16
16
|
export interface UsernameResolver {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
2
|
import { Thumbnail } from "./0_thumbnail.js";
|
|
3
|
-
/**
|
|
3
|
+
/** An animation file (GIF or H.264/MPEG-4 AVC video without sound). */
|
|
4
4
|
export interface Animation {
|
|
5
5
|
/** A file identifier that can be used to download or reuse this file. */
|
|
6
6
|
fileId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ID } from "./0_id.js";
|
|
2
2
|
import { InputPeerGetter } from "./1__getters.js";
|
|
3
3
|
/** @unlisted */
|
|
4
4
|
export interface BotCommandScopeDefault {
|
|
@@ -19,18 +19,19 @@ export interface BotCommandScopeAllChatAdministrators {
|
|
|
19
19
|
/** @unlisted */
|
|
20
20
|
export interface BotCommandScopeChat {
|
|
21
21
|
type: "chat";
|
|
22
|
-
chatId:
|
|
22
|
+
chatId: ID;
|
|
23
23
|
}
|
|
24
24
|
/** @unlisted */
|
|
25
25
|
export interface BotCommandScopeChatAdministrators {
|
|
26
26
|
type: "chatAdministrators";
|
|
27
|
-
chatId:
|
|
27
|
+
chatId: ID;
|
|
28
28
|
}
|
|
29
29
|
/** @unlisted */
|
|
30
30
|
export interface BotCommandScopeChatMember {
|
|
31
31
|
type: "chatMember";
|
|
32
|
-
chatId:
|
|
32
|
+
chatId: ID;
|
|
33
33
|
userId: number;
|
|
34
34
|
}
|
|
35
|
+
/** A type specifying where bot commads are available. */
|
|
35
36
|
export type BotCommandScope = BotCommandScopeDefault | BotCommandScopeAllPrivateChats | BotCommandScopeAllGroupChats | BotCommandScopeAllChatAdministrators | BotCommandScopeChat | BotCommandScopeChatAdministrators | BotCommandScopeChatMember;
|
|
36
37
|
export declare function botCommandScopeToTlObject(scope: BotCommandScope, getInputPeer: InputPeerGetter): Promise<import("../tl/2_types.js").BotCommandScopeDefault_ | import("../tl/2_types.js").BotCommandScopeUsers_ | import("../tl/2_types.js").BotCommandScopeChats_ | import("../tl/2_types.js").BotCommandScopeChatAdmins_ | import("../tl/2_types.js").BotCommandScopePeer_ | import("../tl/2_types.js").BotCommandScopePeerAdmins_ | import("../tl/2_types.js").BotCommandScopePeerUser_>;
|
package/esm/types/1_chat_p.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { RestrictionReason } from "./0_restriction_reason.js";
|
|
|
3
3
|
/** @unlisted */
|
|
4
4
|
export type ChatType = "private" | "group" | "supergroup" | "channel";
|
|
5
5
|
/** @unlisted */
|
|
6
|
-
export interface
|
|
6
|
+
export interface _ChatPBase {
|
|
7
7
|
/** The identifier of the chat. */
|
|
8
8
|
id: number;
|
|
9
9
|
/** The type of the chat. */
|
|
@@ -12,7 +12,7 @@ export interface ChatPBase {
|
|
|
12
12
|
color: number;
|
|
13
13
|
}
|
|
14
14
|
/** @unlisted */
|
|
15
|
-
export interface ChatPPrivate extends
|
|
15
|
+
export interface ChatPPrivate extends _ChatPBase {
|
|
16
16
|
type: "private";
|
|
17
17
|
/** Whether this is a bot's chat. */
|
|
18
18
|
isBot?: boolean;
|
|
@@ -36,7 +36,7 @@ export interface ChatPPrivate extends ChatPBase {
|
|
|
36
36
|
restrictionReason?: RestrictionReason[];
|
|
37
37
|
}
|
|
38
38
|
/** @unlisted */
|
|
39
|
-
export interface ChatPGroup extends
|
|
39
|
+
export interface ChatPGroup extends _ChatPBase {
|
|
40
40
|
type: "group";
|
|
41
41
|
/** The title of the chat. */
|
|
42
42
|
title: string;
|
|
@@ -44,7 +44,7 @@ export interface ChatPGroup extends ChatPBase {
|
|
|
44
44
|
isCreator: boolean;
|
|
45
45
|
}
|
|
46
46
|
/** @unlisted */
|
|
47
|
-
export interface ChatPChannelBase extends
|
|
47
|
+
export interface ChatPChannelBase extends _ChatPBase {
|
|
48
48
|
/** The title of the chat or channel. */
|
|
49
49
|
title: string;
|
|
50
50
|
/** The main username of the chat or channel. */
|
|
@@ -71,8 +71,7 @@ export interface ChatPSupergroup extends ChatPChannelBase {
|
|
|
71
71
|
isForum: boolean;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
* @unlisted
|
|
74
|
+
* A chat with lesser fields.
|
|
76
75
|
*/
|
|
77
76
|
export type ChatP = ChatPPrivate | ChatPGroup | ChatPSupergroup | ChatPChannel;
|
|
78
77
|
export declare function constructChatP(chat: types.User): ChatPPrivate;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { LabeledPrice } from "./0_labeled_price.js";
|
|
2
|
+
import { MessageEntity } from "./0_message_entity.js";
|
|
3
|
+
import { ParseMode } from "./0_parse_mode.js";
|
|
4
|
+
/**
|
|
5
|
+
* A message content that shares a contact.
|
|
6
|
+
* @unlisted
|
|
7
|
+
*/
|
|
8
|
+
export interface InputMessageContentContact {
|
|
9
|
+
/** The contact's phone number. */
|
|
10
|
+
phoneNumber: string;
|
|
11
|
+
/** The contact's first name. */
|
|
12
|
+
firstName: string;
|
|
13
|
+
/** The contact's last name. */
|
|
14
|
+
lastName?: string;
|
|
15
|
+
/** Additional information in the vCard format. */
|
|
16
|
+
vcard?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A message content that shares a location.
|
|
20
|
+
* @unlisted
|
|
21
|
+
*/
|
|
22
|
+
export interface InputMessageContentLocation {
|
|
23
|
+
/** The latitude of the location. */
|
|
24
|
+
latitude: number;
|
|
25
|
+
/** The longitude of the location. */
|
|
26
|
+
longitude: number;
|
|
27
|
+
/** The accuracy radius of the location in meters. Must be in the range of 0-1500. */
|
|
28
|
+
horizontalAccuracy?: number;
|
|
29
|
+
/** The duration in which the location can be updated in seconds. Must be in the range of 80-864,000. */
|
|
30
|
+
livePeriod?: number;
|
|
31
|
+
/** The direction which the user is moving towards. Must be in the range of 1-350. */
|
|
32
|
+
heading?: number;
|
|
33
|
+
/** The maximum distance for proximity alerts on approaching another chat member in meters. Must be in the range 1-100,000. */
|
|
34
|
+
proximityAlertRadius?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A message content that shares a venue.
|
|
38
|
+
* @unlisted
|
|
39
|
+
*/
|
|
40
|
+
export interface InputMessageContentVenue {
|
|
41
|
+
/** The latitude of the venue. */
|
|
42
|
+
latitude: number;
|
|
43
|
+
/** The longitude of the venue. */
|
|
44
|
+
longitude: number;
|
|
45
|
+
/** The name of the venue. */
|
|
46
|
+
title: string;
|
|
47
|
+
/** The address of the venue. */
|
|
48
|
+
address: string;
|
|
49
|
+
/** The Foursquare identifier of the venue. */
|
|
50
|
+
foursquareId?: string;
|
|
51
|
+
/** The Foursquare type of the venue. */
|
|
52
|
+
foursquareType?: string;
|
|
53
|
+
/** The Google Places identifier of the venue. */
|
|
54
|
+
googlePlaceId?: string;
|
|
55
|
+
/** The Google Places type of the venue. */
|
|
56
|
+
googlePlaceType?: string;
|
|
57
|
+
}
|
|
58
|
+
/** @unlisted */
|
|
59
|
+
export interface InputMessageContentText {
|
|
60
|
+
messageText: string;
|
|
61
|
+
parseMode?: ParseMode;
|
|
62
|
+
entities?: MessageEntity[];
|
|
63
|
+
disableWebPagePreview?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/** @unlisted */
|
|
66
|
+
export interface InputMessageContentInvoice {
|
|
67
|
+
title: string;
|
|
68
|
+
description: string;
|
|
69
|
+
payload: string;
|
|
70
|
+
providerToken: string;
|
|
71
|
+
currency: string;
|
|
72
|
+
prices: LabeledPrice[];
|
|
73
|
+
maxTipAmount?: number;
|
|
74
|
+
suggestedTipAmounts?: number[];
|
|
75
|
+
providerData?: string;
|
|
76
|
+
photoUrl?: string;
|
|
77
|
+
photoSize?: number;
|
|
78
|
+
photoWidth?: number;
|
|
79
|
+
photoHeight?: number;
|
|
80
|
+
needName?: boolean;
|
|
81
|
+
needPhoneNumber?: boolean;
|
|
82
|
+
needEmail?: boolean;
|
|
83
|
+
needShippingAAddress?: boolean;
|
|
84
|
+
sendPhoneNumberToPorvider?: boolean;
|
|
85
|
+
sendEmailToProvider?: boolean;
|
|
86
|
+
isFlexible?: boolean;
|
|
87
|
+
}
|
|
88
|
+
export type InputMessageContent = InputMessageContentText | InputMessageContentLocation | InputMessageContentVenue | InputMessageContentContact | InputMessageContentInvoice;
|
package/esm/types/1_photo.d.ts
CHANGED
package/esm/types/1_sticker.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { MaybePromise } from "../1_utilities.js";
|
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
3
|
import { MaskPosition } from "./0_mask_position.js";
|
|
4
4
|
import { Thumbnail } from "./0_thumbnail.js";
|
|
5
|
-
/**
|
|
5
|
+
/** A sticker. */
|
|
6
6
|
export interface Sticker {
|
|
7
7
|
/** A file identifier that can be used to download or reuse this file. */
|
|
8
8
|
fileId: string;
|
package/esm/types/1_user.d.ts
CHANGED
package/esm/types/1_video.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
2
|
import { Thumbnail } from "./0_thumbnail.js";
|
|
3
|
-
/**
|
|
3
|
+
/** A video file. */
|
|
4
4
|
export interface Video {
|
|
5
5
|
/** A file identifier that can be used to download or reuse this file. */
|
|
6
6
|
fileId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
2
|
import { Thumbnail } from "./0_thumbnail.js";
|
|
3
|
-
/**
|
|
3
|
+
/** A video note. */
|
|
4
4
|
export interface VideoNote {
|
|
5
5
|
/** A file identifier that can be used to download or reuse this file. */
|
|
6
6
|
fileId: string;
|
|
@@ -3,42 +3,42 @@ import { LoginUrl } from "./0_login_url.js";
|
|
|
3
3
|
import { WebAppInfo } from "./0_web_app_info.js";
|
|
4
4
|
import { UsernameResolver } from "./1__getters.js";
|
|
5
5
|
/** @unlisted */
|
|
6
|
-
export interface
|
|
6
|
+
export interface _InlineKeyboardButtonBase {
|
|
7
7
|
text: string;
|
|
8
8
|
}
|
|
9
9
|
/** @unlisted */
|
|
10
|
-
export interface InlineKeyboardButtonURL extends
|
|
10
|
+
export interface InlineKeyboardButtonURL extends _InlineKeyboardButtonBase {
|
|
11
11
|
url: string;
|
|
12
12
|
}
|
|
13
13
|
/** @unlisted */
|
|
14
|
-
export interface InlineKeyboardButtonCallback extends
|
|
14
|
+
export interface InlineKeyboardButtonCallback extends _InlineKeyboardButtonBase {
|
|
15
15
|
callbackData: string;
|
|
16
16
|
}
|
|
17
17
|
/** @unlisted */
|
|
18
|
-
export interface InlineKeyboardButtonWebApp extends
|
|
18
|
+
export interface InlineKeyboardButtonWebApp extends _InlineKeyboardButtonBase {
|
|
19
19
|
webApp: WebAppInfo;
|
|
20
20
|
}
|
|
21
21
|
/** @unlisted */
|
|
22
|
-
export interface InlineKeyboardButtonLogin extends
|
|
22
|
+
export interface InlineKeyboardButtonLogin extends _InlineKeyboardButtonBase {
|
|
23
23
|
loginUrl: LoginUrl;
|
|
24
24
|
}
|
|
25
25
|
/** @unlisted */
|
|
26
|
-
export interface InlineKeyboardButtonSwitchInline extends
|
|
26
|
+
export interface InlineKeyboardButtonSwitchInline extends _InlineKeyboardButtonBase {
|
|
27
27
|
switchInlineQuery: string;
|
|
28
28
|
}
|
|
29
29
|
/** @unlisted */
|
|
30
|
-
export interface InlineKeyboardButtonSwitchInlineCurrent extends
|
|
30
|
+
export interface InlineKeyboardButtonSwitchInlineCurrent extends _InlineKeyboardButtonBase {
|
|
31
31
|
switchInlineQueryCurrentChat: string;
|
|
32
32
|
}
|
|
33
33
|
/** @unlisted */
|
|
34
|
-
export interface InlineKeyboardButtonGame extends
|
|
34
|
+
export interface InlineKeyboardButtonGame extends _InlineKeyboardButtonBase {
|
|
35
35
|
callbackGame: Record<never, never>;
|
|
36
36
|
}
|
|
37
37
|
/** @unlisted */
|
|
38
|
-
export interface InlineKeyboardButtonPay extends
|
|
38
|
+
export interface InlineKeyboardButtonPay extends _InlineKeyboardButtonBase {
|
|
39
39
|
pay: boolean;
|
|
40
40
|
}
|
|
41
|
-
/**
|
|
41
|
+
/** A button of an inline keyboard. */
|
|
42
42
|
export type InlineKeyboardButton = InlineKeyboardButtonURL | InlineKeyboardButtonCallback | InlineKeyboardButtonWebApp | InlineKeyboardButtonLogin | InlineKeyboardButtonSwitchInline | InlineKeyboardButtonSwitchInlineCurrent | InlineKeyboardButtonGame | InlineKeyboardButtonPay;
|
|
43
43
|
export declare function constructInlineKeyboardButton(button_: enums.KeyboardButton): InlineKeyboardButton;
|
|
44
44
|
export declare function inlineKeyboardButtonToTlObject(button: InlineKeyboardButton, usernameResolver: UsernameResolver): Promise<import("../tl/2_types.js").KeyboardButtonUrl_ | import("../tl/2_types.js").KeyboardButtonCallback_ | import("../tl/2_types.js").KeyboardButtonSwitchInline_ | import("../tl/2_types.js").KeyboardButtonBuy_ | import("../tl/2_types.js").InputKeyboardButtonUrlAuth_ | import("../tl/2_types.js").KeyboardButtonWebView_>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
|
+
import { EntityGetter } from "./1__getters.js";
|
|
1
3
|
import { ChatP } from "./1_chat_p.js";
|
|
2
4
|
import { ReactionCount } from "./1_reaction_count.js";
|
|
3
5
|
export interface MessageReactionCount {
|
|
@@ -6,3 +8,4 @@ export interface MessageReactionCount {
|
|
|
6
8
|
date: Date;
|
|
7
9
|
reactions: ReactionCount[];
|
|
8
10
|
}
|
|
11
|
+
export declare function constructMessageReactionCount(update: types.UpdateBotMessageReactions, getEntity: EntityGetter): Promise<MessageReactionCount | null>;
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { fromUnixTimestamp } from "../1_utilities.js";
|
|
2
|
+
import { constructChatP } from "./1_chat_p.js";
|
|
3
|
+
import { constructReactionCount } from "./1_reaction_count.js";
|
|
4
|
+
export async function constructMessageReactionCount(update, getEntity) {
|
|
5
|
+
const date = fromUnixTimestamp(update.date);
|
|
6
|
+
const reactions = update.reactions.map((v) => constructReactionCount(v));
|
|
7
|
+
const entity = await getEntity(update.peer);
|
|
8
|
+
if (entity) {
|
|
9
|
+
const chat = constructChatP(entity);
|
|
10
|
+
const messageId = update.msg_id;
|
|
11
|
+
const messageReactionCount = { chat, messageId, date, reactions };
|
|
12
|
+
return messageReactionCount;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
|
+
import { Reaction } from "./0_reaction.js";
|
|
3
|
+
import { EntityGetter } from "./1__getters.js";
|
|
4
|
+
import { ChatP } from "./1_chat_p.js";
|
|
5
|
+
import { User } from "./1_user.js";
|
|
6
|
+
export interface MessageReactions {
|
|
7
|
+
chat: ChatP;
|
|
8
|
+
messageId: number;
|
|
9
|
+
user?: User;
|
|
10
|
+
actorChat?: ChatP;
|
|
11
|
+
date: Date;
|
|
12
|
+
oldReactions: Reaction[];
|
|
13
|
+
newReactions: Reaction[];
|
|
14
|
+
}
|
|
15
|
+
export declare function constructMessageReactions(update: types.UpdateBotMessageReaction, getEntity: EntityGetter): Promise<MessageReactions | null>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { cleanObject, fromUnixTimestamp } from "../1_utilities.js";
|
|
2
|
+
import { types } from "../2_tl.js";
|
|
3
|
+
import { constructReaction } from "./0_reaction.js";
|
|
4
|
+
import { constructChatP } from "./1_chat_p.js";
|
|
5
|
+
import { constructUser } from "./1_user.js";
|
|
6
|
+
export async function constructMessageReactions(update, getEntity) {
|
|
7
|
+
const date = fromUnixTimestamp(update.date);
|
|
8
|
+
const oldReactions = update.old_reactions.map((v) => constructReaction(v));
|
|
9
|
+
const newReactions = update.new_reactions.map((v) => constructReaction(v));
|
|
10
|
+
const messageId = update.msg_id;
|
|
11
|
+
let entity = await getEntity(update.peer);
|
|
12
|
+
if (!entity) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const chat = constructChatP(entity);
|
|
16
|
+
let user = undefined;
|
|
17
|
+
let actorChat = undefined;
|
|
18
|
+
entity = await getEntity(update.actor);
|
|
19
|
+
if (!entity) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (entity instanceof types.User) {
|
|
23
|
+
user = constructUser(entity);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
actorChat = constructChatP(entity);
|
|
27
|
+
}
|
|
28
|
+
return cleanObject({
|
|
29
|
+
chat,
|
|
30
|
+
messageId,
|
|
31
|
+
user,
|
|
32
|
+
actorChat,
|
|
33
|
+
date,
|
|
34
|
+
oldReactions,
|
|
35
|
+
newReactions,
|
|
36
|
+
});
|
|
37
|
+
}
|