@mtcute/core 0.25.7 → 0.26.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.
- package/client.cjs +20 -11
- package/client.js +23 -14
- package/highlevel/client.d.cts +80 -64
- package/highlevel/client.d.ts +80 -64
- package/highlevel/methods/files/normalize-input-media.cjs +13 -4
- package/highlevel/methods/files/normalize-input-media.js +13 -4
- package/highlevel/methods/forums/toggle-forum.cjs +0 -10
- package/highlevel/methods/forums/toggle-forum.d.cts +0 -10
- package/highlevel/methods/forums/toggle-forum.d.ts +0 -10
- package/highlevel/methods/forums/toggle-forum.js +0 -10
- package/highlevel/methods/premium/buy-resale-gift.cjs +3 -2
- package/highlevel/methods/premium/buy-resale-gift.d.cts +2 -0
- package/highlevel/methods/premium/buy-resale-gift.d.ts +2 -0
- package/highlevel/methods/premium/buy-resale-gift.js +3 -2
- package/highlevel/methods/premium/get-resale-star-gifts.cjs +2 -2
- package/highlevel/methods/premium/get-resale-star-gifts.d.cts +1 -1
- package/highlevel/methods/premium/get-resale-star-gifts.d.ts +1 -1
- package/highlevel/methods/premium/get-resale-star-gifts.js +2 -2
- package/highlevel/methods/premium/get-saved-star-gifts.cjs +2 -1
- package/highlevel/methods/premium/get-saved-star-gifts.d.cts +4 -2
- package/highlevel/methods/premium/get-saved-star-gifts.d.ts +4 -2
- package/highlevel/methods/premium/get-saved-star-gifts.js +2 -1
- package/highlevel/methods/{auth/run.cjs → premium/get-star-gift-value.cjs} +8 -5
- package/highlevel/methods/premium/get-star-gift-value.d.cts +9 -0
- package/highlevel/methods/premium/get-star-gift-value.d.ts +9 -0
- package/highlevel/methods/premium/get-star-gift-value.js +11 -0
- package/highlevel/methods/premium/get-stars-transactions.cjs +3 -2
- package/highlevel/methods/premium/get-stars-transactions.d.cts +2 -0
- package/highlevel/methods/premium/get-stars-transactions.d.ts +2 -0
- package/highlevel/methods/premium/get-stars-transactions.js +3 -2
- package/highlevel/methods/premium/iter-saved-star-gifts.cjs +15 -10
- package/highlevel/methods/premium/iter-saved-star-gifts.d.cts +13 -19
- package/highlevel/methods/premium/iter-saved-star-gifts.d.ts +13 -19
- package/highlevel/methods/premium/iter-saved-star-gifts.js +15 -10
- package/highlevel/methods/premium/prepay-star-gift-upgrade.cjs +30 -0
- package/highlevel/methods/premium/prepay-star-gift-upgrade.d.cts +23 -0
- package/highlevel/methods/premium/prepay-star-gift-upgrade.d.ts +23 -0
- package/highlevel/methods/premium/prepay-star-gift-upgrade.js +25 -0
- package/highlevel/methods/stickers/delete-sticker-from-set.d.cts +2 -4
- package/highlevel/methods/stickers/delete-sticker-from-set.d.ts +2 -4
- package/highlevel/methods/stickers/move-sticker-in-set.d.cts +2 -4
- package/highlevel/methods/stickers/move-sticker-in-set.d.ts +2 -4
- package/highlevel/methods/stickers/replace-sticker-in-set.d.cts +2 -4
- package/highlevel/methods/stickers/replace-sticker-in-set.d.ts +2 -4
- package/highlevel/methods/users/get-saved-music.cjs +38 -0
- package/highlevel/methods/users/get-saved-music.d.cts +13 -0
- package/highlevel/methods/users/get-saved-music.d.ts +13 -0
- package/highlevel/methods/users/get-saved-music.js +33 -0
- package/highlevel/methods/users/save-music-to-profile.cjs +57 -0
- package/highlevel/methods/users/save-music-to-profile.d.cts +19 -0
- package/highlevel/methods/users/save-music-to-profile.d.ts +19 -0
- package/highlevel/methods/users/save-music-to-profile.js +52 -0
- package/highlevel/methods/users/set-emoji-status.cjs +0 -8
- package/highlevel/methods/users/set-emoji-status.d.cts +0 -11
- package/highlevel/methods/users/set-emoji-status.d.ts +0 -11
- package/highlevel/methods/users/set-emoji-status.js +1 -9
- package/highlevel/methods.d.cts +6 -4
- package/highlevel/methods.d.ts +6 -4
- package/highlevel/types/files/utils.d.cts +7 -0
- package/highlevel/types/files/utils.d.ts +7 -0
- package/highlevel/types/media/document.d.cts +1 -1
- package/highlevel/types/media/document.d.ts +1 -1
- package/highlevel/types/messages/message-action.cjs +43 -21
- package/highlevel/types/messages/message-action.d.cts +58 -17
- package/highlevel/types/messages/message-action.d.ts +58 -17
- package/highlevel/types/messages/message-action.js +43 -21
- package/highlevel/types/peers/chat.cjs +5 -1
- package/highlevel/types/peers/chat.d.cts +5 -1
- package/highlevel/types/peers/chat.d.ts +5 -1
- package/highlevel/types/peers/chat.js +5 -1
- package/highlevel/types/peers/full-chat.cjs +4 -0
- package/highlevel/types/peers/full-chat.d.cts +2 -0
- package/highlevel/types/peers/full-chat.d.ts +2 -0
- package/highlevel/types/peers/full-chat.js +4 -0
- package/highlevel/types/peers/full-user.cjs +10 -1
- package/highlevel/types/peers/full-user.d.cts +3 -0
- package/highlevel/types/peers/full-user.d.ts +3 -0
- package/highlevel/types/peers/full-user.js +10 -1
- package/highlevel/types/premium/index.d.cts +1 -0
- package/highlevel/types/premium/index.d.ts +1 -0
- package/highlevel/types/premium/saved-star-gift.cjs +6 -0
- package/highlevel/types/premium/saved-star-gift.d.cts +4 -0
- package/highlevel/types/premium/saved-star-gift.d.ts +4 -0
- package/highlevel/types/premium/saved-star-gift.js +6 -0
- package/highlevel/types/premium/star-gift-value.cjs +65 -0
- package/highlevel/types/premium/star-gift-value.d.cts +41 -0
- package/highlevel/types/premium/star-gift-value.d.ts +41 -0
- package/highlevel/types/premium/star-gift-value.js +60 -0
- package/highlevel/types/premium/stars-gift-unique.cjs +10 -3
- package/highlevel/types/premium/stars-gift-unique.d.cts +1 -1
- package/highlevel/types/premium/stars-gift-unique.d.ts +1 -1
- package/highlevel/types/premium/stars-gift-unique.js +10 -3
- package/highlevel/types/premium/stars-transaction.cjs +9 -0
- package/highlevel/types/premium/stars-transaction.d.cts +10 -0
- package/highlevel/types/premium/stars-transaction.d.ts +10 -0
- package/highlevel/types/premium/stars-transaction.js +9 -0
- package/index.cjs +2 -0
- package/index.js +2 -0
- package/methods.cjs +10 -5
- package/methods.js +13 -8
- package/network/mtproto-session.cjs +1 -0
- package/network/mtproto-session.d.cts +1 -0
- package/network/mtproto-session.d.ts +1 -0
- package/network/mtproto-session.js +1 -0
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/network/session-connection.cjs +27 -10
- package/network/session-connection.d.cts +1 -0
- package/network/session-connection.d.ts +1 -0
- package/network/session-connection.js +27 -10
- package/package.json +2 -2
- package/utils/binary/compat.cjs +35 -4
- package/utils/binary/compat.js +35 -4
- package/utils/binary/serialization.d.cts +3 -3
- package/utils/binary/serialization.d.ts +3 -3
- package/highlevel/methods/auth/run.d.cts +0 -16
- package/highlevel/methods/auth/run.d.ts +0 -16
- package/highlevel/methods/auth/run.js +0 -8
|
@@ -92,6 +92,9 @@ class StarsTransaction {
|
|
|
92
92
|
return { type: "unsupported" };
|
|
93
93
|
case "starsTransactionPeer": {
|
|
94
94
|
const peer$1 = peer.parsePeer(this.raw.peer.peer, this.peers);
|
|
95
|
+
if (this.raw.postsSearch) {
|
|
96
|
+
return { type: "paid_search" };
|
|
97
|
+
}
|
|
95
98
|
if (this.raw.giveawayPostId) {
|
|
96
99
|
return {
|
|
97
100
|
type: "giveaway",
|
|
@@ -132,6 +135,12 @@ class StarsTransaction {
|
|
|
132
135
|
peer: peer$1,
|
|
133
136
|
gift: new starsGiftUnique.StarGiftUnique(this.raw.stargift, this.peers)
|
|
134
137
|
};
|
|
138
|
+
} else if (this.raw.stargiftPrepaidUpgrade) {
|
|
139
|
+
return {
|
|
140
|
+
peer: peer$1,
|
|
141
|
+
gift: new starsGiftUnique.StarGiftUnique(this.raw.stargift, this.peers),
|
|
142
|
+
type: "star_gift_prepaid_upgrade"
|
|
143
|
+
};
|
|
135
144
|
} else {
|
|
136
145
|
return {
|
|
137
146
|
type: "star_gift_transfer",
|
|
@@ -28,6 +28,8 @@ import { StarGift } from './stars-gift.js';
|
|
|
28
28
|
* - `api_floodskip`: This transaction is a payment for a paid bot broadcast
|
|
29
29
|
* - `bot_referral`: This transaction is proceeds from a bot referral program
|
|
30
30
|
* - `ads_proceeds`: This transaction is proceeds from Telegram Ads
|
|
31
|
+
* - `paid_search`: This transaction is a payment for a paid search
|
|
32
|
+
* - `star_gift_prepaid_upgrade`: This transaction is for a star gift prepaid upgrade
|
|
31
33
|
*/
|
|
32
34
|
export type StarsTransactionType = {
|
|
33
35
|
type: 'unsupported';
|
|
@@ -164,6 +166,14 @@ export type StarsTransactionType = {
|
|
|
164
166
|
fromDate: Date;
|
|
165
167
|
/** End of the period */
|
|
166
168
|
toDate: Date;
|
|
169
|
+
} | {
|
|
170
|
+
type: 'paid_search';
|
|
171
|
+
} | {
|
|
172
|
+
type: 'star_gift_prepaid_upgrade';
|
|
173
|
+
/** Related peer */
|
|
174
|
+
peer: Peer;
|
|
175
|
+
/** The upgraded gift */
|
|
176
|
+
gift: StarGiftUnique;
|
|
167
177
|
};
|
|
168
178
|
export declare class StarsTransaction {
|
|
169
179
|
readonly raw: tl.RawStarsTransaction;
|
|
@@ -28,6 +28,8 @@ import { StarGift } from './stars-gift.js';
|
|
|
28
28
|
* - `api_floodskip`: This transaction is a payment for a paid bot broadcast
|
|
29
29
|
* - `bot_referral`: This transaction is proceeds from a bot referral program
|
|
30
30
|
* - `ads_proceeds`: This transaction is proceeds from Telegram Ads
|
|
31
|
+
* - `paid_search`: This transaction is a payment for a paid search
|
|
32
|
+
* - `star_gift_prepaid_upgrade`: This transaction is for a star gift prepaid upgrade
|
|
31
33
|
*/
|
|
32
34
|
export type StarsTransactionType = {
|
|
33
35
|
type: 'unsupported';
|
|
@@ -164,6 +166,14 @@ export type StarsTransactionType = {
|
|
|
164
166
|
fromDate: Date;
|
|
165
167
|
/** End of the period */
|
|
166
168
|
toDate: Date;
|
|
169
|
+
} | {
|
|
170
|
+
type: 'paid_search';
|
|
171
|
+
} | {
|
|
172
|
+
type: 'star_gift_prepaid_upgrade';
|
|
173
|
+
/** Related peer */
|
|
174
|
+
peer: Peer;
|
|
175
|
+
/** The upgraded gift */
|
|
176
|
+
gift: StarGiftUnique;
|
|
167
177
|
};
|
|
168
178
|
export declare class StarsTransaction {
|
|
169
179
|
readonly raw: tl.RawStarsTransaction;
|
|
@@ -85,6 +85,9 @@ class StarsTransaction {
|
|
|
85
85
|
return { type: "unsupported" };
|
|
86
86
|
case "starsTransactionPeer": {
|
|
87
87
|
const peer = parsePeer(this.raw.peer.peer, this.peers);
|
|
88
|
+
if (this.raw.postsSearch) {
|
|
89
|
+
return { type: "paid_search" };
|
|
90
|
+
}
|
|
88
91
|
if (this.raw.giveawayPostId) {
|
|
89
92
|
return {
|
|
90
93
|
type: "giveaway",
|
|
@@ -125,6 +128,12 @@ class StarsTransaction {
|
|
|
125
128
|
peer,
|
|
126
129
|
gift: new StarGiftUnique$2(this.raw.stargift, this.peers)
|
|
127
130
|
};
|
|
131
|
+
} else if (this.raw.stargiftPrepaidUpgrade) {
|
|
132
|
+
return {
|
|
133
|
+
peer,
|
|
134
|
+
gift: new StarGiftUnique$2(this.raw.stargift, this.peers),
|
|
135
|
+
type: "star_gift_prepaid_upgrade"
|
|
136
|
+
};
|
|
128
137
|
} else {
|
|
129
138
|
return {
|
|
130
139
|
type: "star_gift_transfer",
|
package/index.cjs
CHANGED
|
@@ -93,6 +93,7 @@ const businessIntro = require("./highlevel/types/premium/business-intro.cjs");
|
|
|
93
93
|
const businessLocation = require("./highlevel/types/premium/business-location.cjs");
|
|
94
94
|
const businessWorkHours = require("./highlevel/types/premium/business-work-hours.cjs");
|
|
95
95
|
const savedStarGift = require("./highlevel/types/premium/saved-star-gift.cjs");
|
|
96
|
+
const starGiftValue = require("./highlevel/types/premium/star-gift-value.cjs");
|
|
96
97
|
const starsGiftUnique = require("./highlevel/types/premium/stars-gift-unique.cjs");
|
|
97
98
|
const starsGift = require("./highlevel/types/premium/stars-gift.cjs");
|
|
98
99
|
const starsStatus = require("./highlevel/types/premium/stars-status.cjs");
|
|
@@ -269,6 +270,7 @@ exports.BusinessLocation = businessLocation.BusinessLocation;
|
|
|
269
270
|
exports.BusinessWorkHours = businessWorkHours.BusinessWorkHours;
|
|
270
271
|
exports.businessWorkHoursDaysToRaw = businessWorkHours.businessWorkHoursDaysToRaw;
|
|
271
272
|
exports.SavedStarGift = savedStarGift.SavedStarGift;
|
|
273
|
+
exports.StarGiftValue = starGiftValue.StarGiftValue;
|
|
272
274
|
exports.StarGiftUnique = starsGiftUnique.StarGiftUnique;
|
|
273
275
|
exports.StarGiftUniqueAttribute = starsGiftUnique.StarGiftUniqueAttribute;
|
|
274
276
|
exports.StarGiftUniqueBackdrop = starsGiftUnique.StarGiftUniqueBackdrop;
|
package/index.js
CHANGED
|
@@ -86,6 +86,7 @@ import { BusinessIntro } from "./highlevel/types/premium/business-intro.js";
|
|
|
86
86
|
import { BusinessLocation } from "./highlevel/types/premium/business-location.js";
|
|
87
87
|
import { BusinessWorkHours, businessWorkHoursDaysToRaw } from "./highlevel/types/premium/business-work-hours.js";
|
|
88
88
|
import { SavedStarGift } from "./highlevel/types/premium/saved-star-gift.js";
|
|
89
|
+
import { StarGiftValue } from "./highlevel/types/premium/star-gift-value.js";
|
|
89
90
|
import { StarGiftUnique, StarGiftUniqueAttribute, StarGiftUniqueBackdrop, StarGiftUniqueOriginalDetails } from "./highlevel/types/premium/stars-gift-unique.js";
|
|
90
91
|
import { StarGift } from "./highlevel/types/premium/stars-gift.js";
|
|
91
92
|
import { StarsStatus } from "./highlevel/types/premium/stars-status.js";
|
|
@@ -277,6 +278,7 @@ export {
|
|
|
277
278
|
StarGiftUniqueAttribute,
|
|
278
279
|
StarGiftUniqueBackdrop,
|
|
279
280
|
StarGiftUniqueOriginalDetails,
|
|
281
|
+
StarGiftValue,
|
|
280
282
|
StarsStatus,
|
|
281
283
|
StarsTransaction,
|
|
282
284
|
Sticker,
|
package/methods.cjs
CHANGED
|
@@ -10,7 +10,6 @@ const getPasswordHint = require("./highlevel/methods/auth/get-password-hint.cjs"
|
|
|
10
10
|
const logOut = require("./highlevel/methods/auth/log-out.cjs");
|
|
11
11
|
const recoverPassword = require("./highlevel/methods/auth/recover-password.cjs");
|
|
12
12
|
const resendCode = require("./highlevel/methods/auth/resend-code.cjs");
|
|
13
|
-
const run = require("./highlevel/methods/auth/run.cjs");
|
|
14
13
|
const sendCode = require("./highlevel/methods/auth/send-code.cjs");
|
|
15
14
|
const sendRecoveryCode = require("./highlevel/methods/auth/send-recovery-code.cjs");
|
|
16
15
|
const signInBot = require("./highlevel/methods/auth/sign-in-bot.cjs");
|
|
@@ -205,6 +204,7 @@ const getResaleStarGifts = require("./highlevel/methods/premium/get-resale-star-
|
|
|
205
204
|
const getSavedStarGiftsById = require("./highlevel/methods/premium/get-saved-star-gifts-by-id.cjs");
|
|
206
205
|
const getSavedStarGifts = require("./highlevel/methods/premium/get-saved-star-gifts.cjs");
|
|
207
206
|
const getStarGiftOptions = require("./highlevel/methods/premium/get-star-gift-options.cjs");
|
|
207
|
+
const getStarGiftValue = require("./highlevel/methods/premium/get-star-gift-value.cjs");
|
|
208
208
|
const getStarGiftWithdrawalUrl = require("./highlevel/methods/premium/get-star-gift-withdrawal-url.cjs");
|
|
209
209
|
const getStarsTransactions = require("./highlevel/methods/premium/get-stars-transactions.cjs");
|
|
210
210
|
const getUniqueStarGift = require("./highlevel/methods/premium/get-unique-star-gift.cjs");
|
|
@@ -212,6 +212,7 @@ const iterBoosters = require("./highlevel/methods/premium/iter-boosters.cjs");
|
|
|
212
212
|
const iterSavedStarGifts = require("./highlevel/methods/premium/iter-saved-star-gifts.cjs");
|
|
213
213
|
const iterStarsTransactions = require("./highlevel/methods/premium/iter-stars-transactions.cjs");
|
|
214
214
|
const pinStarGift = require("./highlevel/methods/premium/pin-star-gift.cjs");
|
|
215
|
+
const prepayStarGiftUpgrade = require("./highlevel/methods/premium/prepay-star-gift-upgrade.cjs");
|
|
215
216
|
const sendStarGift = require("./highlevel/methods/premium/send-star-gift.cjs");
|
|
216
217
|
const setBusinessIntro = require("./highlevel/methods/premium/set-business-intro.cjs");
|
|
217
218
|
const setBusinessWorkHours = require("./highlevel/methods/premium/set-business-work-hours.cjs");
|
|
@@ -259,12 +260,14 @@ const getMyUsername = require("./highlevel/methods/users/get-my-username.cjs");
|
|
|
259
260
|
const getPeerSettings = require("./highlevel/methods/users/get-peer-settings.cjs");
|
|
260
261
|
const getProfilePhoto = require("./highlevel/methods/users/get-profile-photo.cjs");
|
|
261
262
|
const getProfilePhotos = require("./highlevel/methods/users/get-profile-photos.cjs");
|
|
263
|
+
const getSavedMusic = require("./highlevel/methods/users/get-saved-music.cjs");
|
|
262
264
|
const getUsers = require("./highlevel/methods/users/get-users.cjs");
|
|
263
265
|
const isPeerAvailable = require("./highlevel/methods/users/is-peer-available.cjs");
|
|
264
266
|
const iterProfilePhotos = require("./highlevel/methods/users/iter-profile-photos.cjs");
|
|
265
267
|
const resolvePeerMany = require("./highlevel/methods/users/resolve-peer-many.cjs");
|
|
266
268
|
const resolvePeer = require("./highlevel/methods/users/resolve-peer.cjs");
|
|
267
269
|
const resolvePhoneNumber = require("./highlevel/methods/users/resolve-phone-number.cjs");
|
|
270
|
+
const saveMusicToProfile = require("./highlevel/methods/users/save-music-to-profile.cjs");
|
|
268
271
|
const setEmojiStatus = require("./highlevel/methods/users/set-emoji-status.cjs");
|
|
269
272
|
const setGlobalTtl = require("./highlevel/methods/users/set-global-ttl.cjs");
|
|
270
273
|
const setMyBirthday = require("./highlevel/methods/users/set-my-birthday.cjs");
|
|
@@ -278,7 +281,6 @@ exports.getPasswordHint = getPasswordHint.getPasswordHint;
|
|
|
278
281
|
exports.logOut = logOut.logOut;
|
|
279
282
|
exports.recoverPassword = recoverPassword.recoverPassword;
|
|
280
283
|
exports.resendCode = resendCode.resendCode;
|
|
281
|
-
exports.run = run.run;
|
|
282
284
|
exports.sendCode = sendCode.sendCode;
|
|
283
285
|
exports.sendRecoveryCode = sendRecoveryCode.sendRecoveryCode;
|
|
284
286
|
exports.signInBot = signInBot.signInBot;
|
|
@@ -387,7 +389,6 @@ exports.iterForumTopics = iterForumTopics.iterForumTopics;
|
|
|
387
389
|
exports.reorderPinnedForumTopics = reorderPinnedForumTopics.reorderPinnedForumTopics;
|
|
388
390
|
exports.toggleForumTopicClosed = toggleForumTopicClosed.toggleForumTopicClosed;
|
|
389
391
|
exports.toggleForumTopicPinned = toggleForumTopicPinned.toggleForumTopicPinned;
|
|
390
|
-
exports.toggleForum = toggleForum.toggleForum;
|
|
391
392
|
exports.updateForumSettings = toggleForum.updateForumSettings;
|
|
392
393
|
exports.toggleGeneralTopicHidden = toggleGeneralTopicHidden.toggleGeneralTopicHidden;
|
|
393
394
|
exports.createInviteLink = createInviteLink.createInviteLink;
|
|
@@ -489,10 +490,11 @@ exports.getBoosts = getBoosts.getBoosts;
|
|
|
489
490
|
exports.getBusinessChatLinks = getBusinessChatLinks.getBusinessChatLinks;
|
|
490
491
|
exports.getBusinessConnection = getBusinessConnection.getBusinessConnection;
|
|
491
492
|
exports.getMyBoostSlots = getMyBoostSlots.getMyBoostSlots;
|
|
492
|
-
exports.
|
|
493
|
+
exports.getStarGiftResaleOptions = getResaleStarGifts.getStarGiftResaleOptions;
|
|
493
494
|
exports.getSavedStarGiftsById = getSavedStarGiftsById.getSavedStarGiftsById;
|
|
494
495
|
exports.getSavedStarGifts = getSavedStarGifts.getSavedStarGifts;
|
|
495
496
|
exports.getStarGiftOptions = getStarGiftOptions.getStarGiftOptions;
|
|
497
|
+
exports.getStarGiftValue = getStarGiftValue.getStarGiftValue;
|
|
496
498
|
exports.getStarGiftWithdrawalUrl = getStarGiftWithdrawalUrl.getStarGiftWithdrawalUrl;
|
|
497
499
|
exports.getStarsTransactions = getStarsTransactions.getStarsTransactions;
|
|
498
500
|
exports.getUniqueStarGift = getUniqueStarGift.getUniqueStarGift;
|
|
@@ -500,6 +502,7 @@ exports.iterBoosters = iterBoosters.iterBoosters;
|
|
|
500
502
|
exports.iterSavedStarGifts = iterSavedStarGifts.iterSavedStarGifts;
|
|
501
503
|
exports.iterStarsTransactions = iterStarsTransactions.iterStarsTransactions;
|
|
502
504
|
exports.togglePinnedStarGifts = pinStarGift.togglePinnedStarGifts;
|
|
505
|
+
exports.prepayStarGiftUpgrade = prepayStarGiftUpgrade.prepayStarGiftUpgrade;
|
|
503
506
|
exports.sendStarGift = sendStarGift.sendStarGift;
|
|
504
507
|
exports.setBusinessIntro = setBusinessIntro.setBusinessIntro;
|
|
505
508
|
exports.setBusinessWorkHours = setBusinessWorkHours.setBusinessWorkHours;
|
|
@@ -549,6 +552,7 @@ exports.getMyUsername = getMyUsername.getMyUsername;
|
|
|
549
552
|
exports.getPeerSettings = getPeerSettings.getPeerSettings;
|
|
550
553
|
exports.getProfilePhoto = getProfilePhoto.getProfilePhoto;
|
|
551
554
|
exports.getProfilePhotos = getProfilePhotos.getProfilePhotos;
|
|
555
|
+
exports.getSavedMusic = getSavedMusic.getSavedMusic;
|
|
552
556
|
exports.getUsers = getUsers.getUsers;
|
|
553
557
|
exports.isPeerAvailable = isPeerAvailable.isPeerAvailable;
|
|
554
558
|
exports.iterProfilePhotos = iterProfilePhotos.iterProfilePhotos;
|
|
@@ -557,8 +561,9 @@ exports.resolveChannel = resolvePeer.resolveChannel;
|
|
|
557
561
|
exports.resolvePeer = resolvePeer.resolvePeer;
|
|
558
562
|
exports.resolveUser = resolvePeer.resolveUser;
|
|
559
563
|
exports.resolvePhoneNumber = resolvePhoneNumber.resolvePhoneNumber;
|
|
564
|
+
exports.saveMusicToProfile = saveMusicToProfile.saveMusicToProfile;
|
|
565
|
+
exports.unsaveMusicFromProfile = saveMusicToProfile.unsaveMusicFromProfile;
|
|
560
566
|
exports.setEmojiStatus = setEmojiStatus.setEmojiStatus;
|
|
561
|
-
exports.setMyEmojiStatus = setEmojiStatus.setMyEmojiStatus;
|
|
562
567
|
exports.setGlobalTtl = setGlobalTtl.setGlobalTtl;
|
|
563
568
|
exports.setMyBirthday = setMyBirthday.setMyBirthday;
|
|
564
569
|
exports.setMyProfilePhoto = setMyProfilePhoto.setMyProfilePhoto;
|
package/methods.js
CHANGED
|
@@ -3,7 +3,6 @@ import { getPasswordHint } from "./highlevel/methods/auth/get-password-hint.js";
|
|
|
3
3
|
import { logOut } from "./highlevel/methods/auth/log-out.js";
|
|
4
4
|
import { recoverPassword } from "./highlevel/methods/auth/recover-password.js";
|
|
5
5
|
import { resendCode } from "./highlevel/methods/auth/resend-code.js";
|
|
6
|
-
import { run } from "./highlevel/methods/auth/run.js";
|
|
7
6
|
import { sendCode } from "./highlevel/methods/auth/send-code.js";
|
|
8
7
|
import { sendRecoveryCode } from "./highlevel/methods/auth/send-recovery-code.js";
|
|
9
8
|
import { signInBot } from "./highlevel/methods/auth/sign-in-bot.js";
|
|
@@ -108,7 +107,7 @@ import { iterForumTopics } from "./highlevel/methods/forums/iter-forum-topics.js
|
|
|
108
107
|
import { reorderPinnedForumTopics } from "./highlevel/methods/forums/reorder-pinned-forum-topics.js";
|
|
109
108
|
import { toggleForumTopicClosed } from "./highlevel/methods/forums/toggle-forum-topic-closed.js";
|
|
110
109
|
import { toggleForumTopicPinned } from "./highlevel/methods/forums/toggle-forum-topic-pinned.js";
|
|
111
|
-
import {
|
|
110
|
+
import { updateForumSettings } from "./highlevel/methods/forums/toggle-forum.js";
|
|
112
111
|
import { toggleGeneralTopicHidden } from "./highlevel/methods/forums/toggle-general-topic-hidden.js";
|
|
113
112
|
import { createInviteLink } from "./highlevel/methods/invite-links/create-invite-link.js";
|
|
114
113
|
import { editInviteLink } from "./highlevel/methods/invite-links/edit-invite-link.js";
|
|
@@ -194,10 +193,11 @@ import { getBoosts } from "./highlevel/methods/premium/get-boosts.js";
|
|
|
194
193
|
import { getBusinessChatLinks } from "./highlevel/methods/premium/get-business-chat-links.js";
|
|
195
194
|
import { getBusinessConnection } from "./highlevel/methods/premium/get-business-connection.js";
|
|
196
195
|
import { getMyBoostSlots } from "./highlevel/methods/premium/get-my-boost-slots.js";
|
|
197
|
-
import {
|
|
196
|
+
import { getStarGiftResaleOptions } from "./highlevel/methods/premium/get-resale-star-gifts.js";
|
|
198
197
|
import { getSavedStarGiftsById } from "./highlevel/methods/premium/get-saved-star-gifts-by-id.js";
|
|
199
198
|
import { getSavedStarGifts } from "./highlevel/methods/premium/get-saved-star-gifts.js";
|
|
200
199
|
import { getStarGiftOptions } from "./highlevel/methods/premium/get-star-gift-options.js";
|
|
200
|
+
import { getStarGiftValue } from "./highlevel/methods/premium/get-star-gift-value.js";
|
|
201
201
|
import { getStarGiftWithdrawalUrl } from "./highlevel/methods/premium/get-star-gift-withdrawal-url.js";
|
|
202
202
|
import { getStarsTransactions } from "./highlevel/methods/premium/get-stars-transactions.js";
|
|
203
203
|
import { getUniqueStarGift } from "./highlevel/methods/premium/get-unique-star-gift.js";
|
|
@@ -205,6 +205,7 @@ import { iterBoosters } from "./highlevel/methods/premium/iter-boosters.js";
|
|
|
205
205
|
import { iterSavedStarGifts } from "./highlevel/methods/premium/iter-saved-star-gifts.js";
|
|
206
206
|
import { iterStarsTransactions } from "./highlevel/methods/premium/iter-stars-transactions.js";
|
|
207
207
|
import { togglePinnedStarGifts } from "./highlevel/methods/premium/pin-star-gift.js";
|
|
208
|
+
import { prepayStarGiftUpgrade } from "./highlevel/methods/premium/prepay-star-gift-upgrade.js";
|
|
208
209
|
import { sendStarGift } from "./highlevel/methods/premium/send-star-gift.js";
|
|
209
210
|
import { setBusinessIntro } from "./highlevel/methods/premium/set-business-intro.js";
|
|
210
211
|
import { setBusinessWorkHours } from "./highlevel/methods/premium/set-business-work-hours.js";
|
|
@@ -252,13 +253,15 @@ import { getMyUsername } from "./highlevel/methods/users/get-my-username.js";
|
|
|
252
253
|
import { getPeerSettings } from "./highlevel/methods/users/get-peer-settings.js";
|
|
253
254
|
import { getProfilePhoto } from "./highlevel/methods/users/get-profile-photo.js";
|
|
254
255
|
import { getProfilePhotos } from "./highlevel/methods/users/get-profile-photos.js";
|
|
256
|
+
import { getSavedMusic } from "./highlevel/methods/users/get-saved-music.js";
|
|
255
257
|
import { getUsers } from "./highlevel/methods/users/get-users.js";
|
|
256
258
|
import { isPeerAvailable } from "./highlevel/methods/users/is-peer-available.js";
|
|
257
259
|
import { iterProfilePhotos } from "./highlevel/methods/users/iter-profile-photos.js";
|
|
258
260
|
import { resolvePeerMany } from "./highlevel/methods/users/resolve-peer-many.js";
|
|
259
261
|
import { resolveChannel, resolvePeer, resolveUser } from "./highlevel/methods/users/resolve-peer.js";
|
|
260
262
|
import { resolvePhoneNumber } from "./highlevel/methods/users/resolve-phone-number.js";
|
|
261
|
-
import {
|
|
263
|
+
import { saveMusicToProfile, unsaveMusicFromProfile } from "./highlevel/methods/users/save-music-to-profile.js";
|
|
264
|
+
import { setEmojiStatus } from "./highlevel/methods/users/set-emoji-status.js";
|
|
262
265
|
import { setGlobalTtl } from "./highlevel/methods/users/set-global-ttl.js";
|
|
263
266
|
import { setMyBirthday } from "./highlevel/methods/users/set-my-birthday.js";
|
|
264
267
|
import { setMyProfilePhoto } from "./highlevel/methods/users/set-my-profile-photo.js";
|
|
@@ -402,12 +405,14 @@ export {
|
|
|
402
405
|
getProfileStories,
|
|
403
406
|
getReactionUsers,
|
|
404
407
|
getReplyTo,
|
|
405
|
-
|
|
408
|
+
getSavedMusic,
|
|
406
409
|
getSavedStarGifts,
|
|
407
410
|
getSavedStarGiftsById,
|
|
408
411
|
getScheduledMessages,
|
|
409
412
|
getSimilarChannels,
|
|
410
413
|
getStarGiftOptions,
|
|
414
|
+
getStarGiftResaleOptions,
|
|
415
|
+
getStarGiftValue,
|
|
411
416
|
getStarGiftWithdrawalUrl,
|
|
412
417
|
getStarsTransactions,
|
|
413
418
|
getStickerSet,
|
|
@@ -456,6 +461,7 @@ export {
|
|
|
456
461
|
openWebview,
|
|
457
462
|
pinMessage,
|
|
458
463
|
prepareInlineMessage,
|
|
464
|
+
prepayStarGiftUpgrade,
|
|
459
465
|
quoteWithMedia,
|
|
460
466
|
quoteWithMediaGroup,
|
|
461
467
|
quoteWithText,
|
|
@@ -479,8 +485,8 @@ export {
|
|
|
479
485
|
resolveUser,
|
|
480
486
|
restrictChatMember,
|
|
481
487
|
revokeInviteLink,
|
|
482
|
-
run,
|
|
483
488
|
saveDraft,
|
|
489
|
+
saveMusicToProfile,
|
|
484
490
|
searchGlobal,
|
|
485
491
|
searchHashtag,
|
|
486
492
|
searchMessages,
|
|
@@ -521,7 +527,6 @@ export {
|
|
|
521
527
|
setMyBirthday,
|
|
522
528
|
setMyCommands,
|
|
523
529
|
setMyDefaultRights,
|
|
524
|
-
setMyEmojiStatus,
|
|
525
530
|
setMyProfilePhoto,
|
|
526
531
|
setMyUsername,
|
|
527
532
|
setOnline,
|
|
@@ -536,7 +541,6 @@ export {
|
|
|
536
541
|
startTest,
|
|
537
542
|
toggleContentProtection,
|
|
538
543
|
toggleEmojiStatusPermission,
|
|
539
|
-
toggleForum,
|
|
540
544
|
toggleForumTopicClosed,
|
|
541
545
|
toggleForumTopicPinned,
|
|
542
546
|
toggleFragmentUsername,
|
|
@@ -555,6 +559,7 @@ export {
|
|
|
555
559
|
unblockUser,
|
|
556
560
|
unpinAllMessages,
|
|
557
561
|
unpinMessage,
|
|
562
|
+
unsaveMusicFromProfile,
|
|
558
563
|
updateForumSettings,
|
|
559
564
|
updateProfile,
|
|
560
565
|
upgradeStarGift,
|
|
@@ -43,6 +43,7 @@ class MtprotoSession {
|
|
|
43
43
|
queuedResendReq = [];
|
|
44
44
|
queuedCancelReq = [];
|
|
45
45
|
getStateSchedule = new sortedArray.SortedArray([], (a, b) => a.getState - b.getState);
|
|
46
|
+
pendingGetStateTimeouts = new longUtils.LongMap();
|
|
46
47
|
chains = /* @__PURE__ */ new Map();
|
|
47
48
|
chainsPendingFails = /* @__PURE__ */ new Map();
|
|
48
49
|
// requests info
|
|
@@ -83,6 +83,7 @@ export declare class MtprotoSession {
|
|
|
83
83
|
queuedResendReq: Long[];
|
|
84
84
|
queuedCancelReq: Long[];
|
|
85
85
|
getStateSchedule: SortedArray<PendingRpc>;
|
|
86
|
+
pendingGetStateTimeouts: LongMap<timers.Timer>;
|
|
86
87
|
chains: Map<string | number, Long>;
|
|
87
88
|
chainsPendingFails: Map<string | number, SortedArray<PendingRpc>>;
|
|
88
89
|
pendingMessages: LongMap<PendingMessage>;
|
|
@@ -83,6 +83,7 @@ export declare class MtprotoSession {
|
|
|
83
83
|
queuedResendReq: Long[];
|
|
84
84
|
queuedCancelReq: Long[];
|
|
85
85
|
getStateSchedule: SortedArray<PendingRpc>;
|
|
86
|
+
pendingGetStateTimeouts: LongMap<timers.Timer>;
|
|
86
87
|
chains: Map<string | number, Long>;
|
|
87
88
|
chainsPendingFails: Map<string | number, SortedArray<PendingRpc>>;
|
|
88
89
|
pendingMessages: LongMap<PendingMessage>;
|
|
@@ -36,6 +36,7 @@ class MtprotoSession {
|
|
|
36
36
|
queuedResendReq = [];
|
|
37
37
|
queuedCancelReq = [];
|
|
38
38
|
getStateSchedule = new SortedArray([], (a, b) => a.getState - b.getState);
|
|
39
|
+
pendingGetStateTimeouts = new LongMap();
|
|
39
40
|
chains = /* @__PURE__ */ new Map();
|
|
40
41
|
chainsPendingFails = /* @__PURE__ */ new Map();
|
|
41
42
|
// requests info
|
|
@@ -19,6 +19,7 @@ const abstract = require("./transports/abstract.cjs");
|
|
|
19
19
|
const errors = require("../types/errors.cjs");
|
|
20
20
|
const TEMP_AUTH_KEY_EXPIRY = 86400;
|
|
21
21
|
const GET_STATE_INTERVAL = 1500;
|
|
22
|
+
const GET_STATE_TIMEOUT = 2e3;
|
|
22
23
|
const GZIP_PACKED_ID = 812830625;
|
|
23
24
|
const MSG_CONTAINER_ID = 1945237724;
|
|
24
25
|
const RPC_RESULT_ID = 4082920705;
|
|
@@ -95,11 +96,8 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
95
96
|
prom.reject(new errors.MtcuteError("Connection closed"));
|
|
96
97
|
utils.timers.clearTimeout(timeout);
|
|
97
98
|
});
|
|
98
|
-
for (const msgId of this._session.
|
|
99
|
-
|
|
100
|
-
if (pending._ === "state") {
|
|
101
|
-
this._onMessageFailed(msgId, "connection loss", true);
|
|
102
|
-
}
|
|
99
|
+
for (const msgId of this._session.pendingGetStateTimeouts.keys()) {
|
|
100
|
+
this._onMessageFailed(msgId, "connection loss", true);
|
|
103
101
|
}
|
|
104
102
|
this.onDisconnect.emit();
|
|
105
103
|
this.reset();
|
|
@@ -113,6 +111,10 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
113
111
|
this._flushTimer.reset();
|
|
114
112
|
this._salts.isFetching = false;
|
|
115
113
|
this._session.resetLastPing(true);
|
|
114
|
+
for (const timeout of this._session.pendingGetStateTimeouts.values()) {
|
|
115
|
+
utils.timers.clearTimeout(timeout);
|
|
116
|
+
}
|
|
117
|
+
this._session.pendingGetStateTimeouts.clear();
|
|
116
118
|
if (forever) {
|
|
117
119
|
utils.timers.clearTimeout(this._pfsUpdateTimeout);
|
|
118
120
|
this.onDisconnect.clear();
|
|
@@ -734,16 +736,22 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
734
736
|
this._session.queuedResendReq.splice(0, 0, ...msgInfo.msgIds);
|
|
735
737
|
this._flushTimer.emitWhenIdle();
|
|
736
738
|
break;
|
|
737
|
-
case "state":
|
|
739
|
+
case "state": {
|
|
738
740
|
this.log.debug(
|
|
739
741
|
"state request %l (size = %d) failed because of %s",
|
|
740
742
|
msgId,
|
|
741
743
|
msgInfo.msgIds.length,
|
|
742
744
|
reason
|
|
743
745
|
);
|
|
746
|
+
const timer = this._session.pendingGetStateTimeouts.get(msgId);
|
|
747
|
+
if (timer) {
|
|
748
|
+
utils.timers.clearTimeout(timer);
|
|
749
|
+
this._session.pendingGetStateTimeouts.delete(msgId);
|
|
750
|
+
}
|
|
744
751
|
this._session.queuedStateReq.splice(0, 0, ...msgInfo.msgIds);
|
|
745
752
|
this._flushTimer.emitWhenIdle();
|
|
746
753
|
break;
|
|
754
|
+
}
|
|
747
755
|
case "bind":
|
|
748
756
|
this.log.debug("temp key binding request %l failed because of %s, retrying", msgId, reason);
|
|
749
757
|
msgInfo.promise.reject(new Error(reason));
|
|
@@ -900,6 +908,7 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
900
908
|
return;
|
|
901
909
|
}
|
|
902
910
|
this._session.pendingMessages.delete(msg.reqMsgId);
|
|
911
|
+
this._session.pendingGetStateTimeouts.delete(msg.reqMsgId);
|
|
903
912
|
this._onMessagesInfo(info.msgIds, msg.info);
|
|
904
913
|
}
|
|
905
914
|
_onFutureSalts(msg) {
|
|
@@ -1094,6 +1103,14 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
1094
1103
|
flushWhenIdle() {
|
|
1095
1104
|
this._flushTimer.emitWhenIdle();
|
|
1096
1105
|
}
|
|
1106
|
+
_handleGetStateTimeout = (msgId) => {
|
|
1107
|
+
const pending = this._session.pendingGetStateTimeouts.get(msgId);
|
|
1108
|
+
if (!pending) {
|
|
1109
|
+
this.log.warn("get_state timed out for unknown msg_id %l", msgId);
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
this._onMessageFailed(msgId, "timeout");
|
|
1113
|
+
};
|
|
1097
1114
|
_flush() {
|
|
1098
1115
|
if (this._disconnectedManually || !this._session._authKey.ready || this._isPfsBindingPending || this._session.current429Timeout) {
|
|
1099
1116
|
this.log.debug(
|
|
@@ -1295,6 +1312,8 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
1295
1312
|
};
|
|
1296
1313
|
this._session.pendingMessages.set(getStateMsgId, getStatePending);
|
|
1297
1314
|
otherPendings.push(getStatePending);
|
|
1315
|
+
const timeout = utils.timers.setTimeout(this._handleGetStateTimeout, GET_STATE_TIMEOUT, getStateMsgId);
|
|
1316
|
+
this._session.pendingGetStateTimeouts.set(getStateMsgId, timeout);
|
|
1298
1317
|
}
|
|
1299
1318
|
if (resendRequest) {
|
|
1300
1319
|
resendMsgId = this._registerOutgoingMsgId(this._session.writeMessage(writer, resendRequest));
|
|
@@ -1373,10 +1392,8 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
1373
1392
|
if (msg.getState) {
|
|
1374
1393
|
this._session.getStateSchedule.remove(msg);
|
|
1375
1394
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
this._session.getStateSchedule.insert(msg);
|
|
1379
|
-
}
|
|
1395
|
+
msg.getState = getStateTime;
|
|
1396
|
+
this._session.getStateSchedule.insert(msg);
|
|
1380
1397
|
if (rootMsgId === null) rootMsgId = msg.msgId;
|
|
1381
1398
|
writer.long(this._registerOutgoingMsgId(msg.msgId));
|
|
1382
1399
|
writer.uint(msg.seqNo);
|
|
@@ -12,6 +12,7 @@ import { TransportError } from "./transports/abstract.js";
|
|
|
12
12
|
import { MtcuteError, MtTimeoutError, MtArgumentError } from "../types/errors.js";
|
|
13
13
|
const TEMP_AUTH_KEY_EXPIRY = 86400;
|
|
14
14
|
const GET_STATE_INTERVAL = 1500;
|
|
15
|
+
const GET_STATE_TIMEOUT = 2e3;
|
|
15
16
|
const GZIP_PACKED_ID = 812830625;
|
|
16
17
|
const MSG_CONTAINER_ID = 1945237724;
|
|
17
18
|
const RPC_RESULT_ID = 4082920705;
|
|
@@ -88,11 +89,8 @@ class SessionConnection extends PersistentConnection {
|
|
|
88
89
|
prom.reject(new MtcuteError("Connection closed"));
|
|
89
90
|
timers.clearTimeout(timeout);
|
|
90
91
|
});
|
|
91
|
-
for (const msgId of this._session.
|
|
92
|
-
|
|
93
|
-
if (pending._ === "state") {
|
|
94
|
-
this._onMessageFailed(msgId, "connection loss", true);
|
|
95
|
-
}
|
|
92
|
+
for (const msgId of this._session.pendingGetStateTimeouts.keys()) {
|
|
93
|
+
this._onMessageFailed(msgId, "connection loss", true);
|
|
96
94
|
}
|
|
97
95
|
this.onDisconnect.emit();
|
|
98
96
|
this.reset();
|
|
@@ -106,6 +104,10 @@ class SessionConnection extends PersistentConnection {
|
|
|
106
104
|
this._flushTimer.reset();
|
|
107
105
|
this._salts.isFetching = false;
|
|
108
106
|
this._session.resetLastPing(true);
|
|
107
|
+
for (const timeout of this._session.pendingGetStateTimeouts.values()) {
|
|
108
|
+
timers.clearTimeout(timeout);
|
|
109
|
+
}
|
|
110
|
+
this._session.pendingGetStateTimeouts.clear();
|
|
109
111
|
if (forever) {
|
|
110
112
|
timers.clearTimeout(this._pfsUpdateTimeout);
|
|
111
113
|
this.onDisconnect.clear();
|
|
@@ -727,16 +729,22 @@ class SessionConnection extends PersistentConnection {
|
|
|
727
729
|
this._session.queuedResendReq.splice(0, 0, ...msgInfo.msgIds);
|
|
728
730
|
this._flushTimer.emitWhenIdle();
|
|
729
731
|
break;
|
|
730
|
-
case "state":
|
|
732
|
+
case "state": {
|
|
731
733
|
this.log.debug(
|
|
732
734
|
"state request %l (size = %d) failed because of %s",
|
|
733
735
|
msgId,
|
|
734
736
|
msgInfo.msgIds.length,
|
|
735
737
|
reason
|
|
736
738
|
);
|
|
739
|
+
const timer = this._session.pendingGetStateTimeouts.get(msgId);
|
|
740
|
+
if (timer) {
|
|
741
|
+
timers.clearTimeout(timer);
|
|
742
|
+
this._session.pendingGetStateTimeouts.delete(msgId);
|
|
743
|
+
}
|
|
737
744
|
this._session.queuedStateReq.splice(0, 0, ...msgInfo.msgIds);
|
|
738
745
|
this._flushTimer.emitWhenIdle();
|
|
739
746
|
break;
|
|
747
|
+
}
|
|
740
748
|
case "bind":
|
|
741
749
|
this.log.debug("temp key binding request %l failed because of %s, retrying", msgId, reason);
|
|
742
750
|
msgInfo.promise.reject(new Error(reason));
|
|
@@ -893,6 +901,7 @@ class SessionConnection extends PersistentConnection {
|
|
|
893
901
|
return;
|
|
894
902
|
}
|
|
895
903
|
this._session.pendingMessages.delete(msg.reqMsgId);
|
|
904
|
+
this._session.pendingGetStateTimeouts.delete(msg.reqMsgId);
|
|
896
905
|
this._onMessagesInfo(info.msgIds, msg.info);
|
|
897
906
|
}
|
|
898
907
|
_onFutureSalts(msg) {
|
|
@@ -1087,6 +1096,14 @@ class SessionConnection extends PersistentConnection {
|
|
|
1087
1096
|
flushWhenIdle() {
|
|
1088
1097
|
this._flushTimer.emitWhenIdle();
|
|
1089
1098
|
}
|
|
1099
|
+
_handleGetStateTimeout = (msgId) => {
|
|
1100
|
+
const pending = this._session.pendingGetStateTimeouts.get(msgId);
|
|
1101
|
+
if (!pending) {
|
|
1102
|
+
this.log.warn("get_state timed out for unknown msg_id %l", msgId);
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
this._onMessageFailed(msgId, "timeout");
|
|
1106
|
+
};
|
|
1090
1107
|
_flush() {
|
|
1091
1108
|
if (this._disconnectedManually || !this._session._authKey.ready || this._isPfsBindingPending || this._session.current429Timeout) {
|
|
1092
1109
|
this.log.debug(
|
|
@@ -1288,6 +1305,8 @@ class SessionConnection extends PersistentConnection {
|
|
|
1288
1305
|
};
|
|
1289
1306
|
this._session.pendingMessages.set(getStateMsgId, getStatePending);
|
|
1290
1307
|
otherPendings.push(getStatePending);
|
|
1308
|
+
const timeout = timers.setTimeout(this._handleGetStateTimeout, GET_STATE_TIMEOUT, getStateMsgId);
|
|
1309
|
+
this._session.pendingGetStateTimeouts.set(getStateMsgId, timeout);
|
|
1291
1310
|
}
|
|
1292
1311
|
if (resendRequest) {
|
|
1293
1312
|
resendMsgId = this._registerOutgoingMsgId(this._session.writeMessage(writer, resendRequest));
|
|
@@ -1366,10 +1385,8 @@ class SessionConnection extends PersistentConnection {
|
|
|
1366
1385
|
if (msg.getState) {
|
|
1367
1386
|
this._session.getStateSchedule.remove(msg);
|
|
1368
1387
|
}
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
this._session.getStateSchedule.insert(msg);
|
|
1372
|
-
}
|
|
1388
|
+
msg.getState = getStateTime;
|
|
1389
|
+
this._session.getStateSchedule.insert(msg);
|
|
1373
1390
|
if (rootMsgId === null) rootMsgId = msg.msgId;
|
|
1374
1391
|
writer.long(this._registerOutgoingMsgId(msg.msgId));
|
|
1375
1392
|
writer.uint(msg.seqNo);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtcute/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.26.0",
|
|
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": "^214.0.0",
|
|
14
14
|
"@mtcute/tl-runtime": "^0.24.3",
|
|
15
15
|
"@types/events": "3.0.0",
|
|
16
16
|
"long": "5.2.3"
|