@mtcute/core 0.16.13 → 0.17.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/chunks/cjs/{CntZHjXA.js → BcdQkLTS.js} +83 -15
- package/chunks/cjs/{chPq0GcA.js → CSfUPcui.js} +914 -796
- package/chunks/cjs/{BO3RV06t.js → kxT7E_JE.js} +3 -3
- package/chunks/es/{xihQcMp0.js → BJRm2PAH.js} +3 -3
- package/chunks/es/{Jz_hDg6M.js → CbXFWEiB.js} +83 -15
- package/chunks/es/{Btmu4f4t.js → DKzd1_Yg.js} +914 -796
- package/client.cjs +21 -9
- package/client.js +21 -9
- package/highlevel/client.d.ts +109 -25
- package/highlevel/methods/files/upload-file.d.ts +8 -0
- package/highlevel/methods/premium/accept-star-gift.d.ts +16 -0
- package/highlevel/methods/premium/get-star-gift-options.d.ts +6 -0
- package/highlevel/methods/premium/get-star-gifts.d.ts +22 -0
- package/highlevel/methods/premium/iter-star-gifts.d.ts +26 -0
- package/highlevel/methods/premium/send-star-gift.d.ts +35 -0
- package/highlevel/methods/stickers/create-sticker-set.d.ts +1 -7
- package/highlevel/methods.d.ts +5 -1
- package/highlevel/types/bots/keyboards/factories.d.ts +7 -0
- package/highlevel/types/media/video.d.ts +1 -0
- package/highlevel/types/messages/message-action.d.ts +19 -2
- package/highlevel/types/misc/sticker-set.d.ts +1 -5
- package/highlevel/types/premium/index.d.ts +1 -0
- package/highlevel/types/premium/stars-gift.d.ts +57 -0
- package/highlevel/types/premium/stars-transaction.d.ts +8 -0
- package/index.cjs +5 -3
- package/index.js +7 -5
- package/methods.cjs +7 -3
- package/methods.js +7 -3
- package/network/client.d.ts +1 -1
- package/network/multi-session-connection.d.ts +1 -1
- package/network/persistent-connection.d.ts +1 -1
- package/network/transports/abstract.d.ts +1 -1
- package/network/transports/streamed.d.ts +1 -1
- package/network/transports/wrapped.d.ts +1 -1
- package/package.json +4 -4
- package/highlevel/methods/stories/report-story.d.ts +0 -19
|
@@ -8,7 +8,7 @@ const platform = require("./j7rWn_1y.js");
|
|
|
8
8
|
const tl = require("@mtcute/tl");
|
|
9
9
|
const conditionVariable = require("./eX3zeDAz.js");
|
|
10
10
|
const controllablePromise = require("./CZAB54t2.js");
|
|
11
|
-
const storyViewer = require("./
|
|
11
|
+
const storyViewer = require("./CSfUPcui.js");
|
|
12
12
|
const Long = require("long");
|
|
13
13
|
const peersIndex = require("./ija5tZ1t.js");
|
|
14
14
|
const fileId = require("@mtcute/file-id");
|
|
@@ -3861,6 +3861,23 @@ async function removeCloudPassword(client, password) {
|
|
|
3861
3861
|
}
|
|
3862
3862
|
});
|
|
3863
3863
|
}
|
|
3864
|
+
async function acceptStarGift(client, params) {
|
|
3865
|
+
const { action } = params;
|
|
3866
|
+
const { chatId, message } = storyViewer.normalizeInputMessageId(params);
|
|
3867
|
+
const userId = await storyViewer.resolveUser(client, chatId);
|
|
3868
|
+
return client.call(
|
|
3869
|
+
action === "convert" ? {
|
|
3870
|
+
_: "payments.convertStarGift",
|
|
3871
|
+
userId,
|
|
3872
|
+
msgId: message
|
|
3873
|
+
} : {
|
|
3874
|
+
_: "payments.saveStarGift",
|
|
3875
|
+
unsave: action === "hide",
|
|
3876
|
+
userId,
|
|
3877
|
+
msgId: message
|
|
3878
|
+
}
|
|
3879
|
+
);
|
|
3880
|
+
}
|
|
3864
3881
|
async function applyBoost(client, peerId) {
|
|
3865
3882
|
await client.call({
|
|
3866
3883
|
_: "premium.applyBoost",
|
|
@@ -3949,6 +3966,26 @@ async function getBusinessChatLinks(client) {
|
|
|
3949
3966
|
const res = await client.call({ _: "account.getBusinessChatLinks" });
|
|
3950
3967
|
return res.links.map((x) => new storyViewer.BusinessChatLink$2(x));
|
|
3951
3968
|
}
|
|
3969
|
+
async function getStarGiftOptions(client) {
|
|
3970
|
+
const res = await client.call({
|
|
3971
|
+
_: "payments.getStarGifts",
|
|
3972
|
+
hash: 0
|
|
3973
|
+
});
|
|
3974
|
+
controllablePromise.assertTypeIsNot("payments.getStarGifts", res, "payments.starGiftsNotModified");
|
|
3975
|
+
return res.gifts.map((gift) => new storyViewer.StarGift$2(gift));
|
|
3976
|
+
}
|
|
3977
|
+
async function getStarGifts(client, userId, params) {
|
|
3978
|
+
const { offset = "", limit = 100 } = params ?? {};
|
|
3979
|
+
const res = await client.call({
|
|
3980
|
+
_: "payments.getUserStarGifts",
|
|
3981
|
+
userId: await storyViewer.resolveUser(client, userId),
|
|
3982
|
+
offset,
|
|
3983
|
+
limit
|
|
3984
|
+
});
|
|
3985
|
+
const peers = peersIndex.PeersIndex.from(res);
|
|
3986
|
+
const gifts = res.gifts.map((gift) => new storyViewer.UserStarGift$2(gift, peers));
|
|
3987
|
+
return conditionVariable.makeArrayPaginated(gifts, res.count, offset);
|
|
3988
|
+
}
|
|
3952
3989
|
async function getStarsTransactions(client, peerId, params) {
|
|
3953
3990
|
const { direction, sort, subscriptionId, offset = "", limit = 100 } = params ?? {};
|
|
3954
3991
|
const res = await client.call({
|
|
@@ -3982,6 +4019,25 @@ async function* iterBoosters(client, peerId, params) {
|
|
|
3982
4019
|
offset = res.next;
|
|
3983
4020
|
}
|
|
3984
4021
|
}
|
|
4022
|
+
async function* iterStarGifts(client, peerId, params) {
|
|
4023
|
+
if (!params) params = {};
|
|
4024
|
+
const { limit = Infinity, chunkSize = 100 } = params;
|
|
4025
|
+
let { offset } = params;
|
|
4026
|
+
let current = 0;
|
|
4027
|
+
const peer = await storyViewer.resolvePeer(client, peerId);
|
|
4028
|
+
for (; ; ) {
|
|
4029
|
+
const res = await getStarGifts(client, peer, {
|
|
4030
|
+
offset,
|
|
4031
|
+
limit: Math.min(limit - current, chunkSize)
|
|
4032
|
+
});
|
|
4033
|
+
for (const gift of res) {
|
|
4034
|
+
yield gift;
|
|
4035
|
+
if (++current >= limit) return;
|
|
4036
|
+
}
|
|
4037
|
+
if (!res.next) return;
|
|
4038
|
+
offset = res.next;
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
3985
4041
|
async function* iterStarsTransactions(client, peerId, params) {
|
|
3986
4042
|
if (!params) params = {};
|
|
3987
4043
|
const { limit = Infinity, chunkSize = 100 } = params;
|
|
@@ -4001,6 +4057,27 @@ async function* iterStarsTransactions(client, peerId, params) {
|
|
|
4001
4057
|
offset = res.transactionsNextOffset;
|
|
4002
4058
|
}
|
|
4003
4059
|
}
|
|
4060
|
+
async function sendStarGift(client, params) {
|
|
4061
|
+
const { userId, gift, anonymous, message, shouldDispatch } = params;
|
|
4062
|
+
const invoice = {
|
|
4063
|
+
_: "inputInvoiceStarGift",
|
|
4064
|
+
hideName: anonymous,
|
|
4065
|
+
userId: await storyViewer.resolveUser(client, userId),
|
|
4066
|
+
giftId: Long.isLong(gift) ? gift : gift.id,
|
|
4067
|
+
message: message ? storyViewer.inputTextToTl(message) : void 0
|
|
4068
|
+
};
|
|
4069
|
+
const form = await client.call({
|
|
4070
|
+
_: "payments.getPaymentForm",
|
|
4071
|
+
invoice
|
|
4072
|
+
});
|
|
4073
|
+
const res = await client.call({
|
|
4074
|
+
_: "payments.sendStarsForm",
|
|
4075
|
+
invoice,
|
|
4076
|
+
formId: form.formId
|
|
4077
|
+
});
|
|
4078
|
+
controllablePromise.assertTypeIs("payments.sendStarsForm", res, "payments.paymentResult");
|
|
4079
|
+
return storyViewer._findMessageInUpdate(client, res.updates, false, !shouldDispatch);
|
|
4080
|
+
}
|
|
4004
4081
|
async function _normalizeFileToDocument(client, file, params) {
|
|
4005
4082
|
if (typeof file === "object" && tl.tl.isAnyInputDocument(file)) {
|
|
4006
4083
|
return file;
|
|
@@ -4101,8 +4178,6 @@ async function createStickerSet(client, params) {
|
|
|
4101
4178
|
}
|
|
4102
4179
|
const res = await client.call({
|
|
4103
4180
|
_: "stickers.createStickerSet",
|
|
4104
|
-
animated: params.sourceType === "animated",
|
|
4105
|
-
videos: params.sourceType === "video",
|
|
4106
4181
|
masks: params.type === "mask",
|
|
4107
4182
|
emojis: params.type === "emoji",
|
|
4108
4183
|
textColor: params.adaptive,
|
|
@@ -4455,17 +4530,6 @@ async function readStories(client, peerId, maxId) {
|
|
|
4455
4530
|
maxId
|
|
4456
4531
|
});
|
|
4457
4532
|
}
|
|
4458
|
-
async function reportStory(client, peerId, storyIds, params) {
|
|
4459
|
-
const { reason = { _: "inputReportReasonSpam" }, message = "" } = params ?? {};
|
|
4460
|
-
const r = await client.call({
|
|
4461
|
-
_: "stories.report",
|
|
4462
|
-
peer: await storyViewer.resolvePeer(client, peerId),
|
|
4463
|
-
id: Array.isArray(storyIds) ? storyIds : [storyIds],
|
|
4464
|
-
message,
|
|
4465
|
-
reason
|
|
4466
|
-
});
|
|
4467
|
-
controllablePromise.assertTrue("stories.report", r);
|
|
4468
|
-
}
|
|
4469
4533
|
async function sendStoryReaction(client, params) {
|
|
4470
4534
|
const { peerId, storyId, reaction, addToRecent } = params;
|
|
4471
4535
|
const res = await client.call({
|
|
@@ -4767,6 +4831,7 @@ async function updateProfile(client, params) {
|
|
|
4767
4831
|
return new storyViewer.User$2(res);
|
|
4768
4832
|
}
|
|
4769
4833
|
exports._normalizePrivacyRules = _normalizePrivacyRules;
|
|
4834
|
+
exports.acceptStarGift = acceptStarGift;
|
|
4770
4835
|
exports.addChatMembers = addChatMembers;
|
|
4771
4836
|
exports.addContact = addContact;
|
|
4772
4837
|
exports.addStickerToSet = addStickerToSet;
|
|
@@ -4888,6 +4953,8 @@ exports.getReactionUsers = getReactionUsers;
|
|
|
4888
4953
|
exports.getReplyTo = getReplyTo;
|
|
4889
4954
|
exports.getScheduledMessages = getScheduledMessages;
|
|
4890
4955
|
exports.getSimilarChannels = getSimilarChannels;
|
|
4956
|
+
exports.getStarGiftOptions = getStarGiftOptions;
|
|
4957
|
+
exports.getStarGifts = getStarGifts;
|
|
4891
4958
|
exports.getStarsTransactions = getStarsTransactions;
|
|
4892
4959
|
exports.getStickerSet = getStickerSet;
|
|
4893
4960
|
exports.getStoriesById = getStoriesById;
|
|
@@ -4918,6 +4985,7 @@ exports.iterReactionUsers = iterReactionUsers;
|
|
|
4918
4985
|
exports.iterSearchGlobal = iterSearchGlobal;
|
|
4919
4986
|
exports.iterSearchHashtag = iterSearchHashtag;
|
|
4920
4987
|
exports.iterSearchMessages = iterSearchMessages;
|
|
4988
|
+
exports.iterStarGifts = iterStarGifts;
|
|
4921
4989
|
exports.iterStarsTransactions = iterStarsTransactions;
|
|
4922
4990
|
exports.iterStoryViewers = iterStoryViewers;
|
|
4923
4991
|
exports.joinChat = joinChat;
|
|
@@ -4942,7 +5010,6 @@ exports.replaceStickerInSet = replaceStickerInSet;
|
|
|
4942
5010
|
exports.replyMedia = replyMedia;
|
|
4943
5011
|
exports.replyMediaGroup = replyMediaGroup;
|
|
4944
5012
|
exports.replyText = replyText;
|
|
4945
|
-
exports.reportStory = reportStory;
|
|
4946
5013
|
exports.resendCode = resendCode;
|
|
4947
5014
|
exports.resendPasswordEmail = resendPasswordEmail;
|
|
4948
5015
|
exports.restrictChatMember = restrictChatMember;
|
|
@@ -4959,6 +5026,7 @@ exports.sendPaidReaction = sendPaidReaction;
|
|
|
4959
5026
|
exports.sendReaction = sendReaction;
|
|
4960
5027
|
exports.sendRecoveryCode = sendRecoveryCode;
|
|
4961
5028
|
exports.sendScheduled = sendScheduled;
|
|
5029
|
+
exports.sendStarGift = sendStarGift;
|
|
4962
5030
|
exports.sendStory = sendStory;
|
|
4963
5031
|
exports.sendStoryReaction = sendStoryReaction;
|
|
4964
5032
|
exports.sendTyping = sendTyping;
|