@mtkruto/node 0.1.500 → 0.1.600
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 +6 -1
- package/esm/3_types.js +6 -1
- package/esm/client/0_params.d.ts +28 -6
- package/esm/client/1_file_manager.d.ts +5 -1
- package/esm/client/1_file_manager.js +50 -49
- package/esm/client/2_video_chat_manager.d.ts +43 -0
- package/esm/client/2_video_chat_manager.js +194 -0
- package/esm/client/3_callback_query_manager.js +1 -0
- package/esm/client/3_chat_list_manager.d.ts +3 -3
- package/esm/client/3_chat_list_manager.js +75 -98
- package/esm/client/3_inline_query_manager.js +1 -0
- package/esm/client/4_client.d.ts +67 -3
- package/esm/client/4_client.js +92 -3
- package/esm/storage/0_storage.d.ts +14 -0
- package/esm/storage/0_storage.js +39 -2
- package/esm/tl/3_utilities.d.ts +1 -1
- package/esm/tl/3_utilities.js +3 -3
- package/esm/types/0_birthday.d.ts +27 -0
- package/esm/types/0_birthday.js +26 -0
- package/esm/types/0_giveaway_parameters.d.ts +1 -1
- package/esm/types/0_live_stream_channel.d.ts +30 -0
- package/esm/types/0_live_stream_channel.js +26 -0
- package/esm/types/0_opening_hours.d.ts +25 -0
- package/esm/types/0_opening_hours.js +25 -0
- package/esm/types/0_video_chat.d.ts +60 -0
- package/esm/types/0_video_chat.js +53 -0
- package/esm/types/1_chat_p.d.ts +4 -0
- package/esm/types/1_chat_p.js +1 -0
- package/esm/types/2_business_connection.d.ts +6 -0
- package/esm/types/2_chat.d.ts +62 -0
- package/esm/types/2_chat.js +66 -0
- package/esm/types/2_inactive_chat.d.ts +1 -1
- package/esm/types/2_invite_link.d.ts +1 -1
- package/esm/types/2_message_reaction_count.d.ts +1 -1
- package/esm/types/2_message_reactions.d.ts +1 -1
- package/esm/types/3_chat_member_updated.d.ts +1 -1
- package/esm/types/4_message.d.ts +3 -3
- package/esm/types/5_chat_list_item.d.ts +35 -0
- package/esm/types/5_chat_list_item.js +86 -0
- package/esm/types/6_update.d.ts +14 -5
- package/esm/types/_file_id.d.ts +1 -0
- package/esm/utilities/0_bigint.d.ts +1 -0
- package/esm/utilities/0_bigint.js +7 -3
- package/package.json +1 -1
- package/script/3_types.d.ts +6 -1
- package/script/3_types.js +6 -1
- package/script/client/0_params.d.ts +28 -6
- package/script/client/1_file_manager.d.ts +5 -1
- package/script/client/1_file_manager.js +50 -49
- package/script/client/2_video_chat_manager.d.ts +43 -0
- package/script/client/2_video_chat_manager.js +198 -0
- package/script/client/3_callback_query_manager.js +1 -0
- package/script/client/3_chat_list_manager.d.ts +3 -3
- package/script/client/3_chat_list_manager.js +72 -95
- package/script/client/3_inline_query_manager.js +1 -0
- package/script/client/4_client.d.ts +67 -3
- package/script/client/4_client.js +92 -3
- package/script/storage/0_storage.d.ts +14 -0
- package/script/storage/0_storage.js +39 -2
- package/script/tl/3_utilities.d.ts +1 -1
- package/script/tl/3_utilities.js +3 -3
- package/script/types/0_birthday.d.ts +27 -0
- package/script/types/0_birthday.js +30 -0
- package/script/types/0_giveaway_parameters.d.ts +1 -1
- package/script/types/0_live_stream_channel.d.ts +30 -0
- package/script/types/0_live_stream_channel.js +30 -0
- package/script/types/0_opening_hours.d.ts +25 -0
- package/script/types/0_opening_hours.js +29 -0
- package/script/types/0_video_chat.d.ts +60 -0
- package/script/types/0_video_chat.js +57 -0
- package/script/types/1_chat_p.d.ts +4 -0
- package/script/types/1_chat_p.js +1 -0
- package/script/types/2_business_connection.d.ts +6 -0
- package/script/types/2_chat.d.ts +62 -0
- package/script/types/2_chat.js +70 -0
- package/script/types/2_inactive_chat.d.ts +1 -1
- package/script/types/2_invite_link.d.ts +1 -1
- package/script/types/2_message_reaction_count.d.ts +1 -1
- package/script/types/2_message_reactions.d.ts +1 -1
- package/script/types/3_chat_member_updated.d.ts +1 -1
- package/script/types/4_message.d.ts +3 -3
- package/script/types/5_chat_list_item.d.ts +35 -0
- package/script/types/5_chat_list_item.js +94 -0
- package/script/types/6_update.d.ts +14 -5
- package/script/types/_file_id.d.ts +1 -0
- package/script/utilities/0_bigint.d.ts +1 -0
- package/script/utilities/0_bigint.js +7 -3
- package/esm/types/5_chat.d.ts +0 -59
- package/esm/types/5_chat.js +0 -126
- package/script/types/5_chat.d.ts +0 -59
- package/script/types/5_chat.js +0 -134
|
@@ -21,9 +21,9 @@ import { MaybePromise } from "../1_utilities.js";
|
|
|
21
21
|
import { enums, functions, types } from "../2_tl.js";
|
|
22
22
|
import { Storage } from "../3_storage.js";
|
|
23
23
|
import { DC } from "../3_transport.js";
|
|
24
|
-
import { BotCommand, BusinessConnection, CallbackQueryAnswer, CallbackQueryQuestion, Chat, ChatAction, ChatMember, ChatP, FileSource, ID, InactiveChat, InlineQueryAnswer, InlineQueryResult, InputMedia, InputStoryContent, InviteLink, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageLocation, MessagePhoto, MessagePoll, MessageSticker, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, NetworkStatistics, ParseMode, Poll, Reaction, Sticker, Story, Update, User } from "../3_types.js";
|
|
24
|
+
import { BotCommand, BusinessConnection, CallbackQueryAnswer, CallbackQueryQuestion, Chat, ChatAction, ChatListItem, ChatMember, ChatP, FileSource, ID, InactiveChat, InlineQueryAnswer, InlineQueryResult, InputMedia, InputStoryContent, InviteLink, LiveStreamChannel, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageLocation, MessagePhoto, MessagePoll, MessageSticker, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, NetworkStatistics, ParseMode, Poll, Reaction, Sticker, Story, Update, User, VideoChat, VideoChatActive, VideoChatScheduled } from "../3_types.js";
|
|
25
25
|
import { Migrate } from "../4_errors.js";
|
|
26
|
-
import { AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, BanChatMemberParams, CreateInviteLinkParams, CreateStoryParams, DeleteMessageParams, DeleteMessagesParams, DownloadParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetMyCommandsParams, PinMessageParams, ReplyParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendInlineQueryParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams, SetMyCommandsParams, SetReactionsParams, StopPollParams } from "./0_params.js";
|
|
26
|
+
import { AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, BanChatMemberParams, CreateInviteLinkParams, CreateStoryParams, DeleteMessageParams, DeleteMessagesParams, DownloadLiveStreamChunkParams, DownloadParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetMyCommandsParams, JoinVideoChatParams, PinMessageParams, ReplyParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendInlineQueryParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams, SetMyCommandsParams, SetReactionsParams, StartVideoChatParams, StopPollParams } from "./0_params.js";
|
|
27
27
|
import { Api } from "./0_types.js";
|
|
28
28
|
import { ClientPlainParams } from "./1_client_plain.js";
|
|
29
29
|
import { Composer as Composer_, NextFunction } from "./1_composer.js";
|
|
@@ -706,7 +706,7 @@ export declare class Client<C extends Context = Context> extends Composer<C> {
|
|
|
706
706
|
*
|
|
707
707
|
* @method ch
|
|
708
708
|
*/
|
|
709
|
-
getChats(params?: GetChatsParams): Promise<
|
|
709
|
+
getChats(params?: GetChatsParams): Promise<ChatListItem[]>;
|
|
710
710
|
/**
|
|
711
711
|
* Get a chat.
|
|
712
712
|
*
|
|
@@ -1087,5 +1087,69 @@ export declare class Client<C extends Context = Context> extends Composer<C> {
|
|
|
1087
1087
|
* @param userId The identifier of the user to unblock.
|
|
1088
1088
|
*/
|
|
1089
1089
|
unblockUser(userId: ID): Promise<void>;
|
|
1090
|
+
/**
|
|
1091
|
+
* Start a video chat. User-only.
|
|
1092
|
+
*
|
|
1093
|
+
* @method vc
|
|
1094
|
+
* @param chatId The chat to start the video chat in.
|
|
1095
|
+
* @returns The started video chat.
|
|
1096
|
+
*/
|
|
1097
|
+
startVideoChat(chatId: ID, params?: StartVideoChatParams): Promise<VideoChatActive>;
|
|
1098
|
+
/**
|
|
1099
|
+
* Schedule a video chat. User-only.
|
|
1100
|
+
*
|
|
1101
|
+
* @method vc
|
|
1102
|
+
* @param chatId The chat to schedule the video chat in.
|
|
1103
|
+
* @param startAt A point in time within the future in which the video chat will be started.
|
|
1104
|
+
* @returns The scheduled video chat.
|
|
1105
|
+
*/
|
|
1106
|
+
scheduleVideoChat(chatId: ID, startAt: Date, params?: ScheduleVideoChatParams): Promise<VideoChatScheduled>;
|
|
1107
|
+
/**
|
|
1108
|
+
* Join a video chat. User-only.
|
|
1109
|
+
*
|
|
1110
|
+
* @method vc
|
|
1111
|
+
* @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
|
|
1112
|
+
* @param params_ WebRTC connection parameters.
|
|
1113
|
+
* @returns Parameters to be passed to the used WebRTC library.
|
|
1114
|
+
*/
|
|
1115
|
+
joinVideoChat(id: string, params_: string, params?: JoinVideoChatParams): Promise<string>;
|
|
1116
|
+
/**
|
|
1117
|
+
* Leave a video chat. User-only.
|
|
1118
|
+
*
|
|
1119
|
+
* @method vc
|
|
1120
|
+
* @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
|
|
1121
|
+
*/
|
|
1122
|
+
leaveVideoChat(id: string): Promise<void>;
|
|
1123
|
+
/**
|
|
1124
|
+
* Join a live stream. User-only.
|
|
1125
|
+
*
|
|
1126
|
+
* @method vc
|
|
1127
|
+
* @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
|
|
1128
|
+
*/
|
|
1129
|
+
joinLiveStream(id: string): Promise<void>;
|
|
1130
|
+
/**
|
|
1131
|
+
* Get a video chat. User-only.
|
|
1132
|
+
*
|
|
1133
|
+
* @method vc
|
|
1134
|
+
* @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
|
|
1135
|
+
*/
|
|
1136
|
+
getVideoChat(id: string): Promise<VideoChat>;
|
|
1137
|
+
/**
|
|
1138
|
+
* Get live stream channels. User-only.
|
|
1139
|
+
*
|
|
1140
|
+
* @method vc
|
|
1141
|
+
* @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
|
|
1142
|
+
*/
|
|
1143
|
+
getLiveStreamChannels(id: string): Promise<LiveStreamChannel[]>;
|
|
1144
|
+
/**
|
|
1145
|
+
* Download a live stream chunk. User-only.
|
|
1146
|
+
*
|
|
1147
|
+
* @method vc
|
|
1148
|
+
* @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
|
|
1149
|
+
* @param channelId Stream channel ID.
|
|
1150
|
+
* @param scale Stream channel scale.
|
|
1151
|
+
* @param timestamp Millisecond timestamp of the chunk to download.
|
|
1152
|
+
*/
|
|
1153
|
+
downloadLiveStreamChunk(id: string, channelId: number, scale: number, timestamp: number, params?: DownloadLiveStreamChunkParams): AsyncGenerator<Uint8Array, void, unknown>;
|
|
1090
1154
|
}
|
|
1091
1155
|
export {};
|
|
@@ -29,7 +29,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
29
29
|
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");
|
|
30
30
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
31
31
|
};
|
|
32
|
-
var _Client_instances, _a, _Client_client, _Client_guaranteeUpdateDelivery, _Client_updateManager, _Client_networkStatisticsManager, _Client_botInfoManager, _Client_fileManager, _Client_reactionManager, _Client_businessConnectionManager, _Client_messageManager, _Client_storyManager, _Client_callbackQueryManager, _Client_inlineQueryManager, _Client_chatListManager, _Client_accountManager, _Client_parseMode, _Client_publicKeys, _Client_ignoreOutgoing, _Client_storeMessages, _Client_Lauthorize, _Client_LpingLoop, _Client_LhandleMigrationError, _Client_L$initConncetion, _Client_namespaceProxies, _Client_getApiId, _Client_getCdnConnectionPool, _Client_getCdnConnection, _Client_constructContext, _Client_propagateConnectionState, _Client_lastPropagatedConnectionState, _Client_stateChangeHandler, _Client_storageInited, _Client_initStorage, _Client_connectionInited, _Client_lastPropagatedAuthorizationState, _Client_propagateAuthorizationState, _Client_getSelfId, _Client_pingLoopStarted, _Client_pingLoopAbortController, _Client_pingInterval, _Client_lastUpdates, _Client_startPingLoop, _Client_pingLoop, _Client_invoke, _Client_handleInvokeError, _Client_getUserAccessHash, _Client_getChannelAccessHash, _Client_getInputPeerInner, _Client_handleCtxUpdate, _Client_queueHandleCtxUpdate, _Client_handleUpdate, _Client_lastGetMe, _Client_getMe;
|
|
32
|
+
var _Client_instances, _a, _Client_client, _Client_guaranteeUpdateDelivery, _Client_updateManager, _Client_networkStatisticsManager, _Client_botInfoManager, _Client_fileManager, _Client_reactionManager, _Client_videoChatManager, _Client_businessConnectionManager, _Client_messageManager, _Client_storyManager, _Client_callbackQueryManager, _Client_inlineQueryManager, _Client_chatListManager, _Client_accountManager, _Client_parseMode, _Client_publicKeys, _Client_ignoreOutgoing, _Client_storeMessages, _Client_Lauthorize, _Client_LpingLoop, _Client_LhandleMigrationError, _Client_L$initConncetion, _Client_namespaceProxies, _Client_getApiId, _Client_getCdnConnectionPool, _Client_getCdnConnection, _Client_constructContext, _Client_propagateConnectionState, _Client_lastPropagatedConnectionState, _Client_stateChangeHandler, _Client_storageInited, _Client_initStorage, _Client_connectionInited, _Client_lastPropagatedAuthorizationState, _Client_propagateAuthorizationState, _Client_getSelfId, _Client_pingLoopStarted, _Client_pingLoopAbortController, _Client_pingInterval, _Client_lastUpdates, _Client_startPingLoop, _Client_pingLoop, _Client_invoke, _Client_handleInvokeError, _Client_getUserAccessHash, _Client_getChannelAccessHash, _Client_getInputPeerInner, _Client_handleCtxUpdate, _Client_queueHandleCtxUpdate, _Client_handleUpdate, _Client_lastGetMe, _Client_getMe;
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
34
|
exports.Client = exports.handleMigrationError = exports.restartAuth = exports.Composer = void 0;
|
|
35
35
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
@@ -57,6 +57,7 @@ const _3_callback_query_manager_js_1 = require("./3_callback_query_manager.js");
|
|
|
57
57
|
const _3_chat_list_manager_js_1 = require("./3_chat_list_manager.js");
|
|
58
58
|
const _3_inline_query_manager_js_1 = require("./3_inline_query_manager.js");
|
|
59
59
|
const _3_story_manager_js_1 = require("./3_story_manager.js");
|
|
60
|
+
const _2_video_chat_manager_js_1 = require("./2_video_chat_manager.js");
|
|
60
61
|
class Composer extends _1_composer_js_1.Composer {
|
|
61
62
|
}
|
|
62
63
|
exports.Composer = Composer;
|
|
@@ -102,6 +103,7 @@ class Client extends Composer {
|
|
|
102
103
|
_Client_botInfoManager.set(this, void 0);
|
|
103
104
|
_Client_fileManager.set(this, void 0);
|
|
104
105
|
_Client_reactionManager.set(this, void 0);
|
|
106
|
+
_Client_videoChatManager.set(this, void 0);
|
|
105
107
|
_Client_businessConnectionManager.set(this, void 0);
|
|
106
108
|
_Client_messageManager.set(this, void 0);
|
|
107
109
|
_Client_storyManager.set(this, void 0);
|
|
@@ -701,6 +703,7 @@ class Client extends Composer {
|
|
|
701
703
|
__classPrivateFieldSet(this, _Client_fileManager, new _1_file_manager_js_1.FileManager(c), "f");
|
|
702
704
|
__classPrivateFieldSet(this, _Client_reactionManager, new _1_reaction_manager_js_1.ReactionManager(c), "f");
|
|
703
705
|
__classPrivateFieldSet(this, _Client_businessConnectionManager, new _1_business_connection_manager_js_1.BusinessConnectionManager(c), "f");
|
|
706
|
+
__classPrivateFieldSet(this, _Client_videoChatManager, new _2_video_chat_manager_js_1.VideoChatManager({ ...c, fileManager: __classPrivateFieldGet(this, _Client_fileManager, "f") }), "f");
|
|
704
707
|
__classPrivateFieldSet(this, _Client_messageManager, new _2_message_manager_js_1.MessageManager({ ...c, fileManager: __classPrivateFieldGet(this, _Client_fileManager, "f") }), "f");
|
|
705
708
|
__classPrivateFieldSet(this, _Client_callbackQueryManager, new _3_callback_query_manager_js_1.CallbackQueryManager({ ...c, messageManager: __classPrivateFieldGet(this, _Client_messageManager, "f") }), "f");
|
|
706
709
|
__classPrivateFieldSet(this, _Client_storyManager, new _3_story_manager_js_1.StoryManager({ ...c, fileManager: __classPrivateFieldGet(this, _Client_fileManager, "f"), messageManager: __classPrivateFieldGet(this, _Client_messageManager, "f") }), "f");
|
|
@@ -815,7 +818,7 @@ class Client extends Composer {
|
|
|
815
818
|
}
|
|
816
819
|
await this.connect();
|
|
817
820
|
}
|
|
818
|
-
async [(_Client_client = new WeakMap(), _Client_guaranteeUpdateDelivery = new WeakMap(), _Client_updateManager = new WeakMap(), _Client_networkStatisticsManager = new WeakMap(), _Client_botInfoManager = new WeakMap(), _Client_fileManager = new WeakMap(), _Client_reactionManager = new WeakMap(), _Client_businessConnectionManager = new WeakMap(), _Client_messageManager = new WeakMap(), _Client_storyManager = new WeakMap(), _Client_callbackQueryManager = new WeakMap(), _Client_inlineQueryManager = new WeakMap(), _Client_chatListManager = new WeakMap(), _Client_accountManager = new WeakMap(), _Client_parseMode = new WeakMap(), _Client_publicKeys = new WeakMap(), _Client_ignoreOutgoing = new WeakMap(), _Client_storeMessages = new WeakMap(), _Client_Lauthorize = new WeakMap(), _Client_LpingLoop = new WeakMap(), _Client_LhandleMigrationError = new WeakMap(), _Client_L$initConncetion = new WeakMap(), _Client_namespaceProxies = new WeakMap(), _Client_constructContext = new WeakMap(), _Client_lastPropagatedConnectionState = new WeakMap(), _Client_stateChangeHandler = new WeakMap(), _Client_storageInited = new WeakMap(), _Client_connectionInited = new WeakMap(), _Client_lastPropagatedAuthorizationState = new WeakMap(), _Client_pingLoopStarted = new WeakMap(), _Client_pingLoopAbortController = new WeakMap(), _Client_pingInterval = new WeakMap(), _Client_lastUpdates = new WeakMap(), _Client_handleInvokeError = new WeakMap(), _Client_lastGetMe = new WeakMap(), _Client_instances = new WeakSet(), _Client_getApiId = async function _Client_getApiId() {
|
|
821
|
+
async [(_Client_client = new WeakMap(), _Client_guaranteeUpdateDelivery = new WeakMap(), _Client_updateManager = new WeakMap(), _Client_networkStatisticsManager = new WeakMap(), _Client_botInfoManager = new WeakMap(), _Client_fileManager = new WeakMap(), _Client_reactionManager = new WeakMap(), _Client_videoChatManager = new WeakMap(), _Client_businessConnectionManager = new WeakMap(), _Client_messageManager = new WeakMap(), _Client_storyManager = new WeakMap(), _Client_callbackQueryManager = new WeakMap(), _Client_inlineQueryManager = new WeakMap(), _Client_chatListManager = new WeakMap(), _Client_accountManager = new WeakMap(), _Client_parseMode = new WeakMap(), _Client_publicKeys = new WeakMap(), _Client_ignoreOutgoing = new WeakMap(), _Client_storeMessages = new WeakMap(), _Client_Lauthorize = new WeakMap(), _Client_LpingLoop = new WeakMap(), _Client_LhandleMigrationError = new WeakMap(), _Client_L$initConncetion = new WeakMap(), _Client_namespaceProxies = new WeakMap(), _Client_constructContext = new WeakMap(), _Client_lastPropagatedConnectionState = new WeakMap(), _Client_stateChangeHandler = new WeakMap(), _Client_storageInited = new WeakMap(), _Client_connectionInited = new WeakMap(), _Client_lastPropagatedAuthorizationState = new WeakMap(), _Client_pingLoopStarted = new WeakMap(), _Client_pingLoopAbortController = new WeakMap(), _Client_pingInterval = new WeakMap(), _Client_lastUpdates = new WeakMap(), _Client_handleInvokeError = new WeakMap(), _Client_lastGetMe = new WeakMap(), _Client_instances = new WeakSet(), _Client_getApiId = async function _Client_getApiId() {
|
|
819
822
|
const apiId = this.apiId || await this.storage.getApiId();
|
|
820
823
|
if (!apiId) {
|
|
821
824
|
throw new Error("apiId not set");
|
|
@@ -1107,7 +1110,7 @@ class Client extends Composer {
|
|
|
1107
1110
|
return new _2_tl_js_1.types.InputPeerSelf();
|
|
1108
1111
|
}
|
|
1109
1112
|
const inputPeer = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getInputPeerInner).call(this, id);
|
|
1110
|
-
if ((inputPeer instanceof _2_tl_js_1.types.InputPeerUser || inputPeer instanceof _2_tl_js_1.types.InputPeerChannel && inputPeer.access_hash == 0n) && await this.storage.getAccountType() == "bot") {
|
|
1113
|
+
if (((inputPeer instanceof _2_tl_js_1.types.InputPeerUser || inputPeer instanceof _2_tl_js_1.types.InputPeerChannel) && inputPeer.access_hash == 0n) && await this.storage.getAccountType() == "bot") {
|
|
1111
1114
|
if ("channel_id" in inputPeer) {
|
|
1112
1115
|
inputPeer.access_hash = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getChannelAccessHash).call(this, inputPeer.channel_id);
|
|
1113
1116
|
}
|
|
@@ -2294,6 +2297,89 @@ class Client extends Composer {
|
|
|
2294
2297
|
async unblockUser(userId) {
|
|
2295
2298
|
await __classPrivateFieldGet(this, _Client_messageManager, "f").unblockUser(userId);
|
|
2296
2299
|
}
|
|
2300
|
+
//
|
|
2301
|
+
// ========================= VIDEO CHATS ========================= //
|
|
2302
|
+
//
|
|
2303
|
+
/**
|
|
2304
|
+
* Start a video chat. User-only.
|
|
2305
|
+
*
|
|
2306
|
+
* @method vc
|
|
2307
|
+
* @param chatId The chat to start the video chat in.
|
|
2308
|
+
* @returns The started video chat.
|
|
2309
|
+
*/
|
|
2310
|
+
async startVideoChat(chatId, params) {
|
|
2311
|
+
return await __classPrivateFieldGet(this, _Client_videoChatManager, "f").startVideoChat(chatId, params);
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Schedule a video chat. User-only.
|
|
2315
|
+
*
|
|
2316
|
+
* @method vc
|
|
2317
|
+
* @param chatId The chat to schedule the video chat in.
|
|
2318
|
+
* @param startAt A point in time within the future in which the video chat will be started.
|
|
2319
|
+
* @returns The scheduled video chat.
|
|
2320
|
+
*/
|
|
2321
|
+
async scheduleVideoChat(chatId, startAt, params) {
|
|
2322
|
+
return await __classPrivateFieldGet(this, _Client_videoChatManager, "f").scheduleVideoChat(chatId, startAt, params);
|
|
2323
|
+
}
|
|
2324
|
+
/**
|
|
2325
|
+
* Join a video chat. User-only.
|
|
2326
|
+
*
|
|
2327
|
+
* @method vc
|
|
2328
|
+
* @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
|
|
2329
|
+
* @param params_ WebRTC connection parameters.
|
|
2330
|
+
* @returns Parameters to be passed to the used WebRTC library.
|
|
2331
|
+
*/
|
|
2332
|
+
async joinVideoChat(id, params_, params) {
|
|
2333
|
+
return await __classPrivateFieldGet(this, _Client_videoChatManager, "f").joinVideoChat(id, params_, params);
|
|
2334
|
+
}
|
|
2335
|
+
/**
|
|
2336
|
+
* Leave a video chat. User-only.
|
|
2337
|
+
*
|
|
2338
|
+
* @method vc
|
|
2339
|
+
* @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
|
|
2340
|
+
*/
|
|
2341
|
+
async leaveVideoChat(id) {
|
|
2342
|
+
return await __classPrivateFieldGet(this, _Client_videoChatManager, "f").leaveVideoChat(id);
|
|
2343
|
+
}
|
|
2344
|
+
/**
|
|
2345
|
+
* Join a live stream. User-only.
|
|
2346
|
+
*
|
|
2347
|
+
* @method vc
|
|
2348
|
+
* @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
|
|
2349
|
+
*/
|
|
2350
|
+
async joinLiveStream(id) {
|
|
2351
|
+
return await __classPrivateFieldGet(this, _Client_videoChatManager, "f").joinLiveStream(id);
|
|
2352
|
+
}
|
|
2353
|
+
/**
|
|
2354
|
+
* Get a video chat. User-only.
|
|
2355
|
+
*
|
|
2356
|
+
* @method vc
|
|
2357
|
+
* @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
|
|
2358
|
+
*/
|
|
2359
|
+
async getVideoChat(id) {
|
|
2360
|
+
return await __classPrivateFieldGet(this, _Client_videoChatManager, "f").getVideoChat(id);
|
|
2361
|
+
}
|
|
2362
|
+
/**
|
|
2363
|
+
* Get live stream channels. User-only.
|
|
2364
|
+
*
|
|
2365
|
+
* @method vc
|
|
2366
|
+
* @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
|
|
2367
|
+
*/
|
|
2368
|
+
async getLiveStreamChannels(id) {
|
|
2369
|
+
return await __classPrivateFieldGet(this, _Client_videoChatManager, "f").getLiveStreamChannels(id);
|
|
2370
|
+
}
|
|
2371
|
+
/**
|
|
2372
|
+
* Download a live stream chunk. User-only.
|
|
2373
|
+
*
|
|
2374
|
+
* @method vc
|
|
2375
|
+
* @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
|
|
2376
|
+
* @param channelId Stream channel ID.
|
|
2377
|
+
* @param scale Stream channel scale.
|
|
2378
|
+
* @param timestamp Millisecond timestamp of the chunk to download.
|
|
2379
|
+
*/
|
|
2380
|
+
async *downloadLiveStreamChunk(id, channelId, scale, timestamp, params) {
|
|
2381
|
+
yield* __classPrivateFieldGet(this, _Client_videoChatManager, "f").downloadLiveStreamChunk(id, channelId, scale, timestamp, params);
|
|
2382
|
+
}
|
|
2297
2383
|
}
|
|
2298
2384
|
exports.Client = Client;
|
|
2299
2385
|
_a = Client, _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(update) {
|
|
@@ -2333,6 +2419,9 @@ _a = Client, _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(up
|
|
|
2333
2419
|
})());
|
|
2334
2420
|
}
|
|
2335
2421
|
}
|
|
2422
|
+
if (_2_video_chat_manager_js_1.VideoChatManager.canHandleUpdate(update)) {
|
|
2423
|
+
promises.push(__classPrivateFieldGet(this, _Client_instances, "m", _Client_handleCtxUpdate).call(this, await __classPrivateFieldGet(this, _Client_videoChatManager, "f").handleUpdate(update)));
|
|
2424
|
+
}
|
|
2336
2425
|
if (_3_callback_query_manager_js_1.CallbackQueryManager.canHandleUpdate(update)) {
|
|
2337
2426
|
promises.push(__classPrivateFieldGet(this, _Client_instances, "m", _Client_handleCtxUpdate).call(this, await __classPrivateFieldGet(this, _Client_callbackQueryManager, "f").handleUpdate(update)));
|
|
2338
2427
|
}
|
|
@@ -64,6 +64,12 @@ export declare const K: {
|
|
|
64
64
|
inlineQueryAnswer: (userId: number, chatId: number, query: string, offset: string) => StorageKeyPart[];
|
|
65
65
|
callbackQueryAnswers: () => StorageKeyPart[];
|
|
66
66
|
callbackQueryAnswer: (chatId: number, messageId: number, question: string) => StorageKeyPart[];
|
|
67
|
+
fullChats: () => StorageKeyPart[];
|
|
68
|
+
fullChat: (chatId: number) => StorageKeyPart[];
|
|
69
|
+
groupCalls: () => StorageKeyPart[];
|
|
70
|
+
groupCall: (id: bigint) => StorageKeyPart[];
|
|
71
|
+
groupCallAccessHashes: () => StorageKeyPart[];
|
|
72
|
+
groupCallAccessHash: (id: bigint) => StorageKeyPart[];
|
|
67
73
|
};
|
|
68
74
|
messages: {
|
|
69
75
|
P: (string: string) => string;
|
|
@@ -157,6 +163,12 @@ export declare abstract class Storage {
|
|
|
157
163
|
getInlineQueryAnswer(userId: number, chatId: number, query: string, offset: string): Promise<[types.messages.BotResults, Date] | null>;
|
|
158
164
|
setCallbackQueryAnswer(chatId: number, messageId: number, question: string, answer: types.messages.BotCallbackAnswer): Promise<void>;
|
|
159
165
|
getCallbackQueryAnswer(chatId: number, messageId: number, question: string): Promise<[types.messages.BotCallbackAnswer, Date] | null>;
|
|
166
|
+
setFullChat(chatId: number, fullChat: types.UserFull | types.ChannelFull | types.ChatFull | null): Promise<void>;
|
|
167
|
+
getFullChat(chatId: number): Promise<types.UserFull | types.ChannelFull | types.ChatFull | null>;
|
|
168
|
+
setGroupCall(id: bigint, groupCall: types.GroupCall | null): Promise<void>;
|
|
169
|
+
getGroupCall(id: bigint): Promise<types.GroupCall | null>;
|
|
170
|
+
setGroupCallAccessHash(id: bigint, accessHash: bigint | null): Promise<void>;
|
|
171
|
+
getGroupCallAccessHash(id: bigint): Promise<bigint | null>;
|
|
160
172
|
setUpdate(boxId: bigint, update: enums.Update): Promise<void>;
|
|
161
173
|
deleteUpdates(): Promise<void>;
|
|
162
174
|
getFirstUpdate(boxId: bigint): Promise<[readonly StorageKeyPart[], enums.Update] | null>;
|
|
@@ -167,6 +179,8 @@ export declare abstract class Storage {
|
|
|
167
179
|
deleteBusinessConnections(): Promise<void>;
|
|
168
180
|
deleteInlineQueryAnswers(): Promise<void>;
|
|
169
181
|
deleteCallbackQueryAnswers(): Promise<void>;
|
|
182
|
+
deleteFullChats(): Promise<void>;
|
|
183
|
+
deleteGroupCalls(): Promise<void>;
|
|
170
184
|
deleteStickerSetNames(): Promise<void>;
|
|
171
185
|
deletePeers(): Promise<void>;
|
|
172
186
|
deleteUsernames(): Promise<void>;
|
|
@@ -33,6 +33,7 @@ var _Storage_instances, _Storage_authKeyId, _Storage_resetAuthKeyId, _Storage_ac
|
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
34
|
exports.Storage = exports.K = void 0;
|
|
35
35
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
36
|
+
const _0_errors_js_1 = require("../0_errors.js");
|
|
36
37
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
37
38
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
38
39
|
// key parts
|
|
@@ -80,6 +81,12 @@ exports.K = {
|
|
|
80
81
|
inlineQueryAnswer: (userId, chatId, query, offset) => [...exports.K.cache.inlineQueryAnswers(), userId, chatId, query, offset],
|
|
81
82
|
callbackQueryAnswers: () => [exports.K.cache.P("callbackQueryAnswers")],
|
|
82
83
|
callbackQueryAnswer: (chatId, messageId, question) => [...exports.K.cache.callbackQueryAnswers(), chatId, messageId, question],
|
|
84
|
+
fullChats: () => [exports.K.cache.P("fullChats")],
|
|
85
|
+
fullChat: (chatId) => [...exports.K.cache.fullChats(), chatId],
|
|
86
|
+
groupCalls: () => [exports.K.cache.P("groupCalls")],
|
|
87
|
+
groupCall: (id) => [...exports.K.cache.groupCalls(), id],
|
|
88
|
+
groupCallAccessHashes: () => [exports.K.cache.P("groupCallAccessHashes")],
|
|
89
|
+
groupCallAccessHash: (id) => [...exports.K.cache.groupCallAccessHashes(), id],
|
|
83
90
|
},
|
|
84
91
|
messages: {
|
|
85
92
|
P: (string) => `messages.${string}`,
|
|
@@ -434,6 +441,24 @@ class Storage {
|
|
|
434
441
|
return null;
|
|
435
442
|
}
|
|
436
443
|
}
|
|
444
|
+
async setFullChat(chatId, fullChat) {
|
|
445
|
+
await this.setTlObject(exports.K.cache.fullChat(chatId), fullChat);
|
|
446
|
+
}
|
|
447
|
+
async getFullChat(chatId) {
|
|
448
|
+
return await this.getTlObject(exports.K.cache.fullChat(chatId));
|
|
449
|
+
}
|
|
450
|
+
async setGroupCall(id, groupCall) {
|
|
451
|
+
await this.setTlObject(exports.K.cache.groupCall(id), groupCall);
|
|
452
|
+
}
|
|
453
|
+
async getGroupCall(id) {
|
|
454
|
+
return await this.getTlObject(exports.K.cache.groupCall(id));
|
|
455
|
+
}
|
|
456
|
+
async setGroupCallAccessHash(id, accessHash) {
|
|
457
|
+
await this.set(exports.K.cache.groupCallAccessHash(id), accessHash);
|
|
458
|
+
}
|
|
459
|
+
async getGroupCallAccessHash(id) {
|
|
460
|
+
return await this.get(exports.K.cache.groupCallAccessHash(id));
|
|
461
|
+
}
|
|
437
462
|
async setUpdate(boxId, update) {
|
|
438
463
|
await this.setTlObject(exports.K.updates.update(boxId, __classPrivateFieldGet(this, _Storage_instances, "m", _Storage_getUpdateId).call(this, update)), update);
|
|
439
464
|
}
|
|
@@ -452,12 +477,12 @@ class Storage {
|
|
|
452
477
|
}
|
|
453
478
|
async assertUser(source) {
|
|
454
479
|
if (await this.getAccountType() != "user") {
|
|
455
|
-
throw new
|
|
480
|
+
throw new _0_errors_js_1.InputError(`${source}: not user a client`);
|
|
456
481
|
}
|
|
457
482
|
}
|
|
458
483
|
async assertBot(source) {
|
|
459
484
|
if (await this.getAccountType() != "bot") {
|
|
460
|
-
throw new
|
|
485
|
+
throw new _0_errors_js_1.InputError(`${source}: not a bot client`);
|
|
461
486
|
}
|
|
462
487
|
}
|
|
463
488
|
async deleteFiles() {
|
|
@@ -491,6 +516,16 @@ class Storage {
|
|
|
491
516
|
await this.set(key, null);
|
|
492
517
|
}
|
|
493
518
|
}
|
|
519
|
+
async deleteFullChats() {
|
|
520
|
+
for await (const [key] of await this.getMany({ prefix: exports.K.cache.fullChats() })) {
|
|
521
|
+
await this.set(key, null);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
async deleteGroupCalls() {
|
|
525
|
+
for await (const [key] of await this.getMany({ prefix: exports.K.cache.groupCalls() })) {
|
|
526
|
+
await this.set(key, null);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
494
529
|
async deleteStickerSetNames() {
|
|
495
530
|
for await (const [key] of await this.getMany({ prefix: exports.K.cache.stickerSetNames() })) {
|
|
496
531
|
await this.set(key, null);
|
|
@@ -517,6 +552,8 @@ class Storage {
|
|
|
517
552
|
this.deleteBusinessConnections(),
|
|
518
553
|
this.deleteInlineQueryAnswers(),
|
|
519
554
|
this.deleteCallbackQueryAnswers(),
|
|
555
|
+
this.deleteFullChats(),
|
|
556
|
+
this.deleteGroupCalls(),
|
|
520
557
|
this.deleteStickerSetNames(),
|
|
521
558
|
this.deletePeers(),
|
|
522
559
|
this.deleteUsernames(),
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { enums, types } from "./2_types.js";
|
|
21
21
|
export declare function getChannelChatId(channelId: bigint): number;
|
|
22
22
|
export type AnyEntity = types.User | types.Channel | types.ChannelForbidden | types.Chat | types.ChatForbidden;
|
|
23
|
-
export declare function peerToChatId(peer: enums.Peer | enums.InputPeer | AnyEntity | {
|
|
23
|
+
export declare function peerToChatId(peer: enums.Peer | enums.InputPeer | AnyEntity | types.ChannelFull | types.UserFull | types.ChatFull | {
|
|
24
24
|
channel_id: bigint;
|
|
25
25
|
} | {
|
|
26
26
|
user_id: bigint;
|
package/script/tl/3_utilities.js
CHANGED
|
@@ -28,13 +28,13 @@ function getChannelChatId(channelId) {
|
|
|
28
28
|
}
|
|
29
29
|
exports.getChannelChatId = getChannelChatId;
|
|
30
30
|
function peerToChatId(peer) {
|
|
31
|
-
if (peer instanceof _2_types_js_1.types.PeerUser || peer instanceof _2_types_js_1.types.InputPeerUser || peer instanceof _2_types_js_1.types.User || "user_id" in peer) {
|
|
31
|
+
if (peer instanceof _2_types_js_1.types.PeerUser || peer instanceof _2_types_js_1.types.InputPeerUser || peer instanceof _2_types_js_1.types.User || peer instanceof _2_types_js_1.types.UserFull || "user_id" in peer) {
|
|
32
32
|
return Number("id" in peer ? peer.id : peer.user_id);
|
|
33
33
|
}
|
|
34
|
-
else if (peer instanceof _2_types_js_1.types.PeerChat || peer instanceof _2_types_js_1.types.InputPeerChat || peer instanceof _2_types_js_1.types.Chat || peer instanceof _2_types_js_1.types.ChatForbidden || "chat_id" in peer) {
|
|
34
|
+
else if (peer instanceof _2_types_js_1.types.PeerChat || peer instanceof _2_types_js_1.types.InputPeerChat || peer instanceof _2_types_js_1.types.Chat || peer instanceof _2_types_js_1.types.ChatForbidden || peer instanceof _2_types_js_1.types.ChatFull || "chat_id" in peer) {
|
|
35
35
|
return -Number("id" in peer ? peer.id : peer.chat_id);
|
|
36
36
|
}
|
|
37
|
-
else if (peer instanceof _2_types_js_1.types.PeerChannel || peer instanceof _2_types_js_1.types.InputPeerChannel || peer instanceof _2_types_js_1.types.Channel || peer instanceof _2_types_js_1.types.ChannelForbidden || "channel_id" in peer) {
|
|
37
|
+
else if (peer instanceof _2_types_js_1.types.PeerChannel || peer instanceof _2_types_js_1.types.InputPeerChannel || peer instanceof _2_types_js_1.types.Channel || peer instanceof _2_types_js_1.types.ChannelForbidden || peer instanceof _2_types_js_1.types.ChannelFull || "channel_id" in peer) {
|
|
38
38
|
return getChannelChatId("id" in peer ? peer.id : peer.channel_id);
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { types } from "../2_tl.js";
|
|
21
|
+
/** A user's birthday. */
|
|
22
|
+
export interface Birthday {
|
|
23
|
+
day: number;
|
|
24
|
+
month: number;
|
|
25
|
+
year?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function constructBirthday(birthday: types.Birthday): Birthday;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.constructBirthday = void 0;
|
|
23
|
+
function constructBirthday(birthday) {
|
|
24
|
+
return {
|
|
25
|
+
day: birthday.day,
|
|
26
|
+
month: birthday.month,
|
|
27
|
+
year: birthday.year,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
exports.constructBirthday = constructBirthday;
|
|
@@ -24,7 +24,7 @@ export interface GiveawayParameters {
|
|
|
24
24
|
boostedChatId: number;
|
|
25
25
|
/** The identifiers of additional chats that the user must subscribe to in order to be eligible for the prizes. */
|
|
26
26
|
additionalChatIds: number[];
|
|
27
|
-
/**
|
|
27
|
+
/** A point in time within the future in which the winners will be selected. */
|
|
28
28
|
winnerSelectionDate: Date;
|
|
29
29
|
/** Whether only new members of the chats will be eligible for the prizes. */
|
|
30
30
|
onlyNewMembers: boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { types } from "../2_tl.js";
|
|
21
|
+
/** A live stream channel. */
|
|
22
|
+
export interface LiveStreamChannel {
|
|
23
|
+
/** The live stream channel's unique identifier. */
|
|
24
|
+
id: number;
|
|
25
|
+
/** The scale of the live stream channel's chunks. Duration of each chunk is equal to 1000 / 2 ^ scale. ` */
|
|
26
|
+
scale: number;
|
|
27
|
+
/** The live stream channel's last timestamp. */
|
|
28
|
+
timestamp: number;
|
|
29
|
+
}
|
|
30
|
+
export declare function constructLiveStreamChannel(channel: types.GroupCallStreamChannel): LiveStreamChannel;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.constructLiveStreamChannel = void 0;
|
|
23
|
+
function constructLiveStreamChannel(channel) {
|
|
24
|
+
return {
|
|
25
|
+
id: channel.channel,
|
|
26
|
+
scale: channel.scale,
|
|
27
|
+
timestamp: Number(channel.last_timestamp_ms),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
exports.constructLiveStreamChannel = constructLiveStreamChannel;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { types } from "../2_tl.js";
|
|
21
|
+
export interface OpeningHours {
|
|
22
|
+
timezone: string;
|
|
23
|
+
intervals: [number, number][];
|
|
24
|
+
}
|
|
25
|
+
export declare function constructOpeningHours(hours: types.BusinessWorkHours): OpeningHours;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.constructOpeningHours = void 0;
|
|
23
|
+
function constructOpeningHours(hours) {
|
|
24
|
+
return {
|
|
25
|
+
timezone: hours.timezone_id,
|
|
26
|
+
intervals: hours.weekly_open.map((v) => [v.start_minute, v.end_minute]),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.constructOpeningHours = constructOpeningHours;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { enums } from "../2_tl.js";
|
|
21
|
+
/** @unlisted */
|
|
22
|
+
export interface _VideoChatCommon {
|
|
23
|
+
/** The video chat's unique identifier. */
|
|
24
|
+
id: string;
|
|
25
|
+
}
|
|
26
|
+
/** @unlisted */
|
|
27
|
+
export interface _VideoChatNotEndedCommon {
|
|
28
|
+
/** The video chat's title. */
|
|
29
|
+
title: string;
|
|
30
|
+
/** Whether it is a live stream. */
|
|
31
|
+
liveStream: boolean;
|
|
32
|
+
/** The number of current participants. */
|
|
33
|
+
participantCount: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* An ongoing video chat.
|
|
37
|
+
* @unlisted
|
|
38
|
+
*/
|
|
39
|
+
export interface VideoChatActive extends _VideoChatCommon, _VideoChatNotEndedCommon {
|
|
40
|
+
/** Whether the video chat is being recorded. */
|
|
41
|
+
recording: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A scheduled video chat.
|
|
45
|
+
* @unlisted
|
|
46
|
+
*/
|
|
47
|
+
export interface VideoChatScheduled extends _VideoChatCommon, _VideoChatNotEndedCommon {
|
|
48
|
+
/** The point in time in which the video chat will be started. */
|
|
49
|
+
scheduledFor: Date;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* An ended video chat.
|
|
53
|
+
* @unlisted
|
|
54
|
+
*/
|
|
55
|
+
export interface VideoChatEnded extends _VideoChatCommon {
|
|
56
|
+
/** The duration of the video chat in seconds. */
|
|
57
|
+
duration: number;
|
|
58
|
+
}
|
|
59
|
+
export type VideoChat = VideoChatActive | VideoChatScheduled | VideoChatEnded;
|
|
60
|
+
export declare function constructVideoChat(call: enums.GroupCall): VideoChat;
|