@mtcute/core 0.26.1 → 0.26.3
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/highlevel/client.d.cts +3 -3
- package/highlevel/client.d.ts +3 -3
- package/highlevel/methods/chats/set-chat-color.cjs +5 -2
- package/highlevel/methods/chats/set-chat-color.d.cts +0 -2
- package/highlevel/methods/chats/set-chat-color.d.ts +0 -2
- package/highlevel/methods/chats/set-chat-color.js +5 -2
- package/highlevel/methods/contacts/add-contact.cjs +4 -2
- package/highlevel/methods/contacts/add-contact.d.cts +5 -1
- package/highlevel/methods/contacts/add-contact.d.ts +5 -1
- package/highlevel/methods/contacts/add-contact.js +4 -2
- package/highlevel/methods/contacts/set-contact-note.d.cts +9 -0
- package/highlevel/methods/contacts/set-contact-note.d.ts +9 -0
- package/highlevel/methods/forums/create-forum-topic.cjs +2 -2
- package/highlevel/methods/forums/create-forum-topic.js +3 -3
- package/highlevel/methods/forums/delete-forum-topic-history.cjs +9 -6
- package/highlevel/methods/forums/delete-forum-topic-history.js +10 -7
- package/highlevel/methods/forums/edit-forum-topic.cjs +6 -4
- package/highlevel/methods/forums/edit-forum-topic.d.cts +4 -0
- package/highlevel/methods/forums/edit-forum-topic.d.ts +4 -0
- package/highlevel/methods/forums/edit-forum-topic.js +7 -5
- package/highlevel/methods/forums/get-forum-topics-by-id.cjs +2 -2
- package/highlevel/methods/forums/get-forum-topics-by-id.js +3 -3
- package/highlevel/methods/forums/get-forum-topics.cjs +2 -2
- package/highlevel/methods/forums/get-forum-topics.js +3 -3
- package/highlevel/methods/forums/iter-forum-topics.cjs +1 -1
- package/highlevel/methods/forums/iter-forum-topics.js +2 -2
- package/highlevel/methods/messages/append-todo-list.cjs +1 -1
- package/highlevel/methods/messages/append-todo-list.js +1 -1
- package/highlevel/methods/messages/get-messages-unsafe.d.cts +1 -1
- package/highlevel/methods/messages/get-messages-unsafe.d.ts +1 -1
- package/highlevel/methods/messages/get-messages.d.cts +1 -1
- package/highlevel/methods/messages/get-messages.d.ts +1 -1
- package/highlevel/methods/messages/get-scheduled-messages.d.cts +1 -1
- package/highlevel/methods/messages/get-scheduled-messages.d.ts +1 -1
- package/highlevel/methods/misc/with-params.cjs +18 -12
- package/highlevel/methods/misc/with-params.js +18 -12
- package/highlevel/methods/premium/get-saved-star-gifts.cjs +1 -0
- package/highlevel/methods/premium/get-saved-star-gifts.d.cts +4 -0
- package/highlevel/methods/premium/get-saved-star-gifts.d.ts +4 -0
- package/highlevel/methods/premium/get-saved-star-gifts.js +1 -0
- package/highlevel/methods/users/set-emoji-status.cjs +2 -7
- package/highlevel/methods/users/set-emoji-status.js +2 -7
- package/highlevel/types/messages/message-action.cjs +15 -2
- package/highlevel/types/messages/message-action.d.cts +14 -1
- package/highlevel/types/messages/message-action.d.ts +14 -1
- package/highlevel/types/messages/message-action.js +15 -2
- package/highlevel/types/peers/chat-event/actions.cjs +1 -0
- package/highlevel/types/peers/chat-event/actions.js +1 -0
- package/highlevel/types/peers/chat.cjs +8 -2
- package/highlevel/types/peers/chat.js +8 -2
- package/highlevel/types/peers/forum-topic.cjs +10 -0
- package/highlevel/types/peers/forum-topic.d.cts +5 -0
- package/highlevel/types/peers/forum-topic.d.ts +5 -0
- package/highlevel/types/peers/forum-topic.js +10 -0
- package/highlevel/types/peers/full-user.cjs +4 -0
- 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 +4 -0
- package/highlevel/types/peers/user.cjs +12 -2
- package/highlevel/types/peers/user.d.cts +2 -0
- package/highlevel/types/peers/user.d.ts +2 -0
- package/highlevel/types/peers/user.js +12 -2
- 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 +24 -0
- package/highlevel/types/premium/stars-gift-unique.d.cts +14 -0
- package/highlevel/types/premium/stars-gift-unique.d.ts +14 -0
- package/highlevel/types/premium/stars-gift-unique.js +24 -0
- package/highlevel/types/premium/stars-gift.cjs +4 -0
- package/highlevel/types/premium/stars-gift.d.cts +2 -0
- package/highlevel/types/premium/stars-gift.d.ts +2 -0
- package/highlevel/types/premium/stars-gift.js +4 -0
- package/highlevel/types/premium/stars-transaction.cjs +6 -0
- package/highlevel/types/premium/stars-transaction.d.cts +7 -0
- package/highlevel/types/premium/stars-transaction.d.ts +7 -0
- package/highlevel/types/premium/stars-transaction.js +6 -0
- package/highlevel/types/updates/history-read-update.cjs +2 -1
- package/highlevel/types/updates/history-read-update.js +2 -1
- package/highlevel/types/updates/user-typing-update.cjs +12 -0
- package/highlevel/types/updates/user-typing-update.d.cts +2 -0
- package/highlevel/types/updates/user-typing-update.d.ts +2 -0
- package/highlevel/types/updates/user-typing-update.js +12 -0
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/network/session-connection.cjs +16 -4
- package/network/session-connection.js +16 -4
- package/package.json +2 -2
- package/utils/binary/compat.cjs +16 -2
- package/utils/binary/compat.js +16 -2
|
@@ -175,6 +175,30 @@ class StarGiftUnique {
|
|
|
175
175
|
const resellPriceTon = this.raw.resellAmount?.find((it) => it._ === "starsTonAmount");
|
|
176
176
|
return resellPriceTon?.amount ?? null;
|
|
177
177
|
}
|
|
178
|
+
/** Profile colors associated with this gift */
|
|
179
|
+
get peerColor() {
|
|
180
|
+
if (this.raw.peerColor?._ !== "peerColorCollectible") return null;
|
|
181
|
+
return this.raw.peerColor;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* ID of the user who "hosts" this gift (i.e. this gift is actually stored on the TON blockchain,
|
|
185
|
+
* but is displayed as a gift on this peer's profile)
|
|
186
|
+
*/
|
|
187
|
+
get hostId() {
|
|
188
|
+
if (!this.raw.hostId) return null;
|
|
189
|
+
return getMarkedPeerId(this.raw.hostId);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* ID of the peer who "hosts" this gift (i.e. this gift is actually stored on the TON blockchain,
|
|
193
|
+
* but is displayed as a gift on this peer's profile), if available
|
|
194
|
+
* > Note: in some cases, only {@link hostId} is available, and not {@link host},
|
|
195
|
+
* > in which cases please use `tg.getPeer(ownerId)` manually
|
|
196
|
+
*/
|
|
197
|
+
get host() {
|
|
198
|
+
if (!this.raw.hostId) return null;
|
|
199
|
+
if (!this._peers.has(this.raw.hostId)) return null;
|
|
200
|
+
return parsePeer(this.raw.hostId, this._peers);
|
|
201
|
+
}
|
|
178
202
|
/** Model (i.e. the gift itself) of the unique star gift */
|
|
179
203
|
get model() {
|
|
180
204
|
return new StarGiftUniqueAttribute(this._model);
|
|
@@ -33,6 +33,10 @@ class StarGift {
|
|
|
33
33
|
get isPremiumOnly() {
|
|
34
34
|
return this.raw.requirePremium;
|
|
35
35
|
}
|
|
36
|
+
/** Whether this gift includes a peer color that can be applied to user's profile */
|
|
37
|
+
get hasPeerColor() {
|
|
38
|
+
return this.raw.peerColorAvailable;
|
|
39
|
+
}
|
|
36
40
|
/** Whether this gift is a unique gift */
|
|
37
41
|
isUnique = false;
|
|
38
42
|
/** Additional information for sold-out gifts */
|
|
@@ -28,6 +28,8 @@ export declare class StarGift {
|
|
|
28
28
|
get isLimited(): boolean;
|
|
29
29
|
/** Whether this gift is available only to premium users */
|
|
30
30
|
get isPremiumOnly(): boolean;
|
|
31
|
+
/** Whether this gift includes a peer color that can be applied to user's profile */
|
|
32
|
+
get hasPeerColor(): boolean;
|
|
31
33
|
/** Whether this gift is a unique gift */
|
|
32
34
|
readonly isUnique: false;
|
|
33
35
|
/** Additional information for sold-out gifts */
|
|
@@ -28,6 +28,8 @@ export declare class StarGift {
|
|
|
28
28
|
get isLimited(): boolean;
|
|
29
29
|
/** Whether this gift is available only to premium users */
|
|
30
30
|
get isPremiumOnly(): boolean;
|
|
31
|
+
/** Whether this gift includes a peer color that can be applied to user's profile */
|
|
32
|
+
get hasPeerColor(): boolean;
|
|
31
33
|
/** Whether this gift is a unique gift */
|
|
32
34
|
readonly isUnique: false;
|
|
33
35
|
/** Additional information for sold-out gifts */
|
|
@@ -26,6 +26,10 @@ class StarGift {
|
|
|
26
26
|
get isPremiumOnly() {
|
|
27
27
|
return this.raw.requirePremium;
|
|
28
28
|
}
|
|
29
|
+
/** Whether this gift includes a peer color that can be applied to user's profile */
|
|
30
|
+
get hasPeerColor() {
|
|
31
|
+
return this.raw.peerColorAvailable;
|
|
32
|
+
}
|
|
29
33
|
/** Whether this gift is a unique gift */
|
|
30
34
|
isUnique = false;
|
|
31
35
|
/** Additional information for sold-out gifts */
|
|
@@ -141,6 +141,12 @@ class StarsTransaction {
|
|
|
141
141
|
gift: new starsGiftUnique.StarGiftUnique(this.raw.stargift, this.peers),
|
|
142
142
|
type: "star_gift_prepaid_upgrade"
|
|
143
143
|
};
|
|
144
|
+
} else if (this.raw.stargiftDropOriginalDetails) {
|
|
145
|
+
return {
|
|
146
|
+
type: "star_gift_drop_details",
|
|
147
|
+
peer: peer$1,
|
|
148
|
+
gift: new starsGiftUnique.StarGiftUnique(this.raw.stargift, this.peers)
|
|
149
|
+
};
|
|
144
150
|
} else {
|
|
145
151
|
return {
|
|
146
152
|
type: "star_gift_transfer",
|
|
@@ -30,6 +30,7 @@ import { StarGift } from './stars-gift.js';
|
|
|
30
30
|
* - `ads_proceeds`: This transaction is proceeds from Telegram Ads
|
|
31
31
|
* - `paid_search`: This transaction is a payment for a paid search
|
|
32
32
|
* - `star_gift_prepaid_upgrade`: This transaction is for a star gift prepaid upgrade
|
|
33
|
+
* - `star_gift_drop_details`: This transaction is for dropping the original details of a star gift
|
|
33
34
|
*/
|
|
34
35
|
export type StarsTransactionType = {
|
|
35
36
|
type: 'unsupported';
|
|
@@ -174,6 +175,12 @@ export type StarsTransactionType = {
|
|
|
174
175
|
peer: Peer;
|
|
175
176
|
/** The upgraded gift */
|
|
176
177
|
gift: StarGiftUnique;
|
|
178
|
+
} | {
|
|
179
|
+
type: 'star_gift_drop_details';
|
|
180
|
+
/** Related peer */
|
|
181
|
+
peer: Peer;
|
|
182
|
+
/** The dropped gift */
|
|
183
|
+
gift: StarGiftUnique;
|
|
177
184
|
};
|
|
178
185
|
export declare class StarsTransaction {
|
|
179
186
|
readonly raw: tl.RawStarsTransaction;
|
|
@@ -30,6 +30,7 @@ import { StarGift } from './stars-gift.js';
|
|
|
30
30
|
* - `ads_proceeds`: This transaction is proceeds from Telegram Ads
|
|
31
31
|
* - `paid_search`: This transaction is a payment for a paid search
|
|
32
32
|
* - `star_gift_prepaid_upgrade`: This transaction is for a star gift prepaid upgrade
|
|
33
|
+
* - `star_gift_drop_details`: This transaction is for dropping the original details of a star gift
|
|
33
34
|
*/
|
|
34
35
|
export type StarsTransactionType = {
|
|
35
36
|
type: 'unsupported';
|
|
@@ -174,6 +175,12 @@ export type StarsTransactionType = {
|
|
|
174
175
|
peer: Peer;
|
|
175
176
|
/** The upgraded gift */
|
|
176
177
|
gift: StarGiftUnique;
|
|
178
|
+
} | {
|
|
179
|
+
type: 'star_gift_drop_details';
|
|
180
|
+
/** Related peer */
|
|
181
|
+
peer: Peer;
|
|
182
|
+
/** The dropped gift */
|
|
183
|
+
gift: StarGiftUnique;
|
|
177
184
|
};
|
|
178
185
|
export declare class StarsTransaction {
|
|
179
186
|
readonly raw: tl.RawStarsTransaction;
|
|
@@ -134,6 +134,12 @@ class StarsTransaction {
|
|
|
134
134
|
gift: new StarGiftUnique$2(this.raw.stargift, this.peers),
|
|
135
135
|
type: "star_gift_prepaid_upgrade"
|
|
136
136
|
};
|
|
137
|
+
} else if (this.raw.stargiftDropOriginalDetails) {
|
|
138
|
+
return {
|
|
139
|
+
type: "star_gift_drop_details",
|
|
140
|
+
peer,
|
|
141
|
+
gift: new StarGiftUnique$2(this.raw.stargift, this.peers)
|
|
142
|
+
};
|
|
137
143
|
} else {
|
|
138
144
|
return {
|
|
139
145
|
type: "star_gift_transfer",
|
|
@@ -117,12 +117,13 @@ class HistoryReadUpdate {
|
|
|
117
117
|
get threadId() {
|
|
118
118
|
switch (this.raw._) {
|
|
119
119
|
case "updateReadHistoryOutbox":
|
|
120
|
-
case "updateReadHistoryInbox":
|
|
121
120
|
case "updateReadChannelOutbox":
|
|
122
121
|
case "updateReadChannelInbox":
|
|
123
122
|
case "updateReadMonoForumInbox":
|
|
124
123
|
case "updateReadMonoForumOutbox":
|
|
125
124
|
return 0;
|
|
125
|
+
case "updateReadHistoryInbox":
|
|
126
|
+
return this.raw.topMsgId ?? 0;
|
|
126
127
|
case "updateReadChannelDiscussionOutbox":
|
|
127
128
|
case "updateReadChannelDiscussionInbox":
|
|
128
129
|
return this.raw.topMsgId;
|
|
@@ -110,12 +110,13 @@ class HistoryReadUpdate {
|
|
|
110
110
|
get threadId() {
|
|
111
111
|
switch (this.raw._) {
|
|
112
112
|
case "updateReadHistoryOutbox":
|
|
113
|
-
case "updateReadHistoryInbox":
|
|
114
113
|
case "updateReadChannelOutbox":
|
|
115
114
|
case "updateReadChannelInbox":
|
|
116
115
|
case "updateReadMonoForumInbox":
|
|
117
116
|
case "updateReadMonoForumOutbox":
|
|
118
117
|
return 0;
|
|
118
|
+
case "updateReadHistoryInbox":
|
|
119
|
+
return this.raw.topMsgId ?? 0;
|
|
119
120
|
case "updateReadChannelDiscussionOutbox":
|
|
120
121
|
case "updateReadChannelDiscussionInbox":
|
|
121
122
|
return this.raw.topMsgId;
|
|
@@ -34,6 +34,17 @@ class UserTypingUpdate {
|
|
|
34
34
|
return peerUtils.toggleChannelIdMark(this.raw.channelId);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
/** ID of the thread/topic where the user is typing, if applicable */
|
|
38
|
+
get threadId() {
|
|
39
|
+
switch (this.raw._) {
|
|
40
|
+
case "updateUserTyping":
|
|
41
|
+
return this.raw.topMsgId ?? null;
|
|
42
|
+
case "updateChatUserTyping":
|
|
43
|
+
return null;
|
|
44
|
+
case "updateChannelUserTyping":
|
|
45
|
+
return this.raw.topMsgId ?? null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
37
48
|
/**
|
|
38
49
|
* Type of the chat where this event has occurred
|
|
39
50
|
*/
|
|
@@ -53,6 +64,7 @@ class UserTypingUpdate {
|
|
|
53
64
|
get status() {
|
|
54
65
|
switch (this.raw.action._) {
|
|
55
66
|
case "sendMessageTypingAction":
|
|
67
|
+
case "sendMessageTextDraftAction":
|
|
56
68
|
return "typing";
|
|
57
69
|
case "sendMessageCancelAction":
|
|
58
70
|
return "cancel";
|
|
@@ -20,6 +20,8 @@ export declare class UserTypingUpdate {
|
|
|
20
20
|
* equal to {@link userId}
|
|
21
21
|
*/
|
|
22
22
|
get chatId(): number;
|
|
23
|
+
/** ID of the thread/topic where the user is typing, if applicable */
|
|
24
|
+
get threadId(): number | null;
|
|
23
25
|
/**
|
|
24
26
|
* Type of the chat where this event has occurred
|
|
25
27
|
*/
|
|
@@ -20,6 +20,8 @@ export declare class UserTypingUpdate {
|
|
|
20
20
|
* equal to {@link userId}
|
|
21
21
|
*/
|
|
22
22
|
get chatId(): number;
|
|
23
|
+
/** ID of the thread/topic where the user is typing, if applicable */
|
|
24
|
+
get threadId(): number | null;
|
|
23
25
|
/**
|
|
24
26
|
* Type of the chat where this event has occurred
|
|
25
27
|
*/
|
|
@@ -27,6 +27,17 @@ class UserTypingUpdate {
|
|
|
27
27
|
return toggleChannelIdMark(this.raw.channelId);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
/** ID of the thread/topic where the user is typing, if applicable */
|
|
31
|
+
get threadId() {
|
|
32
|
+
switch (this.raw._) {
|
|
33
|
+
case "updateUserTyping":
|
|
34
|
+
return this.raw.topMsgId ?? null;
|
|
35
|
+
case "updateChatUserTyping":
|
|
36
|
+
return null;
|
|
37
|
+
case "updateChannelUserTyping":
|
|
38
|
+
return this.raw.topMsgId ?? null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
30
41
|
/**
|
|
31
42
|
* Type of the chat where this event has occurred
|
|
32
43
|
*/
|
|
@@ -46,6 +57,7 @@ class UserTypingUpdate {
|
|
|
46
57
|
get status() {
|
|
47
58
|
switch (this.raw.action._) {
|
|
48
59
|
case "sendMessageTypingAction":
|
|
60
|
+
case "sendMessageTextDraftAction":
|
|
49
61
|
return "typing";
|
|
50
62
|
case "sendMessageCancelAction":
|
|
51
63
|
return "cancel";
|
|
@@ -733,7 +733,7 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
733
733
|
msgInfo.msgIds.length,
|
|
734
734
|
reason
|
|
735
735
|
);
|
|
736
|
-
this._session.queuedResendReq.
|
|
736
|
+
this._session.queuedResendReq.unshift(...msgInfo.msgIds);
|
|
737
737
|
this._flushTimer.emitWhenIdle();
|
|
738
738
|
break;
|
|
739
739
|
case "state": {
|
|
@@ -748,7 +748,7 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
748
748
|
utils.timers.clearTimeout(timer);
|
|
749
749
|
this._session.pendingGetStateTimeouts.delete(msgId);
|
|
750
750
|
}
|
|
751
|
-
this._session.queuedStateReq.
|
|
751
|
+
this._session.queuedStateReq.unshift(...msgInfo.msgIds);
|
|
752
752
|
this._flushTimer.emitWhenIdle();
|
|
753
753
|
break;
|
|
754
754
|
}
|
|
@@ -884,7 +884,12 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
884
884
|
return;
|
|
885
885
|
}
|
|
886
886
|
if (answerMsgId.isZero()) {
|
|
887
|
-
|
|
887
|
+
if (status & 64 && this._session.pendingMessages.has(msgId)) {
|
|
888
|
+
this.log.debug("received message info for %l: response is generated, but we have not received it yet! (status = %d)", msgId, status);
|
|
889
|
+
this._onMessageFailed(msgId, "response not received");
|
|
890
|
+
} else {
|
|
891
|
+
this.log.debug("received message info for %l: message is still pending (status = %d)", msgId, status);
|
|
892
|
+
}
|
|
888
893
|
return;
|
|
889
894
|
}
|
|
890
895
|
this.log.debug("received message info for %l, and answer (%l) was already received", msgId, answerMsgId);
|
|
@@ -900,6 +905,9 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
900
905
|
_onMsgsStateInfo(msg) {
|
|
901
906
|
const info = this._session.pendingMessages.get(msg.reqMsgId);
|
|
902
907
|
if (!info) {
|
|
908
|
+
if (this._session.recentOutgoingMsgIds.has(msg.reqMsgId)) {
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
903
911
|
this.log.warn("received msgs_state_info to unknown request %l", msg.reqMsgId);
|
|
904
912
|
return;
|
|
905
913
|
}
|
|
@@ -908,7 +916,11 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
908
916
|
return;
|
|
909
917
|
}
|
|
910
918
|
this._session.pendingMessages.delete(msg.reqMsgId);
|
|
911
|
-
|
|
919
|
+
let timer;
|
|
920
|
+
if (timer = this._session.pendingGetStateTimeouts.get(msg.reqMsgId)) {
|
|
921
|
+
utils.timers.clearTimeout(timer);
|
|
922
|
+
this._session.pendingGetStateTimeouts.delete(msg.reqMsgId);
|
|
923
|
+
}
|
|
912
924
|
this._onMessagesInfo(info.msgIds, msg.info);
|
|
913
925
|
}
|
|
914
926
|
_onFutureSalts(msg) {
|
|
@@ -726,7 +726,7 @@ class SessionConnection extends PersistentConnection {
|
|
|
726
726
|
msgInfo.msgIds.length,
|
|
727
727
|
reason
|
|
728
728
|
);
|
|
729
|
-
this._session.queuedResendReq.
|
|
729
|
+
this._session.queuedResendReq.unshift(...msgInfo.msgIds);
|
|
730
730
|
this._flushTimer.emitWhenIdle();
|
|
731
731
|
break;
|
|
732
732
|
case "state": {
|
|
@@ -741,7 +741,7 @@ class SessionConnection extends PersistentConnection {
|
|
|
741
741
|
timers.clearTimeout(timer);
|
|
742
742
|
this._session.pendingGetStateTimeouts.delete(msgId);
|
|
743
743
|
}
|
|
744
|
-
this._session.queuedStateReq.
|
|
744
|
+
this._session.queuedStateReq.unshift(...msgInfo.msgIds);
|
|
745
745
|
this._flushTimer.emitWhenIdle();
|
|
746
746
|
break;
|
|
747
747
|
}
|
|
@@ -877,7 +877,12 @@ class SessionConnection extends PersistentConnection {
|
|
|
877
877
|
return;
|
|
878
878
|
}
|
|
879
879
|
if (answerMsgId.isZero()) {
|
|
880
|
-
|
|
880
|
+
if (status & 64 && this._session.pendingMessages.has(msgId)) {
|
|
881
|
+
this.log.debug("received message info for %l: response is generated, but we have not received it yet! (status = %d)", msgId, status);
|
|
882
|
+
this._onMessageFailed(msgId, "response not received");
|
|
883
|
+
} else {
|
|
884
|
+
this.log.debug("received message info for %l: message is still pending (status = %d)", msgId, status);
|
|
885
|
+
}
|
|
881
886
|
return;
|
|
882
887
|
}
|
|
883
888
|
this.log.debug("received message info for %l, and answer (%l) was already received", msgId, answerMsgId);
|
|
@@ -893,6 +898,9 @@ class SessionConnection extends PersistentConnection {
|
|
|
893
898
|
_onMsgsStateInfo(msg) {
|
|
894
899
|
const info = this._session.pendingMessages.get(msg.reqMsgId);
|
|
895
900
|
if (!info) {
|
|
901
|
+
if (this._session.recentOutgoingMsgIds.has(msg.reqMsgId)) {
|
|
902
|
+
return;
|
|
903
|
+
}
|
|
896
904
|
this.log.warn("received msgs_state_info to unknown request %l", msg.reqMsgId);
|
|
897
905
|
return;
|
|
898
906
|
}
|
|
@@ -901,7 +909,11 @@ class SessionConnection extends PersistentConnection {
|
|
|
901
909
|
return;
|
|
902
910
|
}
|
|
903
911
|
this._session.pendingMessages.delete(msg.reqMsgId);
|
|
904
|
-
|
|
912
|
+
let timer;
|
|
913
|
+
if (timer = this._session.pendingGetStateTimeouts.get(msg.reqMsgId)) {
|
|
914
|
+
timers.clearTimeout(timer);
|
|
915
|
+
this._session.pendingGetStateTimeouts.delete(msg.reqMsgId);
|
|
916
|
+
}
|
|
905
917
|
this._onMessagesInfo(info.msgIds, msg.info);
|
|
906
918
|
}
|
|
907
919
|
_onFutureSalts(msg) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtcute/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.3",
|
|
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": "^216.0.0",
|
|
14
14
|
"@mtcute/tl-runtime": "^0.24.3",
|
|
15
15
|
"@types/events": "3.0.0",
|
|
16
16
|
"long": "5.2.3"
|
package/utils/binary/compat.cjs
CHANGED
|
@@ -56,6 +56,8 @@ function mapCompatStarGift(obj) {
|
|
|
56
56
|
_: "starGiftUnique",
|
|
57
57
|
giftId: Long.ZERO
|
|
58
58
|
};
|
|
59
|
+
case "starGiftUnique_layer214":
|
|
60
|
+
return replaceType(obj, "starGiftUnique");
|
|
59
61
|
case "starGift_layer202":
|
|
60
62
|
case "starGift_layer206":
|
|
61
63
|
case "starGift_layer209":
|
|
@@ -73,6 +75,12 @@ function mapCompatEmojiStatus(obj) {
|
|
|
73
75
|
_: "emojiStatus",
|
|
74
76
|
documentId: obj.documentId
|
|
75
77
|
};
|
|
78
|
+
case "emojiStatusUntil_layer214":
|
|
79
|
+
return {
|
|
80
|
+
_: "emojiStatus",
|
|
81
|
+
documentId: obj.documentId,
|
|
82
|
+
until: obj.until
|
|
83
|
+
};
|
|
76
84
|
default:
|
|
77
85
|
return obj;
|
|
78
86
|
}
|
|
@@ -89,6 +97,7 @@ function mapCompatMessageAction(obj) {
|
|
|
89
97
|
switch (obj._) {
|
|
90
98
|
case "messageActionStarGiftUnique_layer197":
|
|
91
99
|
case "messageActionStarGiftUnique_layer202":
|
|
100
|
+
case "messageActionStarGiftUnique_layer214":
|
|
92
101
|
return {
|
|
93
102
|
...obj,
|
|
94
103
|
_: "messageActionStarGiftUnique",
|
|
@@ -167,12 +176,14 @@ function mapCompatObject(obj) {
|
|
|
167
176
|
case "starGiftUnique_layer206":
|
|
168
177
|
case "starGiftUnique_layer210":
|
|
169
178
|
case "starGiftUnique_layer211":
|
|
179
|
+
case "starGiftUnique_layer214":
|
|
170
180
|
case "starGift_layer202":
|
|
171
181
|
case "starGift_layer206":
|
|
172
182
|
case "starGift_layer209":
|
|
173
183
|
case "starGift_layer211":
|
|
174
184
|
return mapCompatStarGift(obj);
|
|
175
185
|
case "emojiStatus_layer197":
|
|
186
|
+
case "emojiStatusUntil_layer214":
|
|
176
187
|
return mapCompatEmojiStatus(obj);
|
|
177
188
|
case "messageMediaDocument_layer197":
|
|
178
189
|
return mapCompatMessageMedia(obj);
|
|
@@ -186,14 +197,15 @@ function mapCompatObject(obj) {
|
|
|
186
197
|
case "messageActionStarGiftUnique_layer210":
|
|
187
198
|
case "messageActionPaidMessagesPrice_layer203":
|
|
188
199
|
case "messageActionSetChatTheme_layer211":
|
|
200
|
+
case "messageActionStarGiftUnique_layer214":
|
|
189
201
|
return mapCompatMessageAction(obj);
|
|
190
202
|
case "userFull_layer199":
|
|
191
203
|
return replaceType(dropFields(obj, ["premiumGifts"]), "userFull");
|
|
192
|
-
case "userFull_layer211":
|
|
193
|
-
return replaceType(obj, "userFull");
|
|
194
204
|
case "userFull_layer200":
|
|
195
205
|
case "userFull_layer209":
|
|
196
206
|
case "userFull_layer210":
|
|
207
|
+
case "userFull_layer211":
|
|
208
|
+
case "userFull_layer214":
|
|
197
209
|
return replaceType(obj, "userFull");
|
|
198
210
|
case "user_layer199":
|
|
199
211
|
return {
|
|
@@ -224,6 +236,8 @@ function mapCompatObject(obj) {
|
|
|
224
236
|
_: "storyItem",
|
|
225
237
|
media: mapCompatMessageMedia(obj.media)
|
|
226
238
|
};
|
|
239
|
+
case "premiumGiftOption_layer199":
|
|
240
|
+
return null;
|
|
227
241
|
default:
|
|
228
242
|
return obj;
|
|
229
243
|
}
|
package/utils/binary/compat.js
CHANGED
|
@@ -49,6 +49,8 @@ function mapCompatStarGift(obj) {
|
|
|
49
49
|
_: "starGiftUnique",
|
|
50
50
|
giftId: Long.ZERO
|
|
51
51
|
};
|
|
52
|
+
case "starGiftUnique_layer214":
|
|
53
|
+
return replaceType(obj, "starGiftUnique");
|
|
52
54
|
case "starGift_layer202":
|
|
53
55
|
case "starGift_layer206":
|
|
54
56
|
case "starGift_layer209":
|
|
@@ -66,6 +68,12 @@ function mapCompatEmojiStatus(obj) {
|
|
|
66
68
|
_: "emojiStatus",
|
|
67
69
|
documentId: obj.documentId
|
|
68
70
|
};
|
|
71
|
+
case "emojiStatusUntil_layer214":
|
|
72
|
+
return {
|
|
73
|
+
_: "emojiStatus",
|
|
74
|
+
documentId: obj.documentId,
|
|
75
|
+
until: obj.until
|
|
76
|
+
};
|
|
69
77
|
default:
|
|
70
78
|
return obj;
|
|
71
79
|
}
|
|
@@ -82,6 +90,7 @@ function mapCompatMessageAction(obj) {
|
|
|
82
90
|
switch (obj._) {
|
|
83
91
|
case "messageActionStarGiftUnique_layer197":
|
|
84
92
|
case "messageActionStarGiftUnique_layer202":
|
|
93
|
+
case "messageActionStarGiftUnique_layer214":
|
|
85
94
|
return {
|
|
86
95
|
...obj,
|
|
87
96
|
_: "messageActionStarGiftUnique",
|
|
@@ -160,12 +169,14 @@ function mapCompatObject(obj) {
|
|
|
160
169
|
case "starGiftUnique_layer206":
|
|
161
170
|
case "starGiftUnique_layer210":
|
|
162
171
|
case "starGiftUnique_layer211":
|
|
172
|
+
case "starGiftUnique_layer214":
|
|
163
173
|
case "starGift_layer202":
|
|
164
174
|
case "starGift_layer206":
|
|
165
175
|
case "starGift_layer209":
|
|
166
176
|
case "starGift_layer211":
|
|
167
177
|
return mapCompatStarGift(obj);
|
|
168
178
|
case "emojiStatus_layer197":
|
|
179
|
+
case "emojiStatusUntil_layer214":
|
|
169
180
|
return mapCompatEmojiStatus(obj);
|
|
170
181
|
case "messageMediaDocument_layer197":
|
|
171
182
|
return mapCompatMessageMedia(obj);
|
|
@@ -179,14 +190,15 @@ function mapCompatObject(obj) {
|
|
|
179
190
|
case "messageActionStarGiftUnique_layer210":
|
|
180
191
|
case "messageActionPaidMessagesPrice_layer203":
|
|
181
192
|
case "messageActionSetChatTheme_layer211":
|
|
193
|
+
case "messageActionStarGiftUnique_layer214":
|
|
182
194
|
return mapCompatMessageAction(obj);
|
|
183
195
|
case "userFull_layer199":
|
|
184
196
|
return replaceType(dropFields(obj, ["premiumGifts"]), "userFull");
|
|
185
|
-
case "userFull_layer211":
|
|
186
|
-
return replaceType(obj, "userFull");
|
|
187
197
|
case "userFull_layer200":
|
|
188
198
|
case "userFull_layer209":
|
|
189
199
|
case "userFull_layer210":
|
|
200
|
+
case "userFull_layer211":
|
|
201
|
+
case "userFull_layer214":
|
|
190
202
|
return replaceType(obj, "userFull");
|
|
191
203
|
case "user_layer199":
|
|
192
204
|
return {
|
|
@@ -217,6 +229,8 @@ function mapCompatObject(obj) {
|
|
|
217
229
|
_: "storyItem",
|
|
218
230
|
media: mapCompatMessageMedia(obj.media)
|
|
219
231
|
};
|
|
232
|
+
case "premiumGiftOption_layer199":
|
|
233
|
+
return null;
|
|
220
234
|
default:
|
|
221
235
|
return obj;
|
|
222
236
|
}
|