@mtkruto/node 0.1.133 → 0.1.135
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_errors.d.ts +519 -510
- package/esm/3_errors.js +521 -509
- package/esm/3_types.d.ts +16 -7
- package/esm/3_types.js +16 -7
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.js +1 -1
- package/esm/4_errors.d.ts +7 -12
- package/esm/4_errors.js +6 -7
- package/esm/5_client.d.ts +3 -3
- package/esm/5_client.js +3 -3
- package/esm/client/0_utilities.d.ts +28 -0
- package/esm/client/0_utilities.js +10 -0
- package/esm/client/1_composer.d.ts +30 -0
- package/esm/client/{4_composer.js → 1_composer.js} +3 -2
- package/esm/client/2_client_plain.d.ts +1 -1
- package/esm/client/2_client_plain.js +1 -1
- package/{script/client/3_types.d.ts → esm/client/3_params.d.ts} +68 -177
- package/esm/client/3_params.js +1 -0
- package/esm/client/{5_client.d.ts → 4_client.d.ts} +57 -25
- package/esm/client/{5_client.js → 4_client.js} +347 -160
- package/esm/client/5_composer.d.ts +4 -0
- package/esm/client/5_composer.js +3 -0
- package/esm/storage/0_storage.d.ts +4 -1
- package/esm/storage/0_storage.js +36 -7
- package/esm/storage/1_storage_indexed_db.d.ts +6 -2
- package/esm/storage/1_storage_indexed_db.js +7 -5
- package/esm/storage/1_storage_local_storage.d.ts +1 -1
- package/esm/storage/1_storage_local_storage.js +1 -1
- package/esm/storage/1_storage_memory.d.ts +1 -1
- package/esm/storage/1_storage_memory.js +1 -1
- package/esm/storage/1_storage_session_storage.d.ts +1 -1
- package/esm/storage/1_storage_session_storage.js +1 -1
- package/esm/tl/3_utilities.d.ts +1 -0
- package/esm/tl/3_utilities.js +14 -0
- package/esm/tl/6_message.js +1 -1
- package/esm/types/0_authorization_state.d.ts +5 -0
- package/esm/types/0_authorization_state.js +1 -0
- package/esm/types/0_connection_state.d.ts +17 -0
- package/esm/types/0_connection_state.js +1 -0
- package/esm/types/0_login_url.d.ts +0 -4
- package/esm/types/0_mask_position.d.ts +0 -4
- package/esm/types/0_message_entity.d.ts +0 -2
- package/esm/types/0_message_identifier.d.ts +4 -0
- package/esm/types/0_message_identifier.js +1 -0
- package/esm/types/0_network_statistics_entry.d.ts +4 -0
- package/esm/types/0_network_statistics_entry.js +1 -0
- package/esm/types/0_reaction.d.ts +1 -0
- package/esm/types/0_reaction.js +13 -0
- package/esm/types/1__getters.d.ts +3 -0
- package/esm/types/1_chat_p.d.ts +1 -0
- package/esm/types/1_keyboard_button.d.ts +1 -23
- package/esm/types/1_network_statistics.d.ts +5 -0
- package/esm/types/1_network_statistics.js +1 -0
- package/esm/types/1_poll.d.ts +0 -13
- package/esm/types/1_reaction_count.d.ts +7 -0
- package/esm/types/1_reaction_count.js +6 -0
- package/esm/types/2_game.d.ts +0 -7
- package/esm/types/2_inline_keyboard_button.d.ts +0 -8
- package/esm/types/2_inline_query.d.ts +0 -6
- package/esm/types/2_message_interactions.d.ts +8 -0
- package/esm/types/2_message_interactions.js +1 -0
- package/esm/types/2_message_reaction_count.d.ts +8 -0
- package/esm/types/2_message_reaction_count.js +1 -0
- package/esm/types/2_reply_keyboard_markup.d.ts +0 -7
- package/esm/types/3_inline_keyboard_markup.d.ts +0 -2
- package/{script/types/3_message.d.ts → esm/types/4_message.d.ts} +225 -7
- package/esm/types/{3_message.js → 4_message.js} +14 -24
- package/{script/types/4_callback_query.d.ts → esm/types/5_callback_query.d.ts} +1 -1
- package/esm/types/{4_chat.d.ts → 5_chat.d.ts} +3 -3
- package/esm/types/{4_chat.js → 5_chat.js} +2 -2
- package/esm/types/6_update.d.ts +134 -0
- package/esm/types/6_update.js +1 -0
- package/package.json +1 -1
- package/script/3_errors.d.ts +519 -510
- package/script/3_errors.js +533 -520
- package/script/3_types.d.ts +16 -7
- package/script/3_types.js +16 -7
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.js +1 -1
- package/script/4_errors.d.ts +7 -12
- package/script/4_errors.js +5 -6
- package/script/5_client.d.ts +3 -3
- package/script/5_client.js +3 -3
- package/script/client/0_utilities.d.ts +28 -0
- package/script/client/0_utilities.js +12 -1
- package/script/client/1_composer.d.ts +30 -0
- package/script/client/{4_composer.js → 1_composer.js} +5 -4
- package/script/client/2_client_plain.d.ts +1 -1
- package/script/client/2_client_plain.js +2 -2
- package/{esm/client/3_types.d.ts → script/client/3_params.d.ts} +68 -177
- package/script/client/3_params.js +2 -0
- package/script/client/{5_client.d.ts → 4_client.d.ts} +57 -25
- package/script/client/{5_client.js → 4_client.js} +353 -166
- package/script/client/5_composer.d.ts +4 -0
- package/script/client/{6_composer.js → 5_composer.js} +2 -2
- package/script/storage/0_storage.d.ts +4 -1
- package/script/storage/0_storage.js +36 -7
- package/script/storage/1_storage_indexed_db.d.ts +6 -2
- package/script/storage/1_storage_indexed_db.js +7 -5
- package/script/storage/1_storage_local_storage.d.ts +1 -1
- package/script/storage/1_storage_local_storage.js +1 -1
- package/script/storage/1_storage_memory.d.ts +1 -1
- package/script/storage/1_storage_memory.js +1 -1
- package/script/storage/1_storage_session_storage.d.ts +1 -1
- package/script/storage/1_storage_session_storage.js +1 -1
- package/script/tl/3_utilities.d.ts +1 -0
- package/script/tl/3_utilities.js +16 -1
- package/script/tl/6_message.js +1 -1
- package/script/types/0_authorization_state.d.ts +5 -0
- package/script/types/0_authorization_state.js +2 -0
- package/script/types/0_connection_state.d.ts +17 -0
- package/script/types/0_connection_state.js +2 -0
- package/script/types/0_login_url.d.ts +0 -4
- package/script/types/0_mask_position.d.ts +0 -4
- package/script/types/0_message_entity.d.ts +0 -2
- package/script/types/0_message_identifier.d.ts +4 -0
- package/script/types/0_message_identifier.js +2 -0
- package/script/types/0_network_statistics_entry.d.ts +4 -0
- package/script/types/0_network_statistics_entry.js +2 -0
- package/script/types/0_reaction.d.ts +1 -0
- package/script/types/0_reaction.js +15 -1
- package/script/types/1__getters.d.ts +3 -0
- package/script/types/1_chat_p.d.ts +1 -0
- package/script/types/1_keyboard_button.d.ts +1 -23
- package/script/types/1_network_statistics.d.ts +5 -0
- package/script/types/1_network_statistics.js +2 -0
- package/script/types/1_poll.d.ts +0 -13
- package/script/types/1_reaction_count.d.ts +7 -0
- package/script/types/1_reaction_count.js +10 -0
- package/script/types/2_game.d.ts +0 -7
- package/script/types/2_inline_keyboard_button.d.ts +0 -8
- package/script/types/2_inline_query.d.ts +0 -6
- package/script/types/2_message_interactions.d.ts +8 -0
- package/script/types/2_message_interactions.js +2 -0
- package/script/types/2_message_reaction_count.d.ts +8 -0
- package/script/types/2_message_reaction_count.js +2 -0
- package/script/types/2_reply_keyboard_markup.d.ts +0 -7
- package/script/types/3_inline_keyboard_markup.d.ts +0 -2
- package/{esm/types/3_message.d.ts → script/types/4_message.d.ts} +225 -7
- package/script/types/{3_message.js → 4_message.js} +15 -25
- package/{esm/types/4_callback_query.d.ts → script/types/5_callback_query.d.ts} +1 -1
- package/script/types/{4_chat.d.ts → 5_chat.d.ts} +3 -3
- package/script/types/{4_chat.js → 5_chat.js} +3 -3
- package/script/types/6_update.d.ts +134 -0
- package/script/types/6_update.js +2 -0
- package/esm/client/3_types.js +0 -11
- package/esm/client/4_composer.d.ts +0 -31
- package/esm/client/6_composer.d.ts +0 -4
- package/esm/client/6_composer.js +0 -3
- package/script/client/3_types.js +0 -15
- package/script/client/4_composer.d.ts +0 -31
- package/script/client/6_composer.d.ts +0 -4
- /package/esm/client/{1_client_abstract.d.ts → 0_client_abstract.d.ts} +0 -0
- /package/esm/client/{1_client_abstract.js → 0_client_abstract.js} +0 -0
- /package/esm/types/{0_audio.d.ts → 1_audio.d.ts} +0 -0
- /package/esm/types/{0_audio.js → 1_audio.js} +0 -0
- /package/esm/types/{4_callback_query.js → 5_callback_query.js} +0 -0
- /package/script/client/{1_client_abstract.d.ts → 0_client_abstract.d.ts} +0 -0
- /package/script/client/{1_client_abstract.js → 0_client_abstract.js} +0 -0
- /package/script/types/{0_audio.d.ts → 1_audio.d.ts} +0 -0
- /package/script/types/{0_audio.js → 1_audio.js} +0 -0
- /package/script/types/{4_callback_query.js → 5_callback_query.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Composer = void 0;
|
|
4
|
-
const
|
|
5
|
-
class Composer extends
|
|
4
|
+
const _1_composer_js_1 = require("./1_composer.js");
|
|
5
|
+
class Composer extends _1_composer_js_1.Composer {
|
|
6
6
|
}
|
|
7
7
|
exports.Composer = Composer;
|
|
@@ -10,7 +10,7 @@ export type GetManyFilter = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare abstract class Storage {
|
|
12
12
|
#private;
|
|
13
|
-
abstract
|
|
13
|
+
abstract initialize(): MaybePromise<void>;
|
|
14
14
|
abstract set(key: readonly StorageKeyPart[], value: unknown): MaybePromise<void>;
|
|
15
15
|
abstract incr(key: readonly StorageKeyPart[], by: number): MaybePromise<void>;
|
|
16
16
|
abstract get<T>(key: readonly StorageKeyPart[]): MaybePromise<T | null>;
|
|
@@ -73,4 +73,7 @@ export declare abstract class Storage {
|
|
|
73
73
|
setFilePartCount(id: bigint, partCount: number): Promise<void>;
|
|
74
74
|
setCustomEmojiDocument(id: bigint, document: types.Document): Promise<void>;
|
|
75
75
|
getCustomEmojiDocument(id: bigint): Promise<[import("../tl/2_types.js").Document_, Date] | null>;
|
|
76
|
+
setUpdate(boxId: bigint, update: enums.Update): Promise<void>;
|
|
77
|
+
deleteUpdates(): Promise<void>;
|
|
78
|
+
getFirstUpdate(boxId: bigint): Promise<readonly [readonly StorageKeyPart[], import("../tl/2_types.js").UpdateNewMessage_ | import("../tl/2_types.js").UpdateMessageID_ | import("../tl/2_types.js").UpdateDeleteMessages_ | import("../tl/2_types.js").UpdateUserTyping_ | import("../tl/2_types.js").UpdateChatUserTyping_ | import("../tl/2_types.js").UpdateChatParticipants_ | import("../tl/2_types.js").UpdateUserStatus_ | import("../tl/2_types.js").UpdateUserName_ | import("../tl/2_types.js").UpdateNewAuthorization_ | import("../tl/2_types.js").UpdateNewEncryptedMessage_ | import("../tl/2_types.js").UpdateEncryptedChatTyping_ | import("../tl/2_types.js").UpdateEncryption_ | import("../tl/2_types.js").UpdateEncryptedMessagesRead_ | import("../tl/2_types.js").UpdateChatParticipantAdd_ | import("../tl/2_types.js").UpdateChatParticipantDelete_ | import("../tl/2_types.js").UpdateDcOptions_ | import("../tl/2_types.js").UpdateNotifySettings_ | import("../tl/2_types.js").UpdateServiceNotification_ | import("../tl/2_types.js").UpdatePrivacy_ | import("../tl/2_types.js").UpdateUserPhone_ | import("../tl/2_types.js").UpdateReadHistoryInbox_ | import("../tl/2_types.js").UpdateReadHistoryOutbox_ | import("../tl/2_types.js").UpdateWebPage_ | import("../tl/2_types.js").UpdateReadMessagesContents_ | import("../tl/2_types.js").UpdateChannelTooLong_ | import("../tl/2_types.js").UpdateChannel_ | import("../tl/2_types.js").UpdateNewChannelMessage_ | import("../tl/2_types.js").UpdateReadChannelInbox_ | import("../tl/2_types.js").UpdateDeleteChannelMessages_ | import("../tl/2_types.js").UpdateChannelMessageViews_ | import("../tl/2_types.js").UpdateChatParticipantAdmin_ | import("../tl/2_types.js").UpdateNewStickerSet_ | import("../tl/2_types.js").UpdateStickerSetsOrder_ | import("../tl/2_types.js").UpdateStickerSets_ | import("../tl/2_types.js").UpdateSavedGifs_ | import("../tl/2_types.js").UpdateBotInlineQuery_ | import("../tl/2_types.js").UpdateBotInlineSend_ | import("../tl/2_types.js").UpdateEditChannelMessage_ | import("../tl/2_types.js").UpdateBotCallbackQuery_ | import("../tl/2_types.js").UpdateEditMessage_ | import("../tl/2_types.js").UpdateInlineBotCallbackQuery_ | import("../tl/2_types.js").UpdateReadChannelOutbox_ | import("../tl/2_types.js").UpdateDraftMessage_ | import("../tl/2_types.js").UpdateReadFeaturedStickers_ | import("../tl/2_types.js").UpdateRecentStickers_ | import("../tl/2_types.js").UpdateConfig_ | import("../tl/2_types.js").UpdatePtsChanged_ | import("../tl/2_types.js").UpdateChannelWebPage_ | import("../tl/2_types.js").UpdateDialogPinned_ | import("../tl/2_types.js").UpdatePinnedDialogs_ | import("../tl/2_types.js").UpdateBotWebhookJSON_ | import("../tl/2_types.js").UpdateBotWebhookJSONQuery_ | import("../tl/2_types.js").UpdateBotShippingQuery_ | import("../tl/2_types.js").UpdateBotPrecheckoutQuery_ | import("../tl/2_types.js").UpdatePhoneCall_ | import("../tl/2_types.js").UpdateLangPackTooLong_ | import("../tl/2_types.js").UpdateLangPack_ | import("../tl/2_types.js").UpdateFavedStickers_ | import("../tl/2_types.js").UpdateChannelReadMessagesContents_ | import("../tl/2_types.js").UpdateContactsReset_ | import("../tl/2_types.js").UpdateChannelAvailableMessages_ | import("../tl/2_types.js").UpdateDialogUnreadMark_ | import("../tl/2_types.js").UpdateMessagePoll_ | import("../tl/2_types.js").UpdateChatDefaultBannedRights_ | import("../tl/2_types.js").UpdateFolderPeers_ | import("../tl/2_types.js").UpdatePeerSettings_ | import("../tl/2_types.js").UpdatePeerLocated_ | import("../tl/2_types.js").UpdateNewScheduledMessage_ | import("../tl/2_types.js").UpdateDeleteScheduledMessages_ | import("../tl/2_types.js").UpdateTheme_ | import("../tl/2_types.js").UpdateGeoLiveViewed_ | import("../tl/2_types.js").UpdateLoginToken_ | import("../tl/2_types.js").UpdateMessagePollVote_ | import("../tl/2_types.js").UpdateDialogFilter_ | import("../tl/2_types.js").UpdateDialogFilterOrder_ | import("../tl/2_types.js").UpdateDialogFilters_ | import("../tl/2_types.js").UpdatePhoneCallSignalingData_ | import("../tl/2_types.js").UpdateChannelMessageForwards_ | import("../tl/2_types.js").UpdateReadChannelDiscussionInbox_ | import("../tl/2_types.js").UpdateReadChannelDiscussionOutbox_ | import("../tl/2_types.js").UpdatePeerBlocked_ | import("../tl/2_types.js").UpdateChannelUserTyping_ | import("../tl/2_types.js").UpdatePinnedMessages_ | import("../tl/2_types.js").UpdatePinnedChannelMessages_ | import("../tl/2_types.js").UpdateChat_ | import("../tl/2_types.js").UpdateGroupCallParticipants_ | import("../tl/2_types.js").UpdateGroupCall_ | import("../tl/2_types.js").UpdatePeerHistoryTTL_ | import("../tl/2_types.js").UpdateChatParticipant_ | import("../tl/2_types.js").UpdateChannelParticipant_ | import("../tl/2_types.js").UpdateBotStopped_ | import("../tl/2_types.js").UpdateGroupCallConnection_ | import("../tl/2_types.js").UpdateBotCommands_ | import("../tl/2_types.js").UpdatePendingJoinRequests_ | import("../tl/2_types.js").UpdateBotChatInviteRequester_ | import("../tl/2_types.js").UpdateMessageReactions_ | import("../tl/2_types.js").UpdateAttachMenuBots_ | import("../tl/2_types.js").UpdateWebViewResultSent_ | import("../tl/2_types.js").UpdateBotMenuButton_ | import("../tl/2_types.js").UpdateSavedRingtones_ | import("../tl/2_types.js").UpdateTranscribedAudio_ | import("../tl/2_types.js").UpdateReadFeaturedEmojiStickers_ | import("../tl/2_types.js").UpdateUserEmojiStatus_ | import("../tl/2_types.js").UpdateRecentEmojiStatuses_ | import("../tl/2_types.js").UpdateRecentReactions_ | import("../tl/2_types.js").UpdateMoveStickerSetToTop_ | import("../tl/2_types.js").UpdateMessageExtendedMedia_ | import("../tl/2_types.js").UpdateChannelPinnedTopic_ | import("../tl/2_types.js").UpdateChannelPinnedTopics_ | import("../tl/2_types.js").UpdateUser_ | import("../tl/2_types.js").UpdateAutoSaveSettings_ | import("../tl/2_types.js").UpdateGroupInvitePrivacyForbidden_ | import("../tl/2_types.js").UpdateStory_ | import("../tl/2_types.js").UpdateReadStories_ | import("../tl/2_types.js").UpdateStoryID_ | import("../tl/2_types.js").UpdateStoriesStealthMode_ | import("../tl/2_types.js").UpdateSentStoryReaction_ | import("../tl/2_types.js").UpdateBotChatBoost_ | import("../tl/2_types.js").UpdateChannelViewForumAsMessages_ | import("../tl/2_types.js").UpdatePeerWallpaper_ | import("../tl/2_types.js").UpdateBotMessageReaction_ | import("../tl/2_types.js").UpdateBotMessageReactions_] | null>;
|
|
76
79
|
}
|
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _Storage_instances,
|
|
13
|
+
var _Storage_instances, _Storage_authKeyId, _Storage_resetAuthKeyId, _Storage_getEntityType, _Storage_getUpdateId;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.Storage = void 0;
|
|
16
16
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
@@ -27,6 +27,7 @@ const KPARTS__ACCOUNT_TYPE = ["accountType"];
|
|
|
27
27
|
const KPARTS__STICKER_SET_NAME = (id, accessHash) => ["stickerSetName", id, accessHash];
|
|
28
28
|
const KPARTS_MESSAGE = (chatId, messageId) => ["messages", chatId, messageId];
|
|
29
29
|
const KPARTS_MESSAGES = (chatId) => ["messages", chatId];
|
|
30
|
+
const KPARTS_ALL_MESSAGE_REFS = ["messageRefs"];
|
|
30
31
|
const KPARTS_MESSAGE_REF = (messageId) => ["messageRefs", messageId];
|
|
31
32
|
const KPARTS_HAS_ALL_CHATS = (listId) => ["hasAllChats", listId];
|
|
32
33
|
const KPARTS_CHATS = (listId) => ["chats", listId];
|
|
@@ -36,10 +37,13 @@ const KPARTS_SERVER_SALT = ["serverSalt"];
|
|
|
36
37
|
const KPARTS_FILE = (fileId) => ["files", fileId];
|
|
37
38
|
const KPARTS_FILE_PART = (fileId, n) => ["fileParts", fileId, n];
|
|
38
39
|
const KPARTS_CEMOJI = (id) => ["customEmojiDocuments", id];
|
|
40
|
+
const KPARTS_ALL_UPDATES = ["updates"];
|
|
41
|
+
const KPARTS_UPDATES = (boxId) => ["updates", boxId];
|
|
42
|
+
const KPARTS_UPDATE = (boxId, id) => ["updates", boxId, id];
|
|
39
43
|
class Storage {
|
|
40
44
|
constructor() {
|
|
41
45
|
_Storage_instances.add(this);
|
|
42
|
-
|
|
46
|
+
_Storage_authKeyId.set(this, null);
|
|
43
47
|
}
|
|
44
48
|
setDc(dc) {
|
|
45
49
|
return this.set(KPARTS__DC, dc);
|
|
@@ -57,7 +61,7 @@ class Storage {
|
|
|
57
61
|
await __classPrivateFieldGet(this, _Storage_instances, "m", _Storage_resetAuthKeyId).call(this, authKey);
|
|
58
62
|
}
|
|
59
63
|
get authKeyId() {
|
|
60
|
-
return __classPrivateFieldGet(this,
|
|
64
|
+
return __classPrivateFieldGet(this, _Storage_authKeyId, "f");
|
|
61
65
|
}
|
|
62
66
|
setChannelAccessHash(id, accessHash) {
|
|
63
67
|
return this.set(KPARTS__CHANNEL_ACCESS_HASH(id), accessHash);
|
|
@@ -112,7 +116,7 @@ class Storage {
|
|
|
112
116
|
}
|
|
113
117
|
async deleteMessages() {
|
|
114
118
|
const maybePromises = new Array();
|
|
115
|
-
for await (const [k, o] of await this.getMany({ prefix:
|
|
119
|
+
for await (const [k, o] of await this.getMany({ prefix: KPARTS_ALL_MESSAGE_REFS })) {
|
|
116
120
|
maybePromises.push(Promise.all([this.set(k, null), o == null ? Promise.resolve() : this.set(KPARTS_MESSAGE(o, k[1]), null)]).then(() => { }));
|
|
117
121
|
}
|
|
118
122
|
await Promise.all(maybePromises.filter((v) => v instanceof Promise));
|
|
@@ -271,14 +275,30 @@ class Storage {
|
|
|
271
275
|
return null;
|
|
272
276
|
}
|
|
273
277
|
}
|
|
278
|
+
async setUpdate(boxId, update) {
|
|
279
|
+
await this.setTlObject(KPARTS_UPDATE(boxId, __classPrivateFieldGet(this, _Storage_instances, "m", _Storage_getUpdateId).call(this, update)), update);
|
|
280
|
+
}
|
|
281
|
+
async deleteUpdates() {
|
|
282
|
+
const maybePromises = new Array();
|
|
283
|
+
for await (const [k] of await this.getMany({ prefix: KPARTS_ALL_UPDATES })) {
|
|
284
|
+
maybePromises.push(this.set(k, null));
|
|
285
|
+
}
|
|
286
|
+
await Promise.all(maybePromises.filter((v) => v instanceof Promise));
|
|
287
|
+
}
|
|
288
|
+
async getFirstUpdate(boxId) {
|
|
289
|
+
for await (const [key, update] of await this.getMany({ prefix: KPARTS_UPDATES(boxId) }, { limit: 1 })) {
|
|
290
|
+
return [key, await this.getTlObject(update).then((v) => v)];
|
|
291
|
+
}
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
274
294
|
}
|
|
275
295
|
exports.Storage = Storage;
|
|
276
|
-
|
|
296
|
+
_Storage_authKeyId = new WeakMap(), _Storage_instances = new WeakSet(), _Storage_resetAuthKeyId = async function _Storage_resetAuthKeyId(authKey) {
|
|
277
297
|
if (authKey != null) {
|
|
278
|
-
__classPrivateFieldSet(this,
|
|
298
|
+
__classPrivateFieldSet(this, _Storage_authKeyId, await (0, _1_utilities_js_1.sha1)(authKey).then((hash) => (0, _1_utilities_js_1.bigIntFromBuffer)(hash.slice(-8), true, false)), "f");
|
|
279
299
|
}
|
|
280
300
|
else {
|
|
281
|
-
__classPrivateFieldSet(this,
|
|
301
|
+
__classPrivateFieldSet(this, _Storage_authKeyId, null, "f");
|
|
282
302
|
}
|
|
283
303
|
}, _Storage_getEntityType = function _Storage_getEntityType(entity) {
|
|
284
304
|
if (entity instanceof _2_tl_js_1.types.Channel || entity instanceof _2_tl_js_1.types.ChannelForbidden) {
|
|
@@ -293,4 +313,13 @@ _Storage__authKeyId = new WeakMap(), _Storage_instances = new WeakSet(), _Storag
|
|
|
293
313
|
else {
|
|
294
314
|
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
295
315
|
}
|
|
316
|
+
}, _Storage_getUpdateId = function _Storage_getUpdateId(update) {
|
|
317
|
+
let id = BigInt(Date.now()) << 32n;
|
|
318
|
+
if ("pts" in update && update.pts) {
|
|
319
|
+
id |= BigInt(update.pts);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
id |= BigInt(0xffffffffn);
|
|
323
|
+
}
|
|
324
|
+
return id;
|
|
296
325
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { GetManyFilter, Storage, StorageKeyPart } from "./0_storage.js";
|
|
2
|
+
export interface StorageIndexedDBParams {
|
|
3
|
+
/** Whether to store files. Defaults to true. */
|
|
4
|
+
fileStorage?: boolean;
|
|
5
|
+
}
|
|
2
6
|
export declare class StorageIndexedDB extends Storage {
|
|
3
7
|
#private;
|
|
4
8
|
database: IDBDatabase | null;
|
|
5
|
-
constructor(name: string);
|
|
9
|
+
constructor(name: string, params?: StorageIndexedDBParams);
|
|
6
10
|
get name(): string;
|
|
7
11
|
branch(id: string): StorageIndexedDB;
|
|
8
|
-
|
|
12
|
+
initialize(): Promise<void>;
|
|
9
13
|
get supportsFiles(): boolean;
|
|
10
14
|
set(k: readonly StorageKeyPart[], v: unknown, tx_?: IDBTransaction): Promise<void>;
|
|
11
15
|
get<T>(k: readonly StorageKeyPart[], tx_?: IDBTransaction | null, fix?: boolean): Promise<T | null>;
|
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _StorageIndexedDB_instances, _StorageIndexedDB_name, _StorageIndexedDB_id, _StorageIndexedDB_fixKey;
|
|
13
|
+
var _StorageIndexedDB_instances, _StorageIndexedDB_name, _StorageIndexedDB_id, _StorageIndexedDB_supportsFiles, _StorageIndexedDB_fixKey;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.StorageIndexedDB = void 0;
|
|
16
16
|
const _0_storage_js_1 = require("./0_storage.js");
|
|
@@ -18,7 +18,7 @@ const _0_utilities_js_1 = require("./0_utilities.js");
|
|
|
18
18
|
const VERSION = 1;
|
|
19
19
|
const KV_OBJECT_STORE = "kv";
|
|
20
20
|
class StorageIndexedDB extends _0_storage_js_1.Storage {
|
|
21
|
-
constructor(name) {
|
|
21
|
+
constructor(name, params) {
|
|
22
22
|
if (typeof indexedDB == "undefined") {
|
|
23
23
|
throw new Error("Unavailable in current environment");
|
|
24
24
|
}
|
|
@@ -32,7 +32,9 @@ class StorageIndexedDB extends _0_storage_js_1.Storage {
|
|
|
32
32
|
});
|
|
33
33
|
_StorageIndexedDB_name.set(this, void 0);
|
|
34
34
|
_StorageIndexedDB_id.set(this, null);
|
|
35
|
+
_StorageIndexedDB_supportsFiles.set(this, void 0);
|
|
35
36
|
__classPrivateFieldSet(this, _StorageIndexedDB_name, name, "f");
|
|
37
|
+
__classPrivateFieldSet(this, _StorageIndexedDB_supportsFiles, params?.fileStorage ?? true, "f");
|
|
36
38
|
}
|
|
37
39
|
get name() {
|
|
38
40
|
return __classPrivateFieldGet(this, _StorageIndexedDB_name, "f");
|
|
@@ -42,7 +44,7 @@ class StorageIndexedDB extends _0_storage_js_1.Storage {
|
|
|
42
44
|
__classPrivateFieldSet(storage, _StorageIndexedDB_id, id, "f");
|
|
43
45
|
return storage;
|
|
44
46
|
}
|
|
45
|
-
|
|
47
|
+
initialize() {
|
|
46
48
|
const db = indexedDB.open(this.name, VERSION);
|
|
47
49
|
return new Promise((res, rej) => {
|
|
48
50
|
db.onblocked = rej;
|
|
@@ -57,7 +59,7 @@ class StorageIndexedDB extends _0_storage_js_1.Storage {
|
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
61
|
get supportsFiles() {
|
|
60
|
-
return
|
|
62
|
+
return __classPrivateFieldGet(this, _StorageIndexedDB_supportsFiles, "f");
|
|
61
63
|
}
|
|
62
64
|
set(k, v, tx_) {
|
|
63
65
|
k = __classPrivateFieldGet(this, _StorageIndexedDB_instances, "m", _StorageIndexedDB_fixKey).call(this, k);
|
|
@@ -159,7 +161,7 @@ class StorageIndexedDB extends _0_storage_js_1.Storage {
|
|
|
159
161
|
}
|
|
160
162
|
}
|
|
161
163
|
exports.StorageIndexedDB = StorageIndexedDB;
|
|
162
|
-
_StorageIndexedDB_name = new WeakMap(), _StorageIndexedDB_id = new WeakMap(), _StorageIndexedDB_instances = new WeakSet(), _StorageIndexedDB_fixKey = function _StorageIndexedDB_fixKey(key) {
|
|
164
|
+
_StorageIndexedDB_name = new WeakMap(), _StorageIndexedDB_id = new WeakMap(), _StorageIndexedDB_supportsFiles = new WeakMap(), _StorageIndexedDB_instances = new WeakSet(), _StorageIndexedDB_fixKey = function _StorageIndexedDB_fixKey(key) {
|
|
163
165
|
if (__classPrivateFieldGet(this, _StorageIndexedDB_id, "f") !== null) {
|
|
164
166
|
return ["__S" + __classPrivateFieldGet(this, _StorageIndexedDB_id, "f"), ...key];
|
|
165
167
|
}
|
|
@@ -4,7 +4,7 @@ export declare class StorageLocalStorage extends Storage implements Storage {
|
|
|
4
4
|
constructor(prefix: string);
|
|
5
5
|
get prefix(): string;
|
|
6
6
|
branch(id: string): StorageLocalStorage;
|
|
7
|
-
|
|
7
|
+
initialize(): void;
|
|
8
8
|
get supportsFiles(): boolean;
|
|
9
9
|
get<T>(key_: readonly StorageKeyPart[]): T | null;
|
|
10
10
|
getMany<T>(filter: GetManyFilter, params?: {
|
|
@@ -3,7 +3,7 @@ import { GetManyFilter, Storage, StorageKeyPart } from "./0_storage.js";
|
|
|
3
3
|
export declare class StorageMemory extends Storage implements Storage {
|
|
4
4
|
#private;
|
|
5
5
|
protected map: Map<string, unknown>;
|
|
6
|
-
|
|
6
|
+
initialize(): void;
|
|
7
7
|
branch(id: string): Storage;
|
|
8
8
|
get supportsFiles(): boolean;
|
|
9
9
|
get<T>(key: readonly StorageKeyPart[]): NonNullable<T> | null;
|
|
@@ -5,7 +5,7 @@ export declare class StorageSessionStorage extends Storage implements Storage {
|
|
|
5
5
|
constructor(prefix: string);
|
|
6
6
|
get prefix(): string;
|
|
7
7
|
branch(id: string): StorageSessionStorage;
|
|
8
|
-
|
|
8
|
+
initialize(): void;
|
|
9
9
|
get supportsFiles(): boolean;
|
|
10
10
|
get<T>(key_: readonly StorageKeyPart[]): T | null;
|
|
11
11
|
getMany<T>(filter: GetManyFilter, params?: {
|
|
@@ -2,3 +2,4 @@ import { enums } from "./2_types.js";
|
|
|
2
2
|
export declare function getChannelChatId(channelId: bigint): number;
|
|
3
3
|
export declare function peerToChatId(peer: enums.Peer | enums.InputPeer): number;
|
|
4
4
|
export declare function chatIdToPeer(chatId: number): import("./2_types.js").PeerUser_ | import("./2_types.js").PeerChat_ | import("./2_types.js").PeerChannel_;
|
|
5
|
+
export declare function inputPeerToPeer(inputPeer: enums.InputPeer): import("./2_types.js").PeerUser_ | import("./2_types.js").PeerChat_ | import("./2_types.js").PeerChannel_;
|
package/script/tl/3_utilities.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.chatIdToPeer = exports.peerToChatId = exports.getChannelChatId = void 0;
|
|
3
|
+
exports.inputPeerToPeer = exports.chatIdToPeer = exports.peerToChatId = exports.getChannelChatId = void 0;
|
|
4
4
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
5
|
const _2_types_js_1 = require("./2_types.js");
|
|
6
6
|
function getChannelChatId(channelId) {
|
|
@@ -34,3 +34,18 @@ function chatIdToPeer(chatId) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
exports.chatIdToPeer = chatIdToPeer;
|
|
37
|
+
function inputPeerToPeer(inputPeer) {
|
|
38
|
+
if ("user_id" in inputPeer) {
|
|
39
|
+
return new _2_types_js_1.types.PeerUser(inputPeer);
|
|
40
|
+
}
|
|
41
|
+
else if ("chat_id" in inputPeer) {
|
|
42
|
+
return new _2_types_js_1.types.PeerChat(inputPeer);
|
|
43
|
+
}
|
|
44
|
+
else if ("channel_id" in inputPeer) {
|
|
45
|
+
return new _2_types_js_1.types.PeerChannel(inputPeer);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.inputPeerToPeer = inputPeerToPeer;
|
package/script/tl/6_message.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Message_ = exports.calculateLength = void 0;
|
|
4
4
|
const _1_tl_object_js_1 = require("./1_tl_object.js");
|
|
5
5
|
const _3_tl_reader_js_1 = require("./3_tl_reader.js");
|
|
6
|
-
const _4_tl_writer_js_1 = require("./4_tl_writer.js");
|
|
7
6
|
const _4_rpc_result_js_1 = require("./4_rpc_result.js");
|
|
7
|
+
const _4_tl_writer_js_1 = require("./4_tl_writer.js");
|
|
8
8
|
function calculateLength(object) {
|
|
9
9
|
let length = 0;
|
|
10
10
|
if (Array.isArray(object)) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The client is not connected.
|
|
3
|
+
* @unlisted
|
|
4
|
+
*/
|
|
5
|
+
export type ConnectionStateNotConnected = "notConnected";
|
|
6
|
+
/**
|
|
7
|
+
* The client is connected but recovering from an update gap.
|
|
8
|
+
* @unlisted
|
|
9
|
+
*/
|
|
10
|
+
export type ConnectionStateUpdating = "updating";
|
|
11
|
+
/**
|
|
12
|
+
* The client is connected and not recovering from an update gap.
|
|
13
|
+
* @unlisted
|
|
14
|
+
*/
|
|
15
|
+
export type ConnectionStateReady = "ready";
|
|
16
|
+
/** A client's connection state. */
|
|
17
|
+
export type ConnectionState = ConnectionStateNotConnected | ConnectionStateUpdating | ConnectionStateReady;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
export interface LoginUrl {
|
|
2
|
-
/** An HTTPS URL to be opened with the authorization data appended to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. */
|
|
3
2
|
url: string;
|
|
4
|
-
/** A different text to use for the button when the message is forwarded. */
|
|
5
3
|
forwardText?: string;
|
|
6
|
-
/** Username of a bot, which will be used for user authorization. See [Learn more.](https://core.telegram.org/widgets/login#setting-up-a-bot) If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. [Learn more.](https://core.telegram.org/widgets/login#linking-your-domain-to-the-bot) */
|
|
7
4
|
botUsername?: string;
|
|
8
|
-
/** Whether to ask the user to allow messages to be received from the specified bot. */
|
|
9
5
|
requestWriteAccess?: boolean;
|
|
10
6
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { enums } from "../2_tl.js";
|
|
2
2
|
export interface MaskPosition {
|
|
3
|
-
/** The part of the face relative to which the mask should be placed. One of "forehead", "eyes", "mouth", or "chin". */
|
|
4
3
|
point: "forehead" | "eyes" | "mouth" | "chin";
|
|
5
|
-
/** Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. */
|
|
6
4
|
xShift: number;
|
|
7
|
-
/** Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. */
|
|
8
5
|
yShift: number;
|
|
9
|
-
/** Mask scaling coefficient. For example, 2.0 means double size. */
|
|
10
6
|
scale: number;
|
|
11
7
|
}
|
|
12
8
|
export declare function constructMaskPosition({ n, x, y, zoom }: enums.MaskCoords): MaskPosition;
|
|
@@ -4,9 +4,7 @@ export type MessageEntityType = "mention" | "hashtag" | "botCommand" | "url" | "
|
|
|
4
4
|
/** @unlisted */
|
|
5
5
|
export interface MessageEntityBase {
|
|
6
6
|
type: MessageEntityType;
|
|
7
|
-
/** Offset in [UTF-16 code units](https://core.telegram.org/api/entities#entity-length) to the start of the entity */
|
|
8
7
|
offset: number;
|
|
9
|
-
/** Length of the entity in [UTF-16 code units](https://core.telegram.org/api/entities#entity-length) */
|
|
10
8
|
length: number;
|
|
11
9
|
}
|
|
12
10
|
/** @unlisted */
|
|
@@ -12,3 +12,4 @@ export interface ReactionCustomEmoji {
|
|
|
12
12
|
export type Reaction = ReactionEmoji | ReactionCustomEmoji;
|
|
13
13
|
export declare function constructReaction(reaction: enums.Reaction): Reaction;
|
|
14
14
|
export declare function reactionToTlObject(reaction: Reaction): enums.Reaction;
|
|
15
|
+
export declare function reactionEqual(left: Reaction, right: Reaction): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reactionToTlObject = exports.constructReaction = void 0;
|
|
3
|
+
exports.reactionEqual = exports.reactionToTlObject = exports.constructReaction = void 0;
|
|
4
4
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
5
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
6
|
function constructReaction(reaction) {
|
|
@@ -19,3 +19,17 @@ function reactionToTlObject(reaction) {
|
|
|
19
19
|
return reaction.type == "emoji" ? new _2_tl_js_1.types.ReactionEmoji({ emoticon: reaction.emoji }) : new _2_tl_js_1.types.ReactionCustomEmoji({ document_id: BigInt(reaction.id) });
|
|
20
20
|
}
|
|
21
21
|
exports.reactionToTlObject = reactionToTlObject;
|
|
22
|
+
function reactionEqual(left, right) {
|
|
23
|
+
if (left.type == "emoji") {
|
|
24
|
+
if (right.type == "emoji" && left.emoji == right.emoji) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else if (left.type == "customEmoji") {
|
|
29
|
+
if (right.type == "customEmoji" && left.id == right.id) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
exports.reactionEqual = reactionEqual;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { MaybePromise } from "../1_utilities.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
3
|
import { ChatID } from "./0_chat_id.js";
|
|
4
|
+
/** @unlisted */
|
|
4
5
|
export interface EntityGetter {
|
|
5
6
|
(peer: types.PeerUser): MaybePromise<types.User | null>;
|
|
6
7
|
(peer: types.PeerChat): MaybePromise<types.Chat | types.ChatForbidden | null>;
|
|
7
8
|
(peer: types.PeerChannel): MaybePromise<types.Channel | types.ChannelForbidden | null>;
|
|
8
9
|
(peer: types.PeerUser | types.PeerChat | types.PeerChannel): MaybePromise<types.User | types.Chat | types.ChatForbidden | types.Channel | types.ChannelForbidden | null>;
|
|
9
10
|
}
|
|
11
|
+
/** @unlisted */
|
|
10
12
|
export interface InputPeerGetter {
|
|
11
13
|
(id: ChatID): Promise<types.InputPeerUser | types.InputPeerChannel | types.InputPeerChat>;
|
|
12
14
|
}
|
|
15
|
+
/** @unlisted */
|
|
13
16
|
export interface UsernameResolver {
|
|
14
17
|
(username: string): MaybePromise<types.InputUser>;
|
|
15
18
|
}
|
|
@@ -78,3 +78,4 @@ export type ChatP = ChatPPrivate | ChatPGroup | ChatPSupergroup | ChatPChannel;
|
|
|
78
78
|
export declare function constructChatP(chat: types.User): ChatPPrivate;
|
|
79
79
|
export declare function constructChatP(chat: types.Chat | types.ChatForbidden): ChatPGroup;
|
|
80
80
|
export declare function constructChatP(chat: types.Channel | types.ChannelForbidden): ChatPSupergroup | ChatPChannel;
|
|
81
|
+
export declare function constructChatP(chat: types.User | types.Chat | types.ChatForbidden | types.Channel | types.ChannelForbidden): ChatP;
|
|
@@ -4,67 +4,45 @@ import { KeyboardButtonPollType } from "./0_keyboard_button_poll_type.js";
|
|
|
4
4
|
import { WebAppInfo } from "./0_web_app_info.js";
|
|
5
5
|
/** @unlisted */
|
|
6
6
|
export interface KeyboardButtonText {
|
|
7
|
-
/** The button's text. */
|
|
8
7
|
text: string;
|
|
9
8
|
}
|
|
10
|
-
/**
|
|
11
|
-
* This object defines the criteria used to request a suitable user. The identifier of the selected user will be shared with the bot when the corresponding button is pressed.
|
|
12
|
-
* @unlisted
|
|
13
|
-
*/
|
|
9
|
+
/** @unlisted */
|
|
14
10
|
export interface KeyboardButtonRequestUser extends KeyboardButtonText {
|
|
15
|
-
/** If specified, pressing the button will open a list of suitable users. Tapping on any user will send their identifier to the bot in a "user_shared" service message. Available in private chats only. */
|
|
16
11
|
requestUser: {
|
|
17
|
-
/** Signed 32-bit identifier of the request */
|
|
18
12
|
requestId: number;
|
|
19
|
-
/** Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied. */
|
|
20
13
|
userIsBot?: boolean;
|
|
21
|
-
/** Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied. */
|
|
22
14
|
userIsPremium?: boolean;
|
|
23
15
|
};
|
|
24
16
|
}
|
|
25
17
|
/** @unlisted */
|
|
26
18
|
export interface KeyboardButtonRequestChat extends KeyboardButtonText {
|
|
27
|
-
/** If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a "chat_shared" service message. Available in private chats only. */
|
|
28
19
|
requestChat: {
|
|
29
|
-
/** Signed 32-bit identifier of the request */
|
|
30
20
|
requestId: number;
|
|
31
|
-
/** Pass True to request a channel chat, pass False to request a group or a supergroup chat. */
|
|
32
21
|
chatIsChannel: boolean;
|
|
33
|
-
/** Pass True to request a forum supergroup, pass False to request a non-forum chat. If not specified, no additional restrictions are applied. */
|
|
34
22
|
chatIsForum?: boolean;
|
|
35
|
-
/** Pass True to request a supergroup or a channel with a username, pass False to request a chat without a username. If not specified, no additional restrictions are applied. */
|
|
36
23
|
chatHasUsername?: boolean;
|
|
37
|
-
/** Pass True to request a chat owned by the user. Otherwise, no additional restrictions are applied. */
|
|
38
24
|
chatIsCreated?: boolean;
|
|
39
|
-
/** A JSON-serialized object listing the required administrator rights of the user in the chat. The rights must be a superset of _bot_administrator_rights_. If not specified, no additional restrictions are applied. */
|
|
40
25
|
userAdministratorRights?: ChatAdministratorRights;
|
|
41
|
-
/** A JSON-serialized object listing the required administrator rights of the bot in the chat. The rights must be a subset of _user_administrator_rights_. If not specified, no additional restrictions are applied. */
|
|
42
26
|
botAdministratorRights?: ChatAdministratorRights;
|
|
43
|
-
/** Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied. */
|
|
44
27
|
botIsMember?: boolean;
|
|
45
28
|
};
|
|
46
29
|
}
|
|
47
30
|
/** @unlisted */
|
|
48
31
|
export interface KeyboardButtonRequestContact extends KeyboardButtonText {
|
|
49
|
-
/** If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. */
|
|
50
32
|
requestContact: true;
|
|
51
33
|
}
|
|
52
34
|
/** @unlisted */
|
|
53
35
|
export interface KeyboardButtonRequestLocation extends KeyboardButtonText {
|
|
54
|
-
/** If True, the user's current location will be sent when the button is pressed. Available in private chats only. */
|
|
55
36
|
requestLocation: true;
|
|
56
37
|
}
|
|
57
38
|
/** @unlisted */
|
|
58
39
|
export interface KeyboardButtonRequestPoll extends KeyboardButtonText {
|
|
59
|
-
/** If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. */
|
|
60
40
|
requestPoll: KeyboardButtonPollType;
|
|
61
41
|
}
|
|
62
42
|
/** @unlisted */
|
|
63
43
|
export interface KeyboardButtonWebApp extends KeyboardButtonText {
|
|
64
|
-
/** If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a "web_app_data" service message. Available in private chats only. */
|
|
65
44
|
webApp: WebAppInfo;
|
|
66
45
|
}
|
|
67
|
-
/** This object represents one button of the reply keyboard. For simple text buttons, _String_ can be used instead of this object to specify the button text. The optional fields _web_app_, _request_user_, _request_chat_, _request_contact_, _request_location_, and _request_poll_ are mutually exclusive. */
|
|
68
46
|
export type KeyboardButton = KeyboardButtonText | KeyboardButtonRequestUser | KeyboardButtonRequestChat | KeyboardButtonRequestContact | KeyboardButtonRequestLocation | KeyboardButtonRequestPoll | KeyboardButtonWebApp;
|
|
69
47
|
export declare function constructKeyboardButton(button_: enums.KeyboardButton): KeyboardButton;
|
|
70
48
|
export declare function keyboardButtonToTlObject(button: KeyboardButton): import("../tl/2_types.js").KeyboardButton_ | import("../tl/2_types.js").KeyboardButtonRequestPhone_ | import("../tl/2_types.js").KeyboardButtonRequestGeoLocation_ | import("../tl/2_types.js").KeyboardButtonRequestPoll_ | import("../tl/2_types.js").KeyboardButtonWebView_ | import("../tl/2_types.js").KeyboardButtonRequestPeer_;
|
package/script/types/1_poll.d.ts
CHANGED
|
@@ -2,31 +2,18 @@ import { types } from "../2_tl.js";
|
|
|
2
2
|
import { MessageEntity } from "./0_message_entity.js";
|
|
3
3
|
import { PollOption } from "./0_poll_option.js";
|
|
4
4
|
export interface Poll {
|
|
5
|
-
/** Unique poll identifier */
|
|
6
5
|
id: string;
|
|
7
|
-
/** Poll question, 1-300 characters */
|
|
8
6
|
question: string;
|
|
9
|
-
/** List of poll options */
|
|
10
7
|
options: PollOption[];
|
|
11
|
-
/** Total number of users that voted in the poll */
|
|
12
8
|
totalVoterCount: number;
|
|
13
|
-
/** True, if the poll is closed */
|
|
14
9
|
isClosed: boolean;
|
|
15
|
-
/** True, if the poll is anonymous */
|
|
16
10
|
isAnonymous: boolean;
|
|
17
|
-
/** Poll type, currently can be "regular" or "quiz" */
|
|
18
11
|
type: "regular" | "quiz";
|
|
19
|
-
/** True, if the poll allows multiple answers */
|
|
20
12
|
allowMultipleAnswers?: boolean;
|
|
21
|
-
/** Index of the correct answer in `options`. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. */
|
|
22
13
|
correctOptionIndex?: number;
|
|
23
|
-
/** Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters */
|
|
24
14
|
explanation?: string;
|
|
25
|
-
/** Special entities like usernames, URLs, bot commands, etc. that appear in the explanation */
|
|
26
15
|
explanationEntities?: MessageEntity[];
|
|
27
|
-
/** Amount of time in seconds the poll will be active after creation */
|
|
28
16
|
openPeriod?: number;
|
|
29
|
-
/** Point in time (Unix timestamp) when the poll will be automatically closed */
|
|
30
17
|
closeDate?: Date;
|
|
31
18
|
}
|
|
32
19
|
export declare function constructPoll(media_: types.MessageMediaPoll): Poll;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constructReactionCount = void 0;
|
|
4
|
+
const _0_reaction_js_1 = require("./0_reaction.js");
|
|
5
|
+
function constructReactionCount(reaction_) {
|
|
6
|
+
const reaction = (0, _0_reaction_js_1.constructReaction)(reaction_.reaction);
|
|
7
|
+
const count = reaction_.count;
|
|
8
|
+
return { reaction, count };
|
|
9
|
+
}
|
|
10
|
+
exports.constructReactionCount = constructReactionCount;
|