@mtkruto/browser 0.126.0 → 0.128.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/esm/3_types.d.ts +4 -0
  2. package/esm/3_types.d.ts.map +1 -1
  3. package/esm/3_types.js +4 -0
  4. package/esm/client/0_params.d.ts +12 -0
  5. package/esm/client/0_params.d.ts.map +1 -1
  6. package/esm/client/1_client_generic.d.ts +100 -19
  7. package/esm/client/1_client_generic.d.ts.map +1 -1
  8. package/esm/client/2_account_manager.d.ts +5 -1
  9. package/esm/client/2_account_manager.d.ts.map +1 -1
  10. package/esm/client/2_account_manager.js +23 -1
  11. package/esm/client/3_message_manager.d.ts +5 -1
  12. package/esm/client/3_message_manager.d.ts.map +1 -1
  13. package/esm/client/3_message_manager.js +21 -1
  14. package/esm/client/4_chat_manager.d.ts +7 -3
  15. package/esm/client/4_chat_manager.d.ts.map +1 -1
  16. package/esm/client/4_chat_manager.js +29 -3
  17. package/esm/client/4_context.d.ts +2 -2
  18. package/esm/client/4_context.d.ts.map +1 -1
  19. package/esm/client/6_client.d.ts +99 -18
  20. package/esm/client/6_client.d.ts.map +1 -1
  21. package/esm/client/6_client.js +125 -20
  22. package/esm/client/6_client_dispatcher.d.ts +100 -19
  23. package/esm/client/6_client_dispatcher.d.ts.map +1 -1
  24. package/esm/client/6_client_dispatcher.js +126 -21
  25. package/esm/types/1_available_reactions.d.ts +54 -0
  26. package/esm/types/1_available_reactions.d.ts.map +1 -0
  27. package/esm/types/1_available_reactions.js +30 -0
  28. package/esm/types/3_app_support.d.ts +27 -0
  29. package/esm/types/3_app_support.d.ts.map +1 -0
  30. package/esm/types/3_app_support.js +24 -0
  31. package/esm/types/3_blocked_user.d.ts +31 -0
  32. package/esm/types/3_blocked_user.d.ts.map +1 -0
  33. package/esm/types/3_blocked_user.js +33 -0
  34. package/esm/types/4_blocked_user_list.d.ts +31 -0
  35. package/esm/types/4_blocked_user_list.d.ts.map +1 -0
  36. package/esm/types/4_blocked_user_list.js +25 -0
  37. package/package.json +1 -1
  38. package/script/3_types.d.ts +4 -0
  39. package/script/3_types.d.ts.map +1 -1
  40. package/script/3_types.js +4 -0
  41. package/script/client/0_params.d.ts +12 -0
  42. package/script/client/0_params.d.ts.map +1 -1
  43. package/script/client/1_client_generic.d.ts +100 -19
  44. package/script/client/1_client_generic.d.ts.map +1 -1
  45. package/script/client/2_account_manager.d.ts +5 -1
  46. package/script/client/2_account_manager.d.ts.map +1 -1
  47. package/script/client/2_account_manager.js +22 -0
  48. package/script/client/3_message_manager.d.ts +5 -1
  49. package/script/client/3_message_manager.d.ts.map +1 -1
  50. package/script/client/3_message_manager.js +20 -0
  51. package/script/client/4_chat_manager.d.ts +7 -3
  52. package/script/client/4_chat_manager.d.ts.map +1 -1
  53. package/script/client/4_chat_manager.js +27 -1
  54. package/script/client/4_context.d.ts +2 -2
  55. package/script/client/4_context.d.ts.map +1 -1
  56. package/script/client/6_client.d.ts +99 -18
  57. package/script/client/6_client.d.ts.map +1 -1
  58. package/script/client/6_client.js +125 -20
  59. package/script/client/6_client_dispatcher.d.ts +100 -19
  60. package/script/client/6_client_dispatcher.d.ts.map +1 -1
  61. package/script/client/6_client_dispatcher.js +126 -21
  62. package/script/types/1_available_reactions.d.ts +54 -0
  63. package/script/types/1_available_reactions.d.ts.map +1 -0
  64. package/script/types/1_available_reactions.js +33 -0
  65. package/script/types/3_app_support.d.ts +27 -0
  66. package/script/types/3_app_support.d.ts.map +1 -0
  67. package/script/types/3_app_support.js +27 -0
  68. package/script/types/3_blocked_user.d.ts +31 -0
  69. package/script/types/3_blocked_user.d.ts.map +1 -0
  70. package/script/types/3_blocked_user.js +36 -0
  71. package/script/types/4_blocked_user_list.d.ts +31 -0
  72. package/script/types/4_blocked_user_list.d.ts.map +1 -0
  73. package/script/types/4_blocked_user_list.js +28 -0
