@mtcute/core 0.27.9 → 0.28.1

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 (87) hide show
  1. package/client.cjs +12 -0
  2. package/client.js +12 -0
  3. package/highlevel/base.cjs +2 -0
  4. package/highlevel/base.js +2 -0
  5. package/highlevel/client.d.cts +27 -2
  6. package/highlevel/client.d.ts +27 -2
  7. package/highlevel/methods/chats/batched-queries.cjs +2 -4
  8. package/highlevel/methods/chats/batched-queries.d.cts +1 -1
  9. package/highlevel/methods/chats/batched-queries.d.ts +1 -1
  10. package/highlevel/methods/chats/batched-queries.js +2 -4
  11. package/highlevel/methods/chats/get-chats.cjs +27 -0
  12. package/highlevel/methods/chats/get-chats.d.cts +9 -0
  13. package/highlevel/methods/chats/get-chats.d.ts +9 -0
  14. package/highlevel/methods/chats/get-chats.js +22 -0
  15. package/highlevel/methods/chats/get-chats.test.d.cts +1 -0
  16. package/highlevel/methods/chats/get-chats.test.d.ts +1 -0
  17. package/highlevel/methods/chats/get-creator-after-leave.cjs +18 -0
  18. package/highlevel/methods/chats/get-creator-after-leave.d.cts +9 -0
  19. package/highlevel/methods/chats/get-creator-after-leave.d.ts +9 -0
  20. package/highlevel/methods/chats/get-creator-after-leave.js +13 -0
  21. package/highlevel/methods/chats/get-peers.cjs +16 -0
  22. package/highlevel/methods/chats/get-peers.d.cts +9 -0
  23. package/highlevel/methods/chats/get-peers.d.ts +9 -0
  24. package/highlevel/methods/chats/get-peers.js +11 -0
  25. package/highlevel/methods/chats/get-peers.test.d.cts +1 -0
  26. package/highlevel/methods/chats/get-peers.test.d.ts +1 -0
  27. package/highlevel/methods/contacts/set-contact-note.cjs +2 -0
  28. package/highlevel/methods/contacts/set-contact-note.js +2 -0
  29. package/highlevel/methods/files/download-iterable.cjs +17 -6
  30. package/highlevel/methods/files/download-iterable.js +17 -6
  31. package/highlevel/methods/gifts/get-resale-star-gifts.cjs +2 -1
  32. package/highlevel/methods/gifts/get-resale-star-gifts.d.cts +2 -0
  33. package/highlevel/methods/gifts/get-resale-star-gifts.d.ts +2 -0
  34. package/highlevel/methods/gifts/get-resale-star-gifts.js +2 -1
  35. package/highlevel/methods/users/get-users.d.cts +1 -2
  36. package/highlevel/methods/users/get-users.d.ts +1 -2
  37. package/highlevel/methods.d.cts +3 -0
  38. package/highlevel/methods.d.ts +3 -0
  39. package/highlevel/types/bots/keyboards/factories.cjs +26 -18
  40. package/highlevel/types/bots/keyboards/factories.d.cts +34 -10
  41. package/highlevel/types/bots/keyboards/factories.d.ts +34 -10
  42. package/highlevel/types/bots/keyboards/factories.js +26 -18
  43. package/highlevel/types/messages/message-action.cjs +18 -0
  44. package/highlevel/types/messages/message-action.d.cts +20 -1
  45. package/highlevel/types/messages/message-action.d.ts +20 -1
  46. package/highlevel/types/messages/message-action.js +18 -0
  47. package/highlevel/types/peers/chat.cjs +1 -1
  48. package/highlevel/types/peers/chat.js +1 -1
  49. package/highlevel/types/peers/peer.cjs +13 -3
  50. package/highlevel/types/peers/peer.d.cts +4 -0
  51. package/highlevel/types/peers/peer.d.ts +4 -0
  52. package/highlevel/types/peers/peer.js +13 -3
  53. package/highlevel/types/peers/user.cjs +3 -0
  54. package/highlevel/types/peers/user.d.cts +1 -0
  55. package/highlevel/types/peers/user.d.ts +1 -0
  56. package/highlevel/types/peers/user.js +3 -0
  57. package/highlevel/types/premium/saved-star-gift.cjs +4 -0
  58. package/highlevel/types/premium/saved-star-gift.d.cts +2 -0
  59. package/highlevel/types/premium/saved-star-gift.d.ts +2 -0
  60. package/highlevel/types/premium/saved-star-gift.js +4 -0
  61. package/highlevel/types/premium/star-gift-unique.cjs +43 -4
  62. package/highlevel/types/premium/star-gift-unique.d.cts +18 -4
  63. package/highlevel/types/premium/star-gift-unique.d.ts +18 -4
  64. package/highlevel/types/premium/star-gift-unique.js +43 -4
  65. package/highlevel/updates/manager.cjs +2 -0
  66. package/highlevel/updates/manager.js +2 -0
  67. package/methods.cjs +6 -0
  68. package/methods.js +6 -0
  69. package/network/mtproto-session.cjs +2 -0
  70. package/network/mtproto-session.js +2 -0
  71. package/network/network-manager.cjs +1 -1
  72. package/network/network-manager.js +1 -1
  73. package/network/session-connection.cjs +2 -0
  74. package/network/session-connection.js +2 -0
  75. package/network/transports/intermediate.cjs +2 -0
  76. package/network/transports/intermediate.js +2 -0
  77. package/package.json +3 -3
  78. package/storage/storage.cjs +2 -0
  79. package/storage/storage.js +2 -0
  80. package/utils/binary/compat.cjs +106 -4
  81. package/utils/binary/compat.d.cts +3 -0
  82. package/utils/binary/compat.d.ts +3 -0
  83. package/utils/binary/compat.js +107 -5
  84. package/utils/index.d.cts +2 -0
  85. package/utils/index.d.ts +2 -0
  86. package/utils.cjs +11 -0
  87. package/utils.js +6 -1
