@mtkruto/node 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
@@ -556,6 +556,66 @@ class ClientDispatcher extends _5_composer_js_1.Composer {
556
556
  async suggestBirthday(userId, birthday) {
557
557
  return await this.#dispatch("suggestBirthday", userId, birthday);
558
558
  }
559
+ /**
560
+ * Block a user. User-only.
561
+ *
562
+ * @method ac
563
+ * @param userId The identifier of the user to block.
564
+ */
565
+ async blockUser(userId) {
566
+ return await this.#dispatch("blockUser", userId);
567
+ }
568
+ /**
569
+ * Unblock a user. User-only.
570
+ *
571
+ * @method ac
572
+ * @param userId The identifier of the user to unblock.
573
+ */
574
+ async unblockUser(userId) {
575
+ return await this.#dispatch("unblockUser", userId);
576
+ }
577
+ /**
578
+ * Get blocked users. User-only.
579
+ *
580
+ * @method ac
581
+ */
582
+ async getBlockedUsers(params) {
583
+ return await this.#dispatch("getBlockedUsers", params);
584
+ }
585
+ /**
586
+ * Add a bot to the attachments menu. User-only.
587
+ *
588
+ * @method ac
589
+ * @param botId The identifier of the bot to add to the attachments menu.
590
+ */
591
+ async addBotToAttachmentsMenu(botId, params) {
592
+ return await this.#dispatch("addBotToAttachmentsMenu", botId, params);
593
+ }
594
+ /**
595
+ * Remove a bot from the attachments menu. User-only.
596
+ *
597
+ * @method ac
598
+ * @param botId The identifier of the bot to remove from the attachments menu.
599
+ */
600
+ async removeBotFromAttachmentsMenu(botId) {
601
+ return await this.#dispatch("removeBotFromAttachmentsMenu", botId);
602
+ }
603
+ /**
604
+ * Get app support. User-only.
605
+ *
606
+ * @method ac
607
+ */
608
+ async getAppSupport() {
609
+ return await this.#dispatch("getAppSupport");
610
+ }
611
+ /**
612
+ * Get app support name. User-only.
613
+ *
614
+ * @method ac
615
+ */
616
+ async getAppSupportName() {
617
+ return await this.#dispatch("getAppSupportName");
618
+ }
559
619
  //
560
620
  // ========================= MESSAGES ========================= //
561
621
  //
@@ -1162,13 +1222,30 @@ class ClientDispatcher extends _5_composer_js_1.Composer {
1162
1222
  /**
1163
1223
  * Get a list of reactions made to a message. User-only.
1164
1224
  *
1225
+ * @method ms
1165
1226
  * @param chatId The identifier of a chat.
1166
1227
  * @param messageId The identifier of the message.
1167
- * @method ms
1168
1228
  */
1169
1229
  async getMessageReactions(chatId, messageId, params) {
1170
1230
  return await this.#dispatch("getMessageReactions", chatId, messageId, params);
1171
1231
  }
1232
+ /**
1233
+ * Set a reaction as default. User-only.
1234
+ *
1235
+ * @mehod ms
1236
+ * @param reaction The reaction to set as default.
1237
+ */
1238
+ async setDefaultReaction(reaction) {
1239
+ return await this.#dispatch("setDefaultReaction", reaction);
1240
+ }
1241
+ /**
1242
+ * Clear all message drafts. User-only.
1243
+ *
1244
+ * @mehod ms
1245
+ */
1246
+ async clearDrafts() {
1247
+ return await this.#dispatch("clearAllDrafts");
1248
+ }
1172
1249
  //
1173
1250
  // ========================= POLLS ========================= //
1174
1251
  //
@@ -2043,6 +2120,44 @@ class ClientDispatcher extends _5_composer_js_1.Composer {
2043
2120
  async getSimilarBots(chatId) {
2044
2121
  return await this.#dispatch("getSimilarBots", chatId);
2045
2122
  }
2123
+ /**
2124
+ * Get the count of online members in a chat. User-only.
2125
+ *
2126
+ * @method ch
2127
+ * @param chatId The identifier of a chat.
2128
+ * @returns The count of online members in the chat.
2129
+ */
2130
+ async getOnlineCount(chatId) {
2131
+ return await this.#dispatch("getOnlineCount", chatId);
2132
+ }
2133
+ /**
2134
+ * Enable chat history for new members. User-only.
2135
+ *
2136
+ * @method ch
2137
+ * @param chatId The identifier of a chat.
2138
+ */
2139
+ async enableChatHistoryForNewMembers(chatId) {
2140
+ return await this.#dispatch("enableChatHistoryForNewMembers", chatId);
2141
+ }
2142
+ /**
2143
+ * Disable chat history for new members. User-only.
2144
+ *
2145
+ * @method ch
2146
+ * @param chatId The identifier of a chat.
2147
+ */
2148
+ async disableChatHistoryForNewMembers(chatId) {
2149
+ return await this.#dispatch("disableChatHistoryForNewMembers", chatId);
2150
+ }
2151
+ /**
2152
+ * Set the default send as chat of a chat. User-only.
2153
+ *
2154
+ * @method ch
2155
+ * @param chatId The identifier of a chat.
2156
+ * @param sendAs The new default send as chat.
2157
+ */
2158
+ async setDefaultSendAs(chatId, sendAs) {
2159
+ return await this.#dispatch("setDefaultSendAs", chatId, sendAs);
2160
+ }
2046
2161
  //
2047
2162
  // ========================= CALLBACK QUERIES ========================= //
2048
2163
  //
@@ -2201,6 +2316,14 @@ class ClientDispatcher extends _5_composer_js_1.Composer {
2201
2316
  async removeReaction(chatId, messageId, reaction) {
2202
2317
  return await this.#dispatch("removeReaction", chatId, messageId, reaction);
2203
2318
  }
2319
+ /**
2320
+ * Clear recent reactions. User-only.
2321
+ *
2322
+ * @method re
2323
+ */
2324
+ async clearRecentReactions() {
2325
+ return await this.#dispatch("clearRecentReactions");
2326
+ }
2204
2327
  //
2205
2328
  // ========================= STORIES ========================= //
2206
2329
  //
@@ -2396,34 +2519,16 @@ class ClientDispatcher extends _5_composer_js_1.Composer {
2396
2519
  return await this.#dispatch("getStoriesInAlbum", chatId, albumId);
2397
2520
  }
2398
2521
  //
2399
- // ========================= MISC ========================= //
2522
+ // ========================= NETWORK STATISTICS ========================= //
2400
2523
  //
2401
2524
  /**
2402
2525
  * Get network statistics. This might not always be available.
2403
2526
  *
2404
- * @method mc
2527
+ * @method ns
2405
2528
  */
2406
2529
  async getNetworkStatistics() {
2407
2530
  return await this.#dispatch("getNetworkStatistics");
2408
2531
  }
2409
- /**
2410
- * Block a user. User-only.
2411
- *
2412
- * @method mc
2413
- * @param userId The identifier of the user to block.
2414
- */
2415
- async blockUser(userId) {
2416
- return await this.#dispatch("blockUser", userId);
2417
- }
2418
- /**
2419
- * Unblock a user. User-only.
2420
- *
2421
- * @method mc
2422
- * @param userId The identifier of the user to unblock.
2423
- */
2424
- async unblockUser(userId) {
2425
- return await this.#dispatch("unblockUser", userId);
2426
- }
2427
2532
  //
2428
2533
  // ========================= VIDEO CHATS ========================= //
2429
2534
  //
@@ -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
+ }