@mtcute/core 0.25.5 → 0.25.7
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/client.cjs +4 -0
- package/client.js +4 -0
- package/highlevel/client.d.cts +49 -2
- package/highlevel/client.d.ts +49 -2
- package/highlevel/methods/messages/search-posts-global.cjs +48 -0
- package/highlevel/methods/messages/search-posts-global.d.cts +27 -0
- package/highlevel/methods/messages/search-posts-global.d.ts +27 -0
- package/highlevel/methods/messages/search-posts-global.js +43 -0
- package/highlevel/methods/premium/get-saved-star-gifts.cjs +1 -0
- package/highlevel/methods/premium/get-saved-star-gifts.d.cts +2 -0
- package/highlevel/methods/premium/get-saved-star-gifts.d.ts +2 -0
- package/highlevel/methods/premium/get-saved-star-gifts.js +1 -0
- package/highlevel/methods/premium/set-gift-resale-price.cjs +11 -1
- package/highlevel/methods/premium/set-gift-resale-price.d.cts +5 -2
- package/highlevel/methods/premium/set-gift-resale-price.d.ts +5 -2
- package/highlevel/methods/premium/set-gift-resale-price.js +11 -1
- package/highlevel/methods/stories/send-story.cjs +3 -2
- package/highlevel/methods/stories/send-story.d.cts +4 -0
- package/highlevel/methods/stories/send-story.d.ts +4 -0
- package/highlevel/methods/stories/send-story.js +3 -2
- package/highlevel/methods.d.cts +2 -0
- package/highlevel/methods.d.ts +2 -0
- package/highlevel/types/messages/message-action.cjs +2 -1
- package/highlevel/types/messages/message-action.d.cts +2 -0
- package/highlevel/types/messages/message-action.d.ts +2 -0
- package/highlevel/types/messages/message-action.js +2 -1
- package/highlevel/types/peers/full-user.cjs +20 -1
- package/highlevel/types/peers/full-user.d.cts +13 -0
- package/highlevel/types/peers/full-user.d.ts +13 -0
- package/highlevel/types/peers/full-user.js +20 -1
- package/highlevel/types/premium/saved-star-gift.cjs +4 -0
- package/highlevel/types/premium/saved-star-gift.d.cts +2 -0
- package/highlevel/types/premium/saved-star-gift.d.ts +2 -0
- package/highlevel/types/premium/saved-star-gift.js +4 -0
- package/highlevel/types/premium/stars-gift-unique.cjs +12 -1
- package/highlevel/types/premium/stars-gift-unique.d.cts +4 -0
- package/highlevel/types/premium/stars-gift-unique.d.ts +4 -0
- package/highlevel/types/premium/stars-gift-unique.js +12 -1
- package/highlevel/types/premium/stars-gift.cjs +16 -0
- package/highlevel/types/premium/stars-gift.d.cts +10 -0
- package/highlevel/types/premium/stars-gift.d.ts +10 -0
- package/highlevel/types/premium/stars-gift.js +16 -0
- package/highlevel/types/stories/story.cjs +6 -0
- package/highlevel/types/stories/story.d.cts +4 -0
- package/highlevel/types/stories/story.d.ts +4 -0
- package/highlevel/types/stories/story.js +6 -0
- package/methods.cjs +2 -0
- package/methods.js +2 -0
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/network/session-connection.cjs +5 -1
- package/network/session-connection.d.cts +1 -0
- package/network/session-connection.d.ts +1 -0
- package/network/session-connection.js +5 -1
- package/package.json +2 -2
- package/utils/binary/compat.cjs +33 -0
- package/utils/binary/compat.js +33 -0
package/highlevel/methods.d.ts
CHANGED
|
@@ -174,6 +174,8 @@ export { iterSearchHashtag } from './methods/messages/search-hashtag.js';
|
|
|
174
174
|
export type { SearchHashtagOffset } from './methods/messages/search-hashtag.js';
|
|
175
175
|
export { searchMessages } from './methods/messages/search-messages.js';
|
|
176
176
|
export type { SearchMessagesOffset } from './methods/messages/search-messages.js';
|
|
177
|
+
export { searchPostsGlobal } from './methods/messages/search-posts-global.js';
|
|
178
|
+
export type { SearchPostsGlobalOffset } from './methods/messages/search-posts-global.js';
|
|
177
179
|
export { answerText } from './methods/messages/send-answer.js';
|
|
178
180
|
export { answerMedia } from './methods/messages/send-answer.js';
|
|
179
181
|
export { answerMediaGroup } from './methods/messages/send-answer.js';
|
|
@@ -321,7 +321,8 @@ function _messageActionFromTl(act) {
|
|
|
321
321
|
upgradeStars: Long.ZERO,
|
|
322
322
|
upgradeMsgId: null,
|
|
323
323
|
canTransferSince: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
|
|
324
|
-
resaleStars: act.
|
|
324
|
+
resaleStars: act.resaleAmount?._ === "starsAmount" ? act.resaleAmount.amount : void 0,
|
|
325
|
+
resaleTon: act.resaleAmount?._ === "starsTonAmount" ? act.resaleAmount.amount : void 0,
|
|
325
326
|
canResellAt: act.canResellAt ? new Date(act.canResellAt * 1e3) : void 0,
|
|
326
327
|
fromId: act.fromId ? peerUtils.getMarkedPeerId(act.fromId) : void 0,
|
|
327
328
|
toId: act.peer ? peerUtils.getMarkedPeerId(act.peer) : void 0,
|
|
@@ -426,6 +426,8 @@ export interface ActionStarGift {
|
|
|
426
426
|
canTransferSince?: Date;
|
|
427
427
|
/** Number of stars this gift is up for resell for */
|
|
428
428
|
resaleStars?: tl.Long;
|
|
429
|
+
/** Number of nanoton this gift is up for resell for */
|
|
430
|
+
resaleTon?: tl.Long;
|
|
429
431
|
/** If the gift can be re-sold, date when it will become available */
|
|
430
432
|
canResellAt?: Date;
|
|
431
433
|
/** The gift itself */
|
|
@@ -426,6 +426,8 @@ export interface ActionStarGift {
|
|
|
426
426
|
canTransferSince?: Date;
|
|
427
427
|
/** Number of stars this gift is up for resell for */
|
|
428
428
|
resaleStars?: tl.Long;
|
|
429
|
+
/** Number of nanoton this gift is up for resell for */
|
|
430
|
+
resaleTon?: tl.Long;
|
|
429
431
|
/** If the gift can be re-sold, date when it will become available */
|
|
430
432
|
canResellAt?: Date;
|
|
431
433
|
/** The gift itself */
|
|
@@ -314,7 +314,8 @@ function _messageActionFromTl(act) {
|
|
|
314
314
|
upgradeStars: Long.ZERO,
|
|
315
315
|
upgradeMsgId: null,
|
|
316
316
|
canTransferSince: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
|
|
317
|
-
resaleStars: act.
|
|
317
|
+
resaleStars: act.resaleAmount?._ === "starsAmount" ? act.resaleAmount.amount : void 0,
|
|
318
|
+
resaleTon: act.resaleAmount?._ === "starsTonAmount" ? act.resaleAmount.amount : void 0,
|
|
318
319
|
canResellAt: act.canResellAt ? new Date(act.canResellAt * 1e3) : void 0,
|
|
319
320
|
fromId: act.fromId ? getMarkedPeerId(act.fromId) : void 0,
|
|
320
321
|
toId: act.peer ? getMarkedPeerId(act.peer) : void 0,
|
|
@@ -216,6 +216,24 @@ class FullUser extends user.User {
|
|
|
216
216
|
if (!this.full.botVerification) return null;
|
|
217
217
|
return new botVerification.BotVerification(this.full.botVerification);
|
|
218
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Information about the user's stars rating
|
|
221
|
+
*/
|
|
222
|
+
get starsRating() {
|
|
223
|
+
return this.full.starsRating ?? null;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Information about the user's stars rating
|
|
227
|
+
*
|
|
228
|
+
* Only available for the current user
|
|
229
|
+
*/
|
|
230
|
+
get starsRatingPending() {
|
|
231
|
+
if (!this.full.starsMyPendingRating) return null;
|
|
232
|
+
return {
|
|
233
|
+
rating: this.full.starsMyPendingRating,
|
|
234
|
+
date: new Date(this.full.starsMyPendingRatingDate * 1e3)
|
|
235
|
+
};
|
|
236
|
+
}
|
|
219
237
|
}
|
|
220
238
|
const FullUser$1 = /* @__PURE__ */ memoize.memoizeGetters(FullUser, [
|
|
221
239
|
"fullPhoto",
|
|
@@ -224,7 +242,8 @@ const FullUser$1 = /* @__PURE__ */ memoize.memoizeGetters(FullUser, [
|
|
|
224
242
|
"publicPhoto",
|
|
225
243
|
"personalChannel",
|
|
226
244
|
"business",
|
|
227
|
-
"botVerification"
|
|
245
|
+
"botVerification",
|
|
246
|
+
"starsRatingPending"
|
|
228
247
|
]);
|
|
229
248
|
const FullUser$2 = /* @__PURE__ */ inspectable.makeInspectable(FullUser$1);
|
|
230
249
|
exports.FullUser = FullUser$2;
|
|
@@ -119,4 +119,17 @@ export declare class FullUser extends User {
|
|
|
119
119
|
get business(): BusinessAccount | null;
|
|
120
120
|
/** Information about a bot-issued verification (if any) */
|
|
121
121
|
get botVerification(): BotVerification | null;
|
|
122
|
+
/**
|
|
123
|
+
* Information about the user's stars rating
|
|
124
|
+
*/
|
|
125
|
+
get starsRating(): tl.RawStarsRating | null;
|
|
126
|
+
/**
|
|
127
|
+
* Information about the user's stars rating
|
|
128
|
+
*
|
|
129
|
+
* Only available for the current user
|
|
130
|
+
*/
|
|
131
|
+
get starsRatingPending(): {
|
|
132
|
+
rating: tl.RawStarsRating;
|
|
133
|
+
date: Date;
|
|
134
|
+
} | null;
|
|
122
135
|
}
|
|
@@ -119,4 +119,17 @@ export declare class FullUser extends User {
|
|
|
119
119
|
get business(): BusinessAccount | null;
|
|
120
120
|
/** Information about a bot-issued verification (if any) */
|
|
121
121
|
get botVerification(): BotVerification | null;
|
|
122
|
+
/**
|
|
123
|
+
* Information about the user's stars rating
|
|
124
|
+
*/
|
|
125
|
+
get starsRating(): tl.RawStarsRating | null;
|
|
126
|
+
/**
|
|
127
|
+
* Information about the user's stars rating
|
|
128
|
+
*
|
|
129
|
+
* Only available for the current user
|
|
130
|
+
*/
|
|
131
|
+
get starsRatingPending(): {
|
|
132
|
+
rating: tl.RawStarsRating;
|
|
133
|
+
date: Date;
|
|
134
|
+
} | null;
|
|
122
135
|
}
|
|
@@ -209,6 +209,24 @@ class FullUser extends User$2 {
|
|
|
209
209
|
if (!this.full.botVerification) return null;
|
|
210
210
|
return new BotVerification$1(this.full.botVerification);
|
|
211
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Information about the user's stars rating
|
|
214
|
+
*/
|
|
215
|
+
get starsRating() {
|
|
216
|
+
return this.full.starsRating ?? null;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Information about the user's stars rating
|
|
220
|
+
*
|
|
221
|
+
* Only available for the current user
|
|
222
|
+
*/
|
|
223
|
+
get starsRatingPending() {
|
|
224
|
+
if (!this.full.starsMyPendingRating) return null;
|
|
225
|
+
return {
|
|
226
|
+
rating: this.full.starsMyPendingRating,
|
|
227
|
+
date: new Date(this.full.starsMyPendingRatingDate * 1e3)
|
|
228
|
+
};
|
|
229
|
+
}
|
|
212
230
|
}
|
|
213
231
|
const FullUser$1 = /* @__PURE__ */ memoizeGetters(FullUser, [
|
|
214
232
|
"fullPhoto",
|
|
@@ -217,7 +235,8 @@ const FullUser$1 = /* @__PURE__ */ memoizeGetters(FullUser, [
|
|
|
217
235
|
"publicPhoto",
|
|
218
236
|
"personalChannel",
|
|
219
237
|
"business",
|
|
220
|
-
"botVerification"
|
|
238
|
+
"botVerification",
|
|
239
|
+
"starsRatingPending"
|
|
221
240
|
]);
|
|
222
241
|
const FullUser$2 = /* @__PURE__ */ makeInspectable(FullUser$1);
|
|
223
242
|
export {
|
|
@@ -86,6 +86,10 @@ class SavedStarGift {
|
|
|
86
86
|
get canResellAt() {
|
|
87
87
|
return this.raw.canResellAt ? new Date(this.raw.canResellAt * 1e3) : null;
|
|
88
88
|
}
|
|
89
|
+
/** IDs of the collections this gift belongs to */
|
|
90
|
+
get collectionIds() {
|
|
91
|
+
return this.raw.collectionId ?? [];
|
|
92
|
+
}
|
|
89
93
|
}
|
|
90
94
|
const SavedStarGift$1 = /* @__PURE__ */ inspectable.makeInspectable(SavedStarGift);
|
|
91
95
|
const SavedStarGift$2 = /* @__PURE__ */ memoize.memoizeGetters(SavedStarGift$1, ["sender", "gift"]);
|
|
@@ -79,6 +79,10 @@ class SavedStarGift {
|
|
|
79
79
|
get canResellAt() {
|
|
80
80
|
return this.raw.canResellAt ? new Date(this.raw.canResellAt * 1e3) : null;
|
|
81
81
|
}
|
|
82
|
+
/** IDs of the collections this gift belongs to */
|
|
83
|
+
get collectionIds() {
|
|
84
|
+
return this.raw.collectionId ?? [];
|
|
85
|
+
}
|
|
82
86
|
}
|
|
83
87
|
const SavedStarGift$1 = /* @__PURE__ */ makeInspectable(SavedStarGift);
|
|
84
88
|
const SavedStarGift$2 = /* @__PURE__ */ memoizeGetters(SavedStarGift$1, ["sender", "gift"]);
|
|
@@ -131,6 +131,10 @@ class StarGiftUnique {
|
|
|
131
131
|
_originalDetails;
|
|
132
132
|
/** Whether this gift is a unique gift */
|
|
133
133
|
isUnique = true;
|
|
134
|
+
/** Whether this gift is available only to premium users */
|
|
135
|
+
get isPremiumOnly() {
|
|
136
|
+
return this.raw.requirePremium;
|
|
137
|
+
}
|
|
134
138
|
/** Number of the NFT */
|
|
135
139
|
get num() {
|
|
136
140
|
return this.raw.num;
|
|
@@ -168,9 +172,16 @@ class StarGiftUnique {
|
|
|
168
172
|
get availabilityTotal() {
|
|
169
173
|
return this.raw.availabilityTotal;
|
|
170
174
|
}
|
|
175
|
+
// todo for breaking: rename to resellPriceStars
|
|
171
176
|
/** Number of stars this gift is up for resell for */
|
|
172
177
|
get resellPrice() {
|
|
173
|
-
|
|
178
|
+
const resellPriceStars = this.raw.resellAmount?.find((it) => it._ === "starsAmount");
|
|
179
|
+
return resellPriceStars?.amount ?? null;
|
|
180
|
+
}
|
|
181
|
+
/** Number of nanoton this gift is up for resell for */
|
|
182
|
+
get resellPriceTon() {
|
|
183
|
+
const resellPriceTon = this.raw.resellAmount?.find((it) => it._ === "starsTonAmount");
|
|
184
|
+
return resellPriceTon?.amount ?? null;
|
|
174
185
|
}
|
|
175
186
|
/** Model (i.e. the gift itself) of the unique star gift */
|
|
176
187
|
get model() {
|
|
@@ -67,6 +67,8 @@ export declare class StarGiftUnique {
|
|
|
67
67
|
/** Whether this gift is a unique gift */
|
|
68
68
|
readonly isUnique: true;
|
|
69
69
|
constructor(raw: tl.RawStarGiftUnique, _peers: PeersIndex);
|
|
70
|
+
/** Whether this gift is available only to premium users */
|
|
71
|
+
get isPremiumOnly(): boolean;
|
|
70
72
|
/** Number of the NFT */
|
|
71
73
|
get num(): number;
|
|
72
74
|
/** Title of the NFT */
|
|
@@ -87,6 +89,8 @@ export declare class StarGiftUnique {
|
|
|
87
89
|
get availabilityTotal(): number;
|
|
88
90
|
/** Number of stars this gift is up for resell for */
|
|
89
91
|
get resellPrice(): tl.Long | null;
|
|
92
|
+
/** Number of nanoton this gift is up for resell for */
|
|
93
|
+
get resellPriceTon(): tl.Long | null;
|
|
90
94
|
/** Model (i.e. the gift itself) of the unique star gift */
|
|
91
95
|
get model(): StarGiftUniqueAttribute;
|
|
92
96
|
/** Pattern of the unique star gift */
|
|
@@ -67,6 +67,8 @@ export declare class StarGiftUnique {
|
|
|
67
67
|
/** Whether this gift is a unique gift */
|
|
68
68
|
readonly isUnique: true;
|
|
69
69
|
constructor(raw: tl.RawStarGiftUnique, _peers: PeersIndex);
|
|
70
|
+
/** Whether this gift is available only to premium users */
|
|
71
|
+
get isPremiumOnly(): boolean;
|
|
70
72
|
/** Number of the NFT */
|
|
71
73
|
get num(): number;
|
|
72
74
|
/** Title of the NFT */
|
|
@@ -87,6 +89,8 @@ export declare class StarGiftUnique {
|
|
|
87
89
|
get availabilityTotal(): number;
|
|
88
90
|
/** Number of stars this gift is up for resell for */
|
|
89
91
|
get resellPrice(): tl.Long | null;
|
|
92
|
+
/** Number of nanoton this gift is up for resell for */
|
|
93
|
+
get resellPriceTon(): tl.Long | null;
|
|
90
94
|
/** Model (i.e. the gift itself) of the unique star gift */
|
|
91
95
|
get model(): StarGiftUniqueAttribute;
|
|
92
96
|
/** Pattern of the unique star gift */
|
|
@@ -124,6 +124,10 @@ class StarGiftUnique {
|
|
|
124
124
|
_originalDetails;
|
|
125
125
|
/** Whether this gift is a unique gift */
|
|
126
126
|
isUnique = true;
|
|
127
|
+
/** Whether this gift is available only to premium users */
|
|
128
|
+
get isPremiumOnly() {
|
|
129
|
+
return this.raw.requirePremium;
|
|
130
|
+
}
|
|
127
131
|
/** Number of the NFT */
|
|
128
132
|
get num() {
|
|
129
133
|
return this.raw.num;
|
|
@@ -161,9 +165,16 @@ class StarGiftUnique {
|
|
|
161
165
|
get availabilityTotal() {
|
|
162
166
|
return this.raw.availabilityTotal;
|
|
163
167
|
}
|
|
168
|
+
// todo for breaking: rename to resellPriceStars
|
|
164
169
|
/** Number of stars this gift is up for resell for */
|
|
165
170
|
get resellPrice() {
|
|
166
|
-
|
|
171
|
+
const resellPriceStars = this.raw.resellAmount?.find((it) => it._ === "starsAmount");
|
|
172
|
+
return resellPriceStars?.amount ?? null;
|
|
173
|
+
}
|
|
174
|
+
/** Number of nanoton this gift is up for resell for */
|
|
175
|
+
get resellPriceTon() {
|
|
176
|
+
const resellPriceTon = this.raw.resellAmount?.find((it) => it._ === "starsTonAmount");
|
|
177
|
+
return resellPriceTon?.amount ?? null;
|
|
167
178
|
}
|
|
168
179
|
/** Model (i.e. the gift itself) of the unique star gift */
|
|
169
180
|
get model() {
|
|
@@ -29,6 +29,10 @@ class StarGift {
|
|
|
29
29
|
get isLimited() {
|
|
30
30
|
return this.raw.limited;
|
|
31
31
|
}
|
|
32
|
+
/** Whether this gift is available only to premium users */
|
|
33
|
+
get isPremiumOnly() {
|
|
34
|
+
return this.raw.requirePremium;
|
|
35
|
+
}
|
|
32
36
|
/** Whether this gift is a unique gift */
|
|
33
37
|
isUnique = false;
|
|
34
38
|
/** Additional information for sold-out gifts */
|
|
@@ -80,6 +84,18 @@ class StarGift {
|
|
|
80
84
|
resale: this.raw.availabilityResale ?? Long.ZERO
|
|
81
85
|
};
|
|
82
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* For gifts with limited availability per user,
|
|
89
|
+
* the number of remaining and total gifts available
|
|
90
|
+
*/
|
|
91
|
+
get perUserAvailability() {
|
|
92
|
+
if (!this.raw.limitedPerUser) return null;
|
|
93
|
+
return {
|
|
94
|
+
// they share the same flag so they must be present
|
|
95
|
+
remains: this.raw.perUserRemains,
|
|
96
|
+
total: this.raw.perUserTotal
|
|
97
|
+
};
|
|
98
|
+
}
|
|
83
99
|
/** Floor price for the gift on the secondary market */
|
|
84
100
|
get resaleFloorPrice() {
|
|
85
101
|
return this.raw.resellMinStars ?? null;
|
|
@@ -26,6 +26,8 @@ export declare class StarGift {
|
|
|
26
26
|
get isSoldOut(): boolean;
|
|
27
27
|
/** Whether this gift has limited availability */
|
|
28
28
|
get isLimited(): boolean;
|
|
29
|
+
/** Whether this gift is available only to premium users */
|
|
30
|
+
get isPremiumOnly(): boolean;
|
|
29
31
|
/** Whether this gift is a unique gift */
|
|
30
32
|
readonly isUnique: false;
|
|
31
33
|
/** Additional information for sold-out gifts */
|
|
@@ -57,6 +59,14 @@ export declare class StarGift {
|
|
|
57
59
|
/** Number of gifts available on the secondary market */
|
|
58
60
|
resale: Long;
|
|
59
61
|
} | null;
|
|
62
|
+
/**
|
|
63
|
+
* For gifts with limited availability per user,
|
|
64
|
+
* the number of remaining and total gifts available
|
|
65
|
+
*/
|
|
66
|
+
get perUserAvailability(): {
|
|
67
|
+
remains: number;
|
|
68
|
+
total: number;
|
|
69
|
+
} | null;
|
|
60
70
|
/** Floor price for the gift on the secondary market */
|
|
61
71
|
get resaleFloorPrice(): tl.Long | null;
|
|
62
72
|
/** Title of the gift */
|
|
@@ -26,6 +26,8 @@ export declare class StarGift {
|
|
|
26
26
|
get isSoldOut(): boolean;
|
|
27
27
|
/** Whether this gift has limited availability */
|
|
28
28
|
get isLimited(): boolean;
|
|
29
|
+
/** Whether this gift is available only to premium users */
|
|
30
|
+
get isPremiumOnly(): boolean;
|
|
29
31
|
/** Whether this gift is a unique gift */
|
|
30
32
|
readonly isUnique: false;
|
|
31
33
|
/** Additional information for sold-out gifts */
|
|
@@ -57,6 +59,14 @@ export declare class StarGift {
|
|
|
57
59
|
/** Number of gifts available on the secondary market */
|
|
58
60
|
resale: Long;
|
|
59
61
|
} | null;
|
|
62
|
+
/**
|
|
63
|
+
* For gifts with limited availability per user,
|
|
64
|
+
* the number of remaining and total gifts available
|
|
65
|
+
*/
|
|
66
|
+
get perUserAvailability(): {
|
|
67
|
+
remains: number;
|
|
68
|
+
total: number;
|
|
69
|
+
} | null;
|
|
60
70
|
/** Floor price for the gift on the secondary market */
|
|
61
71
|
get resaleFloorPrice(): tl.Long | null;
|
|
62
72
|
/** Title of the gift */
|
|
@@ -22,6 +22,10 @@ class StarGift {
|
|
|
22
22
|
get isLimited() {
|
|
23
23
|
return this.raw.limited;
|
|
24
24
|
}
|
|
25
|
+
/** Whether this gift is available only to premium users */
|
|
26
|
+
get isPremiumOnly() {
|
|
27
|
+
return this.raw.requirePremium;
|
|
28
|
+
}
|
|
25
29
|
/** Whether this gift is a unique gift */
|
|
26
30
|
isUnique = false;
|
|
27
31
|
/** Additional information for sold-out gifts */
|
|
@@ -73,6 +77,18 @@ class StarGift {
|
|
|
73
77
|
resale: this.raw.availabilityResale ?? Long.ZERO
|
|
74
78
|
};
|
|
75
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* For gifts with limited availability per user,
|
|
82
|
+
* the number of remaining and total gifts available
|
|
83
|
+
*/
|
|
84
|
+
get perUserAvailability() {
|
|
85
|
+
if (!this.raw.limitedPerUser) return null;
|
|
86
|
+
return {
|
|
87
|
+
// they share the same flag so they must be present
|
|
88
|
+
remains: this.raw.perUserRemains,
|
|
89
|
+
total: this.raw.perUserTotal
|
|
90
|
+
};
|
|
91
|
+
}
|
|
76
92
|
/** Floor price for the gift on the secondary market */
|
|
77
93
|
get resaleFloorPrice() {
|
|
78
94
|
return this.raw.resellMinStars ?? null;
|
|
@@ -135,6 +135,12 @@ class Story {
|
|
|
135
135
|
if (!this.raw.sentReaction) return null;
|
|
136
136
|
return types.toReactionEmoji(this.raw.sentReaction, true);
|
|
137
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Albums this story belongs to
|
|
140
|
+
*/
|
|
141
|
+
get albums() {
|
|
142
|
+
return this.raw.albums ?? [];
|
|
143
|
+
}
|
|
138
144
|
}
|
|
139
145
|
const Story$1 = /* @__PURE__ */ memoize.memoizeGetters(Story, ["entities", "media", "interactiveElements", "interactions"]);
|
|
140
146
|
const Story$2 = /* @__PURE__ */ inspectable.makeInspectable(Story$1);
|
|
@@ -128,6 +128,12 @@ class Story {
|
|
|
128
128
|
if (!this.raw.sentReaction) return null;
|
|
129
129
|
return toReactionEmoji(this.raw.sentReaction, true);
|
|
130
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Albums this story belongs to
|
|
133
|
+
*/
|
|
134
|
+
get albums() {
|
|
135
|
+
return this.raw.albums ?? [];
|
|
136
|
+
}
|
|
131
137
|
}
|
|
132
138
|
const Story$1 = /* @__PURE__ */ memoizeGetters(Story, ["entities", "media", "interactiveElements", "interactions"]);
|
|
133
139
|
const Story$2 = /* @__PURE__ */ makeInspectable(Story$1);
|
package/methods.cjs
CHANGED
|
@@ -161,6 +161,7 @@ const readReactions = require("./highlevel/methods/messages/read-reactions.cjs")
|
|
|
161
161
|
const searchGlobal = require("./highlevel/methods/messages/search-global.cjs");
|
|
162
162
|
const searchHashtag = require("./highlevel/methods/messages/search-hashtag.cjs");
|
|
163
163
|
const searchMessages = require("./highlevel/methods/messages/search-messages.cjs");
|
|
164
|
+
const searchPostsGlobal = require("./highlevel/methods/messages/search-posts-global.cjs");
|
|
164
165
|
const sendAnswer = require("./highlevel/methods/messages/send-answer.cjs");
|
|
165
166
|
const sendComment = require("./highlevel/methods/messages/send-comment.cjs");
|
|
166
167
|
const sendCopyGroup = require("./highlevel/methods/messages/send-copy-group.cjs");
|
|
@@ -437,6 +438,7 @@ exports.searchGlobal = searchGlobal.searchGlobal;
|
|
|
437
438
|
exports.iterSearchHashtag = searchHashtag.iterSearchHashtag;
|
|
438
439
|
exports.searchHashtag = searchHashtag.searchHashtag;
|
|
439
440
|
exports.searchMessages = searchMessages.searchMessages;
|
|
441
|
+
exports.searchPostsGlobal = searchPostsGlobal.searchPostsGlobal;
|
|
440
442
|
exports.answerMedia = sendAnswer.answerMedia;
|
|
441
443
|
exports.answerMediaGroup = sendAnswer.answerMediaGroup;
|
|
442
444
|
exports.answerText = sendAnswer.answerText;
|
package/methods.js
CHANGED
|
@@ -154,6 +154,7 @@ import { readReactions } from "./highlevel/methods/messages/read-reactions.js";
|
|
|
154
154
|
import { searchGlobal } from "./highlevel/methods/messages/search-global.js";
|
|
155
155
|
import { iterSearchHashtag, searchHashtag } from "./highlevel/methods/messages/search-hashtag.js";
|
|
156
156
|
import { searchMessages } from "./highlevel/methods/messages/search-messages.js";
|
|
157
|
+
import { searchPostsGlobal } from "./highlevel/methods/messages/search-posts-global.js";
|
|
157
158
|
import { answerMedia, answerMediaGroup, answerText } from "./highlevel/methods/messages/send-answer.js";
|
|
158
159
|
import { commentMedia, commentMediaGroup, commentText } from "./highlevel/methods/messages/send-comment.js";
|
|
159
160
|
import { sendCopyGroup } from "./highlevel/methods/messages/send-copy-group.js";
|
|
@@ -483,6 +484,7 @@ export {
|
|
|
483
484
|
searchGlobal,
|
|
484
485
|
searchHashtag,
|
|
485
486
|
searchMessages,
|
|
487
|
+
searchPostsGlobal,
|
|
486
488
|
sendCode,
|
|
487
489
|
sendCopy,
|
|
488
490
|
sendCopyGroup,
|
|
@@ -354,6 +354,7 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
354
354
|
this._pendingWaitForUnencrypted.push([promise, timeoutId]);
|
|
355
355
|
return promise.promise;
|
|
356
356
|
}
|
|
357
|
+
_warnedAboutUpdates = false;
|
|
357
358
|
onMessage(data) {
|
|
358
359
|
if (this._pendingWaitForUnencrypted.length) {
|
|
359
360
|
const int32 = new Int32Array(data.buffer, data.byteOffset, 2);
|
|
@@ -475,7 +476,10 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
475
476
|
}
|
|
476
477
|
this.log.verbose("<<< %j", message);
|
|
477
478
|
if (this.params.disableUpdates) {
|
|
478
|
-
this.
|
|
479
|
+
if (!this._warnedAboutUpdates) {
|
|
480
|
+
this.log.warn("received updates, but updates are disabled");
|
|
481
|
+
this._warnedAboutUpdates = true;
|
|
482
|
+
}
|
|
479
483
|
break;
|
|
480
484
|
}
|
|
481
485
|
this.onUpdate.emit(message);
|
|
@@ -63,6 +63,7 @@ export declare class SessionConnection extends PersistentConnection {
|
|
|
63
63
|
_authorize(): void;
|
|
64
64
|
private _authorizePfs;
|
|
65
65
|
waitForUnencryptedMessage(timeout?: number): Promise<Uint8Array>;
|
|
66
|
+
private _warnedAboutUpdates;
|
|
66
67
|
protected onMessage(data: Uint8Array): void;
|
|
67
68
|
private _handleRawMessage;
|
|
68
69
|
private _handleMessage;
|
|
@@ -63,6 +63,7 @@ export declare class SessionConnection extends PersistentConnection {
|
|
|
63
63
|
_authorize(): void;
|
|
64
64
|
private _authorizePfs;
|
|
65
65
|
waitForUnencryptedMessage(timeout?: number): Promise<Uint8Array>;
|
|
66
|
+
private _warnedAboutUpdates;
|
|
66
67
|
protected onMessage(data: Uint8Array): void;
|
|
67
68
|
private _handleRawMessage;
|
|
68
69
|
private _handleMessage;
|
|
@@ -347,6 +347,7 @@ class SessionConnection extends PersistentConnection {
|
|
|
347
347
|
this._pendingWaitForUnencrypted.push([promise, timeoutId]);
|
|
348
348
|
return promise.promise;
|
|
349
349
|
}
|
|
350
|
+
_warnedAboutUpdates = false;
|
|
350
351
|
onMessage(data) {
|
|
351
352
|
if (this._pendingWaitForUnencrypted.length) {
|
|
352
353
|
const int32 = new Int32Array(data.buffer, data.byteOffset, 2);
|
|
@@ -468,7 +469,10 @@ class SessionConnection extends PersistentConnection {
|
|
|
468
469
|
}
|
|
469
470
|
this.log.verbose("<<< %j", message);
|
|
470
471
|
if (this.params.disableUpdates) {
|
|
471
|
-
this.
|
|
472
|
+
if (!this._warnedAboutUpdates) {
|
|
473
|
+
this.log.warn("received updates, but updates are disabled");
|
|
474
|
+
this._warnedAboutUpdates = true;
|
|
475
|
+
}
|
|
472
476
|
break;
|
|
473
477
|
}
|
|
474
478
|
this.onUpdate.emit(message);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtcute/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.25.
|
|
4
|
+
"version": "0.25.7",
|
|
5
5
|
"description": "Type-safe library for MTProto (Telegram API)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@fuman/net": "0.0.15",
|
|
11
11
|
"@fuman/utils": "0.0.15",
|
|
12
12
|
"@mtcute/file-id": "^0.24.3",
|
|
13
|
-
"@mtcute/tl": "^
|
|
13
|
+
"@mtcute/tl": "^211.0.0",
|
|
14
14
|
"@mtcute/tl-runtime": "^0.24.3",
|
|
15
15
|
"@types/events": "3.0.0",
|
|
16
16
|
"long": "5.2.3"
|