@@ -5,16 +5,26 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
5
5
  }
6
6
  "use strict";
7
7
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
+ const utils = require("@fuman/utils");
8
9
  const chat = require("./chat.cjs");
9
10
  const user = require("./user.cjs");
10
11
  function parsePeer(peer, index) {
11
12
  switch (peer._) {
12
13
  case "peerUser":
13
- return new user.User(index.user(peer.userId));
14
+ return new user.User(utils.asNonNull(index).user(peer.userId));
14
15
  case "peerChat":
15
- return new chat.Chat(index.chat(peer.chatId));
16
+ return new chat.Chat(utils.asNonNull(index).chat(peer.chatId));
16
17
  case "peerChannel":
17
- return new chat.Chat(index.chat(peer.channelId));
18
+ return new chat.Chat(utils.asNonNull(index).chat(peer.channelId));
19
+ case "channel":
20
+ case "channelForbidden":
21
+ case "chat":
22
+ case "chatForbidden":
23
+ return new chat.Chat(peer);
24
+ case "user":
25
+ return new user.User(peer);
26
+ default:
27
+ throw new Error("Empty peer");
18
28
  }
19
29
  }
20
30
  exports.parsePeer = parsePeer;
@@ -46,3 +46,7 @@ export type PeerSender = Peer | AnonymousSender;
46
46
  * Given a `tl.TypePeer`, return a {@link Peer} object ({@link User} or {@link Chat})
47
47
  */
48
48
  export declare function parsePeer(peer: tl.TypePeer, index: PeersIndex): Peer;
49
+ /**
50
+ * Given a `tl.TypeUser | tl.TypeChat`, return a {@link Peer} object ({@link User} or {@link Chat})
51
+ */
52
+ export declare function parsePeer(peer: tl.TypeUser | tl.TypeChat): Peer;
@@ -46,3 +46,7 @@ export type PeerSender = Peer | AnonymousSender;
46
46
  * Given a `tl.TypePeer`, return a {@link Peer} object ({@link User} or {@link Chat})
47
47
  */
48
48
  export declare function parsePeer(peer: tl.TypePeer, index: PeersIndex): Peer;
49
+ /**
50
+ * Given a `tl.TypeUser | tl.TypeChat`, return a {@link Peer} object ({@link User} or {@link Chat})
51
+ */
52
+ export declare function parsePeer(peer: tl.TypeUser | tl.TypeChat): Peer;
@@ -1,13 +1,23 @@
1
+ import { asNonNull } from "@fuman/utils";
1
2
  import { Chat as Chat$2 } from "./chat.js";
2
3
  import { User as User$2 } from "./user.js";
3
4
  function parsePeer(peer, index) {
4
5
  switch (peer._) {
5
6
  case "peerUser":
6
- return new User$2(index.user(peer.userId));
7
+ return new User$2(asNonNull(index).user(peer.userId));
7
8
  case "peerChat":
8
- return new Chat$2(index.chat(peer.chatId));
9
+ return new Chat$2(asNonNull(index).chat(peer.chatId));
9
10
  case "peerChannel":
10
- return new Chat$2(index.chat(peer.channelId));
11
+ return new Chat$2(asNonNull(index).chat(peer.channelId));
12
+ case "channel":
13
+ case "channelForbidden":
14
+ case "chat":
15
+ case "chatForbidden":
16
+ return new Chat$2(peer);
17
+ case "user":
18
+ return new User$2(peer);
19
+ default:
20
+ throw new Error("Empty peer");
11
21
  }
12
22
  }