@@ -522,6 +522,66 @@ class ClientDispatcher extends _5_composer_js_1.Composer {
522
522
  async suggestBirthday(userId, birthday) {
523
523
  return await this.#dispatch("suggestBirthday", userId, birthday);
524
524
  }
525
+ /**
526
+ * Block a user. User-only.
527
+ *
528
+ * @method ac
529
+ * @param userId The identifier of the user to block.
530
+ */
531
+ async blockUser(userId) {
532
+ return await this.#dispatch("blockUser", userId);
533
+ }
534
+ /**
535
+ * Unblock a user. User-only.
536
+ *
537
+ * @method ac
538
+ * @param userId The identifier of the user to unblock.
539
+ */
540
+ async unblockUser(userId) {
541
+ return await this.#dispatch("unblockUser", userId);
542
+ }
543
+ /**
544
+ * Get blocked users. User-only.
545
+ *
546
+ * @method ac
547
+ */
548
+ async getBlockedUsers(params) {
549
+ return await this.#dispatch("getBlockedUsers", params);
550
+ }
551
+ /**
552
+ * Add a bot to the attachments menu. User-only.
553
+ *
554
+ * @method ac
555
+ * @param botId The identifier of the bot to add to the attachments menu.
556
+ */
557
+ async addBotToAttachmentsMenu(botId, params) {
558
+ return await this.#dispatch("addBotToAttachmentsMenu", botId, params);
559
+ }
560
+ /**
561
+ * Remove a bot from the attachments menu. User-only.
562
+ *
563
+ * @method ac
564
+ * @param botId The identifier of the bot to remove from the attachments menu.
565
+ */
566
+ async removeBotFromAttachmentsMenu(botId) {
567
+ return await this.#dispatch("removeBotFromAttachmentsMenu", botId);
568
+ }
569
+ /**
570
+ * Get app support. User-only.
571
+ *
572
+ * @method ac
573
+ */
574
+ async getAppSupport() {
575
+ return await this.#dispatch("getAppSupport");
576
+ }
577
+ /**
578
+ * Get app support name. User-only.
579
+ *
580
+ * @method ac
581
+ */
582
+ async getAppSupportName() {
583
+ return await this.#dispatch("getAppSupportName");
584
+ }
525
585
  //
526
586
  // ========================= MESSAGES ========================= //
527
587
  //
@@ -1128,13 +1188,30 @@ class ClientDispatcher extends _5_composer_js_1.Composer {
1128
1188
  /**
1129
1189
  * Get a list of reactions made to a message. User-only.
1130
1190
  *
1191
+ * @method ms
1131
1192
  * @param chatId The identifier of a chat.
1132
1193
  * @param messageId The identifier of the message.
1133
- * @method ms
1134
1194
  */
1135
1195
  async getMessageReactions(chatId, messageId, params) {
1136
1196
  return await this.#dispatch("getMessageReactions", chatId, messageId, params);
1137
1197
  }
1198
+ /**
1199
+ * Set a reaction as default. User-only.
1200
+ *
1201
+ * @mehod ms
1202
+ * @param reaction The reaction to set as default.
1203
+ */
1204
+ async setDefaultReaction(reaction) {
1205
+ return await this.#dispatch("setDefaultReaction", reaction);
1206
+ }
1207
+ /**
1208
+ * Clear all message drafts. User-only.
1209
+ *
1210
+ * @mehod ms
1211
+ */
1212
+ async clearDrafts() {
1213
+ return await this.#dispatch("clearAllDrafts");
1214
+ }
1138
1215
  //
1139
1216
  // ========================= POLLS ========================= //
1140
1217
  //
@@ -2009,6 +2086,44 @@ class ClientDispatcher extends _5_composer_js_1.Composer {
2009
2086
  async getSimilarBots(chatId) {
2010
2087
  return await this.#dispatch("getSimilarBots", chatId);
2011
2088
  }
2089
+ /**
2090
+ * Get the count of online members in a chat. User-only.
2091
+ *
2092
+ * @method ch
2093
+ * @param chatId The identifier of a chat.
2094
+ * @returns The count of online members in the chat.
2095
+ */
2096
+ async getOnlineCount(chatId) {
2097
+ return await this.#dispatch("getOnlineCount", chatId);
2098
+ }
2099
+ /**
2100
+ * Enable chat history for new members. User-only.
2101
+ *
2102
+ * @method ch
2103
+ * @param chatId The identifier of a chat.
2104
+ */
2105
+ async enableChatHistoryForNewMembers(chatId) {
2106
+ return await this.#dispatch("enableChatHistoryForNewMembers", chatId);
2107
+ }
2108
+ /**
2109
+ * Disable chat history for new members. User-only.
2110
+ *
2111
+ * @method ch
2112
+ * @param chatId The identifier of a chat.
2113
+ */
2114
+ async disableChatHistoryForNewMembers(chatId) {
2115
+ return await this.#dispatch("disableChatHistoryForNewMembers", chatId);
2116
+ }
2117
+ /**
2118
+ * Set the default send as chat of a chat. User-only.
2119
+ *
2120
+ * @method ch
2121
+ * @param chatId The identifier of a chat.
2122
+ * @param sendAs The new default send as chat.
2123
+ */
2124
+ async setDefaultSendAs(chatId, sendAs) {
2125
+ return await this.#dispatch("setDefaultSendAs", chatId, sendAs);
2126
+ }
2012
2127
  //
2013
2128
  // ========================= CALLBACK QUERIES ========================= //
2014
2129
  //
@@ -2167,6 +2282,14 @@ class ClientDispatcher extends _5_composer_js_1.Composer {
2167
2282
  async removeReaction(chatId, messageId, reaction) {
2168
2283
  return await this.#dispatch("removeReaction", chatId, messageId, reaction);
2169
2284
  }
2285
+ /**
2286
+ * Clear recent reactions. User-only.
2287
+ *
2288
+ * @method re
2289
+ */
2290
+ async clearRecentReactions() {
2291
+ return await this.#dispatch("clearRecentReactions");
2292
+ }
2170
2293
  //
2171
2294
  // ========================= STORIES ========================= //
2172
2295
  //
@@ -2362,34 +2485,16 @@ class ClientDispatcher extends _5_composer_js_1.Composer {
2362
2485
  return await this.#dispatch("getStoriesInAlbum", chatId, albumId);
2363
2486
  }
2364
2487
  //
2365
- // ========================= MISC ========================= //
2488
+ // ========================= NETWORK STATISTICS ========================= //
2366
2489
  //
2367
2490
  /**
2368
2491
  * Get network statistics. This might not always be available.
2369
2492
  *
2370
- * @method mc
2493
+ * @method ns
2371
2494
  */
2372
2495
  async getNetworkStatistics() {
2373
2496
  return await this.#dispatch("getNetworkStatistics");
2374
2497
  }
2375
- /**
2376
- * Block a user. User-only.
2377
- *
2378
- * @method mc
2379
- * @param userId The identifier of the user to block.
2380
- */
2381
- async blockUser(userId) {
2382
- return await this.#dispatch("blockUser", userId);
2383
- }
2384
- /**
2385
- * Unblock a user. User-only.
2386
- *
2387
- * @method mc
2388
- * @param userId The identifier of the user to unblock.
2389
- */
2390
- async unblockUser(userId) {
2391
- return await this.#dispatch("unblockUser", userId);
2392
- }
2393
2498
  //
2394
2499
  // ========================= VIDEO CHATS ========================= //
2395
2500
  //
@@ -0,0 +1,54 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2026 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 type { Api } from "../2_tl.js";
21
+ import { type Reaction } from "./0_reaction.js";
22
+ /**
23
+ * An available reactions value allowing no type of reactions.
24
+ * @unlisted
25
+ */
26
+ export interface AvailableReactionsNone {
27
+ /** @discriminator */
28
+ type: "none";
29
+ }
30
+ /**
31
+ * An available reactions value allowing a specific set of reactions.
32
+ * @unlisted
33
+ */
34
+ export interface AvailableReactionsSome {
35
+ /** @discriminator */
36
+ type: "some";
37
+ /** The allowed reactions. */
38
+ reactions: Reaction[];
39
+ /** The maximum number of allowed reactions on a single message. */
40
+ maxReactionCount: number;
41
+ }
42
+ /**
43
+ * An available reactions value allowing all types of reactions.
44
+ * @unlisted
45
+ */
46
+ export interface AvailableReactionsAll {
47
+ /** @discriminator */
48
+ type: "all";
49
+ /** The maximum number of allowed reactions on a single message. */
50
+ maxReactionCount: number;
51
+ }
52
+ export type AvailableReactions = AvailableReactionsNone | AvailableReactionsSome | AvailableReactionsAll;
53
+ export declare function availableReactionsToTlObject(chatAvailableReactions: AvailableReactions): Api.ChatReactions;
54
+ //# sourceMappingURL=1_available_reactions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1_available_reactions.d.ts","sourceRoot":"","sources":["../../src/types/1_available_reactions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,QAAQ,EAAsB,MAAM,iBAAiB,CAAC;AAEpE;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,qBAAqB;IACrB,IAAI,EAAE,KAAK,CAAC;IACZ,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,GAAG,sBAAsB,GAAG,qBAAqB,CAAC;AAEzG,wBAAgB,4BAA4B,CAAC,sBAAsB,EAAE,kBAAkB,GAAG,GAAG,CAAC,aAAa,CAS1G"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
4
+ * Copyright (C) 2023-2026 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.availableReactionsToTlObject = availableReactionsToTlObject;
23
+ const _0_reaction_js_1 = require("./0_reaction.js");
24
+ function availableReactionsToTlObject(chatAvailableReactions) {
25
+ switch (chatAvailableReactions.type) {
26
+ case "none":
27
+ return { _: "chatReactionsNone" };
28
+ case "some":
29
+ return { _: "chatReactionsSome", reactions: chatAvailableReactions.reactions.map(_0_reaction_js_1.reactionToTlObject) };
30
+ case "all":
31
+ return { _: "chatReactionsAll" };
32
+ }
33
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2026 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 { Api } from "../2_tl.js";
21
+ import { type User } from "./2_user.js";
22
+ export interface AppSupport {
23
+ phoneNumber: string;
24
+ user: User;
25
+ }
26
+ export declare function constructAppSupport(result: Api.help_Support): AppSupport;
27
+ //# sourceMappingURL=3_app_support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"3_app_support.d.ts","sourceRoot":"","sources":["../../src/types/3_app_support.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAiB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,GAAG,UAAU,CAExE"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /**
3
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
4
+ * Copyright (C) 2023-2026 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.constructAppSupport = constructAppSupport;
23
+ const _2_tl_js_1 = require("../2_tl.js");
24
+ const _2_user_js_1 = require("./2_user.js");
25
+ function constructAppSupport(result) {
26
+ return { phoneNumber: result.phone_number, user: (0, _2_user_js_1.constructUser)(_2_tl_js_1.Api.as("user", result.user)) };
27
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2026 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 type { Api } from "../2_tl.js";
21
+ import type { PeerGetter } from "./1_chat_p.js";
22
+ import { type User } from "./2_user.js";
23
+ /** A blocked user. */
24
+ export interface BlockedUser {
25
+ /** The blocked user. */
26
+ user: User;
27
+ /** The point in time in which the user was blocked. */
28
+ blockedAt: number;
29
+ }
30
+ export declare function constructBlockedUser(peerBlocked: Api.PeerBlocked, getPeer: PeerGetter): BlockedUser;
31
+ //# sourceMappingURL=3_blocked_user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"3_blocked_user.d.ts","sourceRoot":"","sources":["../../src/types/3_blocked_user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAkB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAExD,sBAAsB;AACtB,MAAM,WAAW,WAAW;IAC1B,wBAAwB;IACxB,IAAI,EAAE,IAAI,CAAC;IACX,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,GAAG,WAAW,CAanG"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
4
+ * Copyright (C) 2023-2026 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.constructBlockedUser = constructBlockedUser;
23
+ const _0_deps_js_1 = require("../0_deps.js");
24
+ const _2_user_js_1 = require("./2_user.js");
25
+ function constructBlockedUser(peerBlocked, getPeer) {
26
+ const maybeChatP = getPeer(peerBlocked.peer_id);
27
+ if (maybeChatP === null || maybeChatP[0].type !== "private") {
28
+ (0, _0_deps_js_1.unreachable)();
29
+ }
30
+ const user = (0, _2_user_js_1.constructUser2)(maybeChatP[0]);
31
+ const blockedAt = peerBlocked.date;
32
+ return {
33
+ user,
34
+ blockedAt,
35
+ };
36
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2026 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 type { Api } from "../2_tl.js";
21
+ import type { PeerGetter } from "./1_chat_p.js";
22
+ import { type BlockedUser } from "./3_blocked_user.js";
23
+ /** A list of blocked users. */
24
+ export interface BlockedUserList {
25
+ /** The blocked users. */
26
+ blockedUsers: BlockedUser[];
27
+ /** The total number of blocked users. */
28
+ count: number;
29
+ }
30
+ export declare function constructBlockedUserList(result: Api.contacts_Blocked, getPeer: PeerGetter): BlockedUserList;
31
+ //# sourceMappingURL=4_blocked_user_list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"4_blocked_user_list.d.ts","sourceRoot":"","sources":["../../src/types/4_blocked_user_list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,KAAK,WAAW,EAAwB,MAAM,qBAAqB,CAAC;AAE7E,+BAA+B;AAC/B,MAAM,WAAW,eAAe;IAC9B,yBAAyB;IACzB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,gBAAgB,EAAE,OAAO,EAAE,UAAU,GAAG,eAAe,CAI3G"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
4
+ * Copyright (C) 2023-2026 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.constructBlockedUserList = constructBlockedUserList;
23
+ const _3_blocked_user_js_1 = require("./3_blocked_user.js");
24
+ function constructBlockedUserList(result, getPeer) {
25
+ const blockedUsers = result.blocked.map((v) => (0, _3_blocked_user_js_1.constructBlockedUser)(v, getPeer));
26
+ const count = "count" in result ? result.count : result.blocked.length;
27
+ return { blockedUsers, count };
28
+ }