13
23
  export {
@@ -111,6 +111,9 @@ class User {
111
111
  get isBotWithForumView() {
112
112
  return this.raw.botForumView;
113
113
  }
114
+ get canBotManageForumTopics() {
115
+ return this.raw.botForumCanManageTopics;
116
+ }
114
117
  /** Whether this user has been verified by Telegram */
115
118
  get isVerified() {
116
119
  return this.raw.verified;
@@ -84,6 +84,7 @@ export declare class User {
84
84
  get isBotEditable(): boolean;
85
85
  /** Whether this bot is forum-like (i.e. supports threads) */
86
86
  get isBotWithForumView(): boolean;
87
+ get canBotManageForumTopics(): boolean;
87
88
  /** Whether this user has been verified by Telegram */
88
89
  get isVerified(): boolean;
89
90
  /**
@@ -84,6 +84,7 @@ export declare class User {
84
84
  get isBotEditable(): boolean;
85
85
  /** Whether this bot is forum-like (i.e. supports threads) */
86
86
  get isBotWithForumView(): boolean;
87
+ get canBotManageForumTopics(): boolean;
87
88
  /** Whether this user has been verified by Telegram */
88
89
  get isVerified(): boolean;
89
90
  /**
@@ -104,6 +104,9 @@ class User {
104
104
  get isBotWithForumView() {
105
105
  return this.raw.botForumView;
106
106
  }
107
+ get canBotManageForumTopics() {
108
+ return this.raw.botForumCanManageTopics;
109
+ }
107
110
  /** Whether this user has been verified by Telegram */
108
111
  get isVerified() {
109
112
  return this.raw.verified;
@@ -90,6 +90,10 @@ class SavedStarGift {
90
90
  get canResellAt() {
91
91
  return this.raw.canResellAt ? new Date(this.raw.canResellAt * 1e3) : null;
92
92
  }
93
+ /** Date when the gift can be crafted */
94
+ get canCraftAt() {
95
+ return this.raw.canCraftAt ? new Date(this.raw.canCraftAt * 1e3) : null;
96
+ }
93
97
  /** IDs of the collections this gift belongs to */
94
98
  get collectionIds() {
95
99
  return this.raw.collectionId ?? [];
@@ -44,6 +44,8 @@ export declare class SavedStarGift {
44
44
  get canTransferAt(): Date | null;
45
45
  /** Date when the gift can be resold */
46
46
  get canResellAt(): Date | null;
47
+ /** Date when the gift can be crafted */
48
+ get canCraftAt(): Date | null;
47
49
  /** IDs of the collections this gift belongs to */
48
50
  get collectionIds(): number[];
49
51
  /**
@@ -44,6 +44,8 @@ export declare class SavedStarGift {
44
44
  get canTransferAt(): Date | null;
45
45
  /** Date when the gift can be resold */
46
46
  get canResellAt(): Date | null;
47
+ /** Date when the gift can be crafted */
48
+ get canCraftAt(): Date | null;
47
49
  /** IDs of the collections this gift belongs to */
48
50
  get collectionIds(): number[];
49
51
  /**
@@ -83,6 +83,10 @@ class SavedStarGift {
83
83
  get canResellAt() {
84
84
  return this.raw.canResellAt ? new Date(this.raw.canResellAt * 1e3) : null;
85
85
  }
86
+ /** Date when the gift can be crafted */
87
+ get canCraftAt() {
88
+ return this.raw.canCraftAt ? new Date(this.raw.canCraftAt * 1e3) : null;
89
+ }
86
90
  /** IDs of the collections this gift belongs to */
87
91
  get collectionIds() {
88
92
  return this.raw.collectionId ?? [];
@@ -11,18 +11,41 @@ const inspectable = require("../../utils/inspectable.cjs");
11
11
  const memoize = require("../../utils/memoize.cjs");
12
12
  const documentUtils = require("../media/document-utils.cjs");
13
13
  const peer = require("../peers/peer.cjs");
14
+ function mapRarity(rarity) {
15
+ switch (rarity._) {
16
+ case "starGiftAttributeRarityUncommon":
17
+ return "uncommon";
18
+ case "starGiftAttributeRarityRare":
19
+ return "rare";
20
+ case "starGiftAttributeRarityEpic":
21
+ return "epic";
22
+ case "starGiftAttributeRarityLegendary":
23
+ return "legendary";
24
+ default:
25
+ return null;
26
+ }
27
+ }
14
28
  class StarGiftUniqueAttribute {
15
29
  constructor(raw) {
16
30
  this.raw = raw;
17
31
  }
18
- /** Rarity permille of the attribute */
32
+ /** Whether this attribute is specific to this craft */
33
+ get crafted() {
34
+ return this.raw._ === "starGiftAttributeModel" && this.raw.crafted;
35
+ }
36
+ /** Rarity permille of the attribute, if available */
19
37
  get permille() {
20
- return this.raw.rarityPermille;
38
+ return this.raw.rarity._ === "starGiftAttributeRarity" ? this.raw.rarity.permille : null;
39
+ }
40
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
41
+ get rarity() {
42
+ return mapRarity(this.raw.rarity);
21
43
  }
22
44
  /** Display name of the attribute */
23
45
  get name() {
24
46
  return this.raw.name;
25
47
  }
48
+ /** Sticker of the attribute */
26
49
  get sticker() {
27
50
  utils.assert(this.raw.document._ === "document");
28
51
  const parsed = documentUtils.parseDocument(this.raw.document);
@@ -40,9 +63,13 @@ class StarGiftUniqueBackdrop {
40
63
  get id() {
41
64
  return this.raw.backdropId;
42
65
  }
43
- /** Rarity permille of the attribute */
66
+ /** Rarity permille of the attribute, if available */
44
67
  get permille() {
45
- return this.raw.rarityPermille;
68
+ return this.raw.rarity._ === "starGiftAttributeRarity" ? this.raw.rarity.permille : null;
69
+ }
70
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
71
+ get rarity() {
72
+ return mapRarity(this.raw.rarity);
46
73
  }
47
74
  /** Display name of the attribute */
48
75
  get name() {
@@ -135,6 +162,18 @@ class StarGiftUnique {
135
162
  get isPremiumOnly() {
136
163
  return this.raw.requirePremium;
137
164
  }
165
+ /** Whether this gift was burned to craft a new one */
166
+ get isBurned() {
167
+ return this.raw.burned;
168
+ }
169
+ /** Whether this gift was crafted */
170
+ get isCrafted() {
171
+ return this.raw.crafted;
172
+ }
173
+ /** If this gift can be used in a craft, the chance of success, in permille */
174
+ get craftChancePermille() {
175
+ return this.raw.craftChancePermille ?? null;
176
+ }
138
177
  /** Number of the NFT */
139
178
  get num() {
140
179
  return this.raw.num;
@@ -3,14 +3,20 @@ import { Sticker } from '../media/sticker.js';
3
3
  import { TextWithEntities } from '../misc/entities.js';
4
4
  import { Peer } from '../peers/peer.js';
5
5
  import { PeersIndex } from '../peers/peers-index.js';
6
+ export type StarGiftUniqueAttributeRarity = 'uncommon' | 'rare' | 'epic' | 'legendary';
6
7
  /** An attribute of a unique star gift containing a sticker */
7
8
  export declare class StarGiftUniqueAttribute {
8
9
  readonly raw: tl.RawStarGiftAttributeModel | tl.RawStarGiftAttributePattern;
9
10
  constructor(raw: tl.RawStarGiftAttributeModel | tl.RawStarGiftAttributePattern);
10
- /** Rarity permille of the attribute */
11
- get permille(): number;
11
+ /** Whether this attribute is specific to this craft */
12
+ get crafted(): boolean;
13
+ /** Rarity permille of the attribute, if available */
14
+ get permille(): number | null;
15
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
16
+ get rarity(): StarGiftUniqueAttributeRarity | null;
12
17
  /** Display name of the attribute */
13
18
  get name(): string;
19
+ /** Sticker of the attribute */
14
20
  get sticker(): Sticker;
15
21
  }
16
22
  /** Information about a unique star gift's backdrop */
@@ -19,8 +25,10 @@ export declare class StarGiftUniqueBackdrop {
19
25
  constructor(raw: tl.RawStarGiftAttributeBackdrop);
20
26
  /** ID of the backdrop */
21
27
  get id(): number;
22
- /** Rarity permille of the attribute */
23
- get permille(): number;
28
+ /** Rarity permille of the attribute, if available */
29
+ get permille(): number | null;
30
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
31
+ get rarity(): StarGiftUniqueAttributeRarity | null;
24
32
  /** Display name of the attribute */
25
33
  get name(): string;
26
34
  get centerColor(): number;
@@ -69,6 +77,12 @@ export declare class StarGiftUnique {
69
77
  constructor(raw: tl.RawStarGiftUnique, _peers: PeersIndex);
70
78
  /** Whether this gift is available only to premium users */
71
79
  get isPremiumOnly(): boolean;
80
+ /** Whether this gift was burned to craft a new one */
81
+ get isBurned(): boolean;
82
+ /** Whether this gift was crafted */
83
+ get isCrafted(): boolean;
84
+ /** If this gift can be used in a craft, the chance of success, in permille */
85
+ get craftChancePermille(): number | null;
72
86
  /** Number of the NFT */
73
87
  get num(): number;
74
88
  /** Title of the NFT */
@@ -3,14 +3,20 @@ import { Sticker } from '../media/sticker.js';
3
3
  import { TextWithEntities } from '../misc/entities.js';
4
4
  import { Peer } from '../peers/peer.js';
5
5
  import { PeersIndex } from '../peers/peers-index.js';
6
+ export type StarGiftUniqueAttributeRarity = 'uncommon' | 'rare' | 'epic' | 'legendary';
6
7
  /** An attribute of a unique star gift containing a sticker */
7
8
  export declare class StarGiftUniqueAttribute {
8
9
  readonly raw: tl.RawStarGiftAttributeModel | tl.RawStarGiftAttributePattern;
9
10
  constructor(raw: tl.RawStarGiftAttributeModel | tl.RawStarGiftAttributePattern);
10
- /** Rarity permille of the attribute */
11
- get permille(): number;
11
+ /** Whether this attribute is specific to this craft */
12
+ get crafted(): boolean;
13
+ /** Rarity permille of the attribute, if available */
14
+ get permille(): number | null;
15
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
16
+ get rarity(): StarGiftUniqueAttributeRarity | null;
12
17
  /** Display name of the attribute */
13
18
  get name(): string;
19
+ /** Sticker of the attribute */
14
20
  get sticker(): Sticker;
15
21
  }
16
22
  /** Information about a unique star gift's backdrop */
@@ -19,8 +25,10 @@ export declare class StarGiftUniqueBackdrop {
19
25
  constructor(raw: tl.RawStarGiftAttributeBackdrop);
20
26
  /** ID of the backdrop */
21
27
  get id(): number;
22
- /** Rarity permille of the attribute */
23
- get permille(): number;
28
+ /** Rarity permille of the attribute, if available */
29
+ get permille(): number | null;
30
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
31
+ get rarity(): StarGiftUniqueAttributeRarity | null;
24
32
  /** Display name of the attribute */
25
33
  get name(): string;
26
34
  get centerColor(): number;
@@ -69,6 +77,12 @@ export declare class StarGiftUnique {
69
77
  constructor(raw: tl.RawStarGiftUnique, _peers: PeersIndex);
70
78
  /** Whether this gift is available only to premium users */
71
79
  get isPremiumOnly(): boolean;
80
+ /** Whether this gift was burned to craft a new one */
81
+ get isBurned(): boolean;
82
+ /** Whether this gift was crafted */
83
+ get isCrafted(): boolean;
84
+ /** If this gift can be used in a craft, the chance of success, in permille */
85
+ get craftChancePermille(): number | null;
72
86
  /** Number of the NFT */
73
87
  get num(): number;
74
88
  /** Title of the NFT */
@@ -4,18 +4,41 @@ import { makeInspectable } from "../../utils/inspectable.js";
4
4
  import { memoizeGetters } from "../../utils/memoize.js";
5
5
  import { parseDocument } from "../media/document-utils.js";
6
6
  import { parsePeer } from "../peers/peer.js";
7
+ function mapRarity(rarity) {
8
+ switch (rarity._) {
9
+ case "starGiftAttributeRarityUncommon":
10
+ return "uncommon";
11
+ case "starGiftAttributeRarityRare":
12
+ return "rare";
13
+ case "starGiftAttributeRarityEpic":
14
+ return "epic";
15
+ case "starGiftAttributeRarityLegendary":
16
+ return "legendary";
17
+ default:
18
+ return null;
19
+ }
20
+ }
7
21
  class StarGiftUniqueAttribute {
8
22
  constructor(raw) {
9
23
  this.raw = raw;
10
24
  }
11
- /** Rarity permille of the attribute */
25
+ /** Whether this attribute is specific to this craft */
26
+ get crafted() {
27
+ return this.raw._ === "starGiftAttributeModel" && this.raw.crafted;
28
+ }
29
+ /** Rarity permille of the attribute, if available */
12
30
  get permille() {
13
- return this.raw.rarityPermille;
31
+ return this.raw.rarity._ === "starGiftAttributeRarity" ? this.raw.rarity.permille : null;
32
+ }
33
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
34
+ get rarity() {
35
+ return mapRarity(this.raw.rarity);
14
36
  }
15
37
  /** Display name of the attribute */
16
38
  get name() {
17
39
  return this.raw.name;
18
40
  }
41
+ /** Sticker of the attribute */
19
42
  get sticker() {
20
43
  assert(this.raw.document._ === "document");
21
44
  const parsed = parseDocument(this.raw.document);
@@ -33,9 +56,13 @@ class StarGiftUniqueBackdrop {
33
56
  get id() {
34
57
  return this.raw.backdropId;
35
58
  }
36
- /** Rarity permille of the attribute */
59
+ /** Rarity permille of the attribute, if available */
37
60
  get permille() {
38
- return this.raw.rarityPermille;
61
+ return this.raw.rarity._ === "starGiftAttributeRarity" ? this.raw.rarity.permille : null;
62
+ }
63
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
64
+ get rarity() {
65
+ return mapRarity(this.raw.rarity);
39
66
  }
40
67
  /** Display name of the attribute */
41
68
  get name() {
@@ -128,6 +155,18 @@ class StarGiftUnique {
128
155
  get isPremiumOnly() {
129
156
  return this.raw.requirePremium;
130
157
  }
158
+ /** Whether this gift was burned to craft a new one */
159
+ get isBurned() {
160
+ return this.raw.burned;
161
+ }
162
+ /** Whether this gift was crafted */
163
+ get isCrafted() {
164
+ return this.raw.crafted;
165
+ }
166
+ /** If this gift can be used in a craft, the chance of success, in permille */
167
+ get craftChancePermille() {
168
+ return this.raw.craftChancePermille ?? null;
169
+ }
131
170
  /** Number of the NFT */
132
171
  get num() {
133
172
  return this.raw.num;
@@ -14,6 +14,8 @@ const earlyTimer = require("../../utils/early-timer.cjs");
14
14
  const peerUtils = require("../../utils/peer-utils.cjs");
15
15
  const sortedArray = require("../../utils/sorted-array.cjs");
16
16
  require("@mtcute/tl-runtime");
17
+ require("@mtcute/tl/binary/reader.js");
18
+ require("@mtcute/tl/binary/writer.js");
17
19
  const batchedQueries = require("../methods/chats/batched-queries.cjs");
18
20
  const peersIndex = require("../types/peers/peers-index.cjs");
19
21
  const types = require("./types.cjs");
@@ -7,6 +7,8 @@ import { EarlyTimer } from "../../utils/early-timer.js";
7
7
  import { toggleChannelIdMark, parseMarkedPeerId, getBarePeerId, getMarkedPeerId } from "../../utils/peer-utils.js";
8
8
  import { SortedArray } from "../../utils/sorted-array.js";
9
9
  import "@mtcute/tl-runtime";
10
+ import "@mtcute/tl/binary/reader.js";
11
+ import "@mtcute/tl/binary/writer.js";
10
12
  import { _getChannelsBatched, _getUsersBatched } from "../methods/chats/batched-queries.js";
11
13
  import { PeersIndex } from "../types/peers/peers-index.js";
12
14
  import { RawUpdateInfo } from "./types.js";
package/methods.cjs CHANGED
@@ -52,11 +52,14 @@ const getChatMember = require("./highlevel/methods/chats/get-chat-member.cjs");
52
52
  const getChatMembers = require("./highlevel/methods/chats/get-chat-members.cjs");
53
53
  const getChatPreview = require("./highlevel/methods/chats/get-chat-preview.cjs");
54
54
  const getChat = require("./highlevel/methods/chats/get-chat.cjs");
55
+ const getChats = require("./highlevel/methods/chats/get-chats.cjs");
56
+ const getCreatorAfterLeave = require("./highlevel/methods/chats/get-creator-after-leave.cjs");
55
57
  const getFullChat = require("./highlevel/methods/chats/get-full-chat.cjs");
56
58
  const getFullUser = require("./highlevel/methods/chats/get-full-user.cjs");
57
59
  const getMessageAuthor = require("./highlevel/methods/chats/get-message-author.cjs");
58
60
  const getNearbyChats = require("./highlevel/methods/chats/get-nearby-chats.cjs");
59
61
  const getPeer = require("./highlevel/methods/chats/get-peer.cjs");
62
+ const getPeers = require("./highlevel/methods/chats/get-peers.cjs");
60
63
  const getSimilarChannels = require("./highlevel/methods/chats/get-similar-channels.cjs");
61
64
  const getUser = require("./highlevel/methods/chats/get-user.cjs");
62
65
  const iterChatEventLog = require("./highlevel/methods/chats/iter-chat-event-log.cjs");
@@ -331,11 +334,14 @@ exports.getChatMember = getChatMember.getChatMember;
331
334
  exports.getChatMembers = getChatMembers.getChatMembers;
332
335
  exports.getChatPreview = getChatPreview.getChatPreview;
333
336
  exports.getChat = getChat.getChat;
337
+ exports.getChats = getChats.getChats;
338
+ exports.getCreatorAfterLeave = getCreatorAfterLeave.getCreatorAfterLeave;
334
339
  exports.getFullChat = getFullChat.getFullChat;
335
340
  exports.getFullUser = getFullUser.getFullUser;
336
341
  exports.getMessageAuthor = getMessageAuthor.getMessageAuthor;
337
342
  exports.getNearbyChats = getNearbyChats.getNearbyChats;
338
343
  exports.getPeer = getPeer.getPeer;
344
+ exports.getPeers = getPeers.getPeers;
339
345
  exports.getSimilarChannels = getSimilarChannels.getSimilarChannels;
340
346
  exports.getUser = getUser.getUser;
341
347
  exports.iterChatEventLog = iterChatEventLog.iterChatEventLog;
package/methods.js CHANGED
@@ -45,11 +45,14 @@ import { getChatMember } from "./highlevel/methods/chats/get-chat-member.js";
45
45
  import { getChatMembers } from "./highlevel/methods/chats/get-chat-members.js";
46
46
  import { getChatPreview } from "./highlevel/methods/chats/get-chat-preview.js";
47
47
  import { getChat } from "./highlevel/methods/chats/get-chat.js";
48
+ import { getChats } from "./highlevel/methods/chats/get-chats.js";
49
+ import { getCreatorAfterLeave } from "./highlevel/methods/chats/get-creator-after-leave.js";
48
50
  import { getFullChat } from "./highlevel/methods/chats/get-full-chat.js";
49
51
  import { getFullUser } from "./highlevel/methods/chats/get-full-user.js";
50
52
  import { getMessageAuthor } from "./highlevel/methods/chats/get-message-author.js";
51
53
  import { getNearbyChats } from "./highlevel/methods/chats/get-nearby-chats.js";
52
54
  import { getPeer } from "./highlevel/methods/chats/get-peer.js";
55
+ import { getPeers } from "./highlevel/methods/chats/get-peers.js";
53
56
  import { getSimilarChannels } from "./highlevel/methods/chats/get-similar-channels.js";
54
57
  import { getUser } from "./highlevel/methods/chats/get-user.js";
55
58
  import { iterChatEventLog } from "./highlevel/methods/chats/iter-chat-event-log.js";
@@ -368,9 +371,11 @@ export {
368
371
  getChatMembers,
369
372
  getChatPreview,
370
373
  getChatlistPreview,
374
+ getChats,
371
375
  getCollectibleInfo,
372
376
  getCommonChats,
373
377
  getContacts,
378
+ getCreatorAfterLeave,
374
379
  getCustomEmojis,
375
380
  getCustomEmojisFromMessages,
376
381
  getDiscussionMessage,
@@ -406,6 +411,7 @@ export {
406
411
  getPeerDialogs,
407
412
  getPeerSettings,
408
413
  getPeerStories,
414
+ getPeers,
409
415
  getPrimaryInviteLink,
410
416
  getProfilePhoto,
411
417
  getProfilePhotos,
@@ -11,6 +11,8 @@ const Long = require("long");
11
11
  const longUtils = require("../utils/long-utils.cjs");
12
12
  const miscUtils = require("../utils/misc-utils.cjs");
13
13
  const sortedArray = require("../utils/sorted-array.cjs");
14
+ require("@mtcute/tl/binary/reader.js");
15
+ require("@mtcute/tl/binary/writer.js");
14
16
  const authKey = require("./auth-key.cjs");
15
17
  const errors = require("../types/errors.cjs");
16
18
  class MtprotoSession {
@@ -4,6 +4,8 @@ import Long from "long";
4
4
  import { randomLong, LongSet, LongMap, compareLongs } from "../utils/long-utils.js";
5
5
  import { getRandomInt } from "../utils/misc-utils.js";
6
6
  import { SortedArray } from "../utils/sorted-array.js";
7
+ import "@mtcute/tl/binary/reader.js";
8
+ import "@mtcute/tl/binary/writer.js";
7
9
  import { AuthKey } from "./auth-key.js";
8
10
  import { MtcuteError } from "../types/errors.js";
9
11
  class MtprotoSession {
@@ -225,7 +225,7 @@ class NetworkManager {
225
225
  _: "initConnection",
226
226
  deviceModel,
227
227
  systemVersion: "1.0",
228
- appVersion: "0.27.9",
228
+ appVersion: "0.28.1",
229
229
  systemLangCode: "en",
230
230
  langPack: "",
231
231
  // "langPacks are for official apps only"
@@ -218,7 +218,7 @@ class NetworkManager {
218
218
  _: "initConnection",
219
219
  deviceModel,
220
220
  systemVersion: "1.0",
221
- appVersion: "0.27.9",
221
+ appVersion: "0.28.1",
222
222
  systemLangCode: "en",
223
223
  langPack: "",
224
224
  // "langPacks are for official apps only"
@@ -12,6 +12,8 @@ const Long = require("long");
12
12
  const mtproto = require("../utils/crypto/mtproto.cjs");
13
13
  const earlyTimer = require("../utils/early-timer.cjs");
14
14
  const longUtils = require("../utils/long-utils.cjs");
15
+ require("@mtcute/tl/binary/reader.js");
16
+ require("@mtcute/tl/binary/writer.js");
15
17
  const authorization = require("./authorization.cjs");
16
18
  const mtprotoSession = require("./mtproto-session.cjs");
17
19
  const persistentConnection = require("./persistent-connection.cjs");
@@ -5,6 +5,8 @@ import Long from "long";
5
5
  import { createAesIgeForMessageOld } from "../utils/crypto/mtproto.js";
6
6
  import { EarlyTimer } from "../utils/early-timer.js";
7
7
  import { longFromBuffer, randomLong, removeFromLongArray } from "../utils/long-utils.js";
8
+ import "@mtcute/tl/binary/reader.js";
9
+ import "@mtcute/tl/binary/writer.js";
8
10
  import { doAuthorization } from "./authorization.js";
9
11
  import { MtprotoSession } from "./mtproto-session.js";
10
12
  import { PersistentConnection } from "./persistent-connection.js";
@@ -9,6 +9,8 @@ const io = require("@fuman/io");
9
9
  const utils = require("@fuman/utils");
10
10
  const miscUtils = require("../../utils/misc-utils.cjs");
11
11
  require("@mtcute/tl-runtime");
12
+ require("@mtcute/tl/binary/reader.js");
13
+ require("@mtcute/tl/binary/writer.js");
12
14
  const abstract = require("./abstract.cjs");
13
15
  const TAG = new Uint8Array([238, 238, 238, 238]);
14
16
  const PADDED_TAG = new Uint8Array([221, 221, 221, 221]);
@@ -2,6 +2,8 @@ import { read, write } from "@fuman/io";
2
2
  import { typed } from "@fuman/utils";
3
3
  import { getRandomInt } from "../../utils/misc-utils.js";
4
4
  import "@mtcute/tl-runtime";
5
+ import "@mtcute/tl/binary/reader.js";
6
+ import "@mtcute/tl/binary/writer.js";
5
7
  import { TransportError } from "./abstract.js";
6
8
  const TAG = new Uint8Array([238, 238, 238, 238]);
7
9
  const PADDED_TAG = new Uint8Array([221, 221, 221, 221]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mtcute/core",
3
3
  "type": "module",
4
- "version": "0.27.9",
4
+ "version": "0.28.1",
5
5
  "description": "Type-safe library for MTProto (Telegram API)",
6
6
  "license": "MIT",
7
7
  "scripts": {},
@@ -9,8 +9,8 @@
9
9
  "@fuman/io": "0.0.19",
10
10
  "@fuman/net": "0.0.19",
11
11
  "@fuman/utils": "0.0.19",
12
- "@mtcute/file-id": "^0.27.8",
13
- "@mtcute/tl": "^221.0.0",
12
+ "@mtcute/file-id": "^0.28.1",
13
+ "@mtcute/tl": "^222.0.0",
14
14
  "@mtcute/tl-runtime": "^0.24.3",
15
15
  "@types/events": "3.0.0",
16
16
  "long": "5.2.3"
@@ -8,6 +8,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
8
  const defaultDcs = require("./service/default-dcs.cjs");
9
9
  const functionUtils = require("../utils/function-utils.cjs");
10
10
  require("@mtcute/tl-runtime");
11
+ require("@mtcute/tl/binary/reader.js");
12
+ require("@mtcute/tl/binary/writer.js");
11
13
  const authKeys = require("./service/auth-keys.cjs");
12
14
  const futureSalts = require("./service/future-salts.cjs");
13
15
  class StorageManager {
@@ -1,6 +1,8 @@
1
1
  import { DefaultDcsService } from "./service/default-dcs.js";
2
2
  import { asyncResettable } from "../utils/function-utils.js";
3
3
  import "@mtcute/tl-runtime";
4
+ import "@mtcute/tl/binary/reader.js";
5
+ import "@mtcute/tl/binary/writer.js";
4
6
  import { AuthKeysService } from "./service/auth-keys.js";
5
7
  import { FutureSaltsService } from "./service/future-salts.js";
6
8
  class StorageManager {