@mtcute/core 0.16.14 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/cjs/{DIHjSN4l.js → B_4IhLh8.js} +2 -2
- package/chunks/cjs/{chPq0GcA.js → CSfUPcui.js} +914 -796
- package/chunks/cjs/{CntZHjXA.js → CgIc6lxt.js} +91 -24
- package/chunks/es/{Btmu4f4t.js → DKzd1_Yg.js} +914 -796
- package/chunks/es/{qzEaLpWa.js → DzOlHce2.js} +2 -2
- package/chunks/es/{Jz_hDg6M.js → KKzIgirK.js} +91 -24
- package/client.cjs +20 -8
- package/client.js +20 -8
- package/highlevel/client.d.ts +108 -24
- 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 +4 -2
- package/index.js +6 -4
- package/methods.cjs +7 -3
- package/methods.js +7 -3
- package/package.json +4 -4
- package/highlevel/methods/stories/report-story.d.ts +0 -19
|
@@ -3,7 +3,7 @@ import Long from "long";
|
|
|
3
3
|
import { LruMap, getAllPeersFrom, toggleChannelIdMark, longToFastString, extractUsernames, parseMarkedPeerId, longFromFastString, Deque, AsyncLock, getMarkedPeerId, setTimeoutWrap, clearTimeoutWrap, makeInspectable, getBarePeerId, encodeInlineMessageId, assertNever, ConditionVariable, clearIntervalWrap, setIntervalWrap, toInputChannel, sleepWithAbort, buffersEqual, dataViewFromBuffer, concatBuffers, randomLong, LongMap, compareLongs, getRandomInt, longFromBuffer, removeFromLongArray } from "./DY1E3mHM.js";
|
|
4
4
|
import { MtArgumentError, MtTimeoutError, getPlatform, MtUnsupportedError, MtcuteError, MtSecurityError, MtTypeAssertionError } from "./DBMBgE7t.js";
|
|
5
5
|
import { createControllablePromise, assertTypeIs, isTlRpcError, mtpAssertTypeIs } from "./BN3qj7tU.js";
|
|
6
|
-
import { resolvePeer, getPeerDialogs, sendText, sendMedia, sendMediaGroup, readHistory, memoizeGetters, Chat$2, User$2, ChatInviteLink$2, Message$2, ChatMember$2, Location$1, parsePeer, toReactionEmoji, ReactionCount$1, Poll$2, Story$2, toPendingUpdate, messageToUpdate, isMessageEmpty, createDummyUpdatesContainer, extractChannelIdFromUpdate, _getChannelsBatched } from "./
|
|
6
|
+
import { resolvePeer, getPeerDialogs, sendText, sendMedia, sendMediaGroup, readHistory, memoizeGetters, Chat$2, User$2, ChatInviteLink$2, Message$2, ChatMember$2, Location$1, parsePeer, toReactionEmoji, ReactionCount$1, Poll$2, Story$2, toPendingUpdate, messageToUpdate, isMessageEmpty, createDummyUpdatesContainer, extractChannelIdFromUpdate, _getChannelsBatched } from "./DKzd1_Yg.js";
|
|
7
7
|
import { TlBinaryWriter, TlBinaryReader, TlSerializationCounter } from "@mtcute/tl-runtime";
|
|
8
8
|
import { tl, mtp } from "@mtcute/tl";
|
|
9
9
|
import { PeersIndex } from "./N3PMYmCL.js";
|
|
@@ -6209,7 +6209,7 @@ class NetworkManager {
|
|
|
6209
6209
|
_: "initConnection",
|
|
6210
6210
|
deviceModel,
|
|
6211
6211
|
systemVersion: "1.0",
|
|
6212
|
-
appVersion: "0.
|
|
6212
|
+
appVersion: "0.17.1",
|
|
6213
6213
|
systemLangCode: "en",
|
|
6214
6214
|
langPack: "",
|
|
6215
6215
|
// "langPacks are for official apps only"
|
|
@@ -2,7 +2,7 @@ import { getPlatform, MtArgumentError, MtcuteError, MtTypeAssertionError, MtUnsu
|
|
|
2
2
|
import { tl } from "@mtcute/tl";
|
|
3
3
|
import { normalizePhoneNumber, sleepWithAbort, resolveMaybeDynamic, assertNever, normalizeInlineId, isInputPeerChat, isInputPeerChannel, toInputChannel, toInputUser, normalizeDate, isInputPeerUser, makeArrayWithTotal, INVITE_LINK_REGEX, getMarkedPeerId, determinePartSize, ConditionVariable, concatBuffers, bufferToStream, randomLong, makeArrayPaginated, LongMap, toggleChannelIdMark, LongSet, parseMarkedPeerId } from "./DY1E3mHM.js";
|
|
4
4
|
import { assertTypeIs, createControllablePromise, assertTrue, MtInvalidPeerTypeError, isPresent, MtPeerNotFoundError, assertTypeIsNot, MtMessageNotFoundError, hasValueAtKey } from "./BN3qj7tU.js";
|
|
5
|
-
import { User$2, SentCode$1, _convertToTl, resolveUser, resolvePeer, normalizeInputMessageId, GameHighScore$2, _findMessageInUpdate, resolvePeerMany, assertIsUpdatesGroup, Chat$2, resolveChannel, createDummyUpdate, ChatEvent$2, ChatMember$2, ChatPreview$2, _getRawPeerBatched, FullChat$2, getPeerDialogs, uploadFile, fileIdToInputPhoto, isUploadedFile, Dialog$2, ChatlistPreview$2, FileLocation$1, fileIdToInputWebFileLocation, fileIdToInputFileLocation, _normalizeInputMedia, parseDocument, Photo$2, ForumTopic$2, ChatInviteLink$2, ChatInviteLinkMember$2, Poll$2, _normalizeInputText, _convertToTl$1, _maybeInvokeWithBusinessConnection, _normalizeQuickReplyShortcut, Message$2, MessageEffect$2, FactCheck$2, _getDiscussionMessage, getMessages, MessageReactions$2, normalizeInputReaction, PeerReaction$2, SearchFilters, sendText, sendMedia, sendMediaGroup, CollectibleInfo$1, TakeoutSession$1, BoostSlot$2, BusinessChatLink$2, BoostStats$1, Boost$2, StarsStatus$2, businessWorkHoursDaysToRaw, MASK_POSITION_POINT_TO_TL, normalizeInputStickerSet, StickerSet$2, fileIdToInputDocument, Story$2, AllStories$2, PeerStories$2, StoryInteractions$2, StoryViewersList$2, StoriesStealthMode$1, _getUsersBatched, _normalizePeerId, _normalizeInputFile } from "./
|
|
5
|
+
import { User$2, SentCode$1, _convertToTl, resolveUser, resolvePeer, normalizeInputMessageId, GameHighScore$2, _findMessageInUpdate, resolvePeerMany, assertIsUpdatesGroup, Chat$2, resolveChannel, createDummyUpdate, ChatEvent$2, ChatMember$2, ChatPreview$2, _getRawPeerBatched, FullChat$2, getPeerDialogs, uploadFile, fileIdToInputPhoto, isUploadedFile, Dialog$2, ChatlistPreview$2, FileLocation$1, fileIdToInputWebFileLocation, fileIdToInputFileLocation, _normalizeInputMedia, parseDocument, Photo$2, ForumTopic$2, ChatInviteLink$2, ChatInviteLinkMember$2, Poll$2, _normalizeInputText, _convertToTl$1, _maybeInvokeWithBusinessConnection, _normalizeQuickReplyShortcut, Message$2, MessageEffect$2, FactCheck$2, _getDiscussionMessage, getMessages, MessageReactions$2, normalizeInputReaction, PeerReaction$2, SearchFilters, sendText, sendMedia, sendMediaGroup, CollectibleInfo$1, TakeoutSession$1, BoostSlot$2, BusinessChatLink$2, BoostStats$1, Boost$2, StarGift$2, UserStarGift$2, StarsStatus$2, inputTextToTl, businessWorkHoursDaysToRaw, MASK_POSITION_POINT_TO_TL, normalizeInputStickerSet, StickerSet$2, fileIdToInputDocument, Story$2, AllStories$2, PeerStories$2, StoryInteractions$2, StoryViewersList$2, StoriesStealthMode$1, _getUsersBatched, _normalizePeerId, _normalizeInputFile } from "./DKzd1_Yg.js";
|
|
6
6
|
import Long from "long";
|
|
7
7
|
import { PeersIndex } from "./N3PMYmCL.js";
|
|
8
8
|
import { tdFileId, parseFileId } from "@mtcute/file-id";
|
|
@@ -1981,16 +1981,15 @@ async function findDialogs(client, peers) {
|
|
|
1981
1981
|
foundInputPeers.push(resolvedPeer);
|
|
1982
1982
|
foundIdxToOriginalIdx.set(foundInputPeers.length - 1, i);
|
|
1983
1983
|
}
|
|
1984
|
-
if (foundInputPeers.length === 0) {
|
|
1985
|
-
throw new MtPeerNotFoundError(`Could not find dialogs with peers: ${peers.join(", ")}`);
|
|
1986
|
-
}
|
|
1987
|
-
const dialogs = await getPeerDialogs(client, foundInputPeers);
|
|
1988
|
-
if (foundInputPeers.length === peers.length) {
|
|
1989
|
-
return dialogs;
|
|
1990
|
-
}
|
|
1991
1984
|
const ret = Array.from({ length: peers.length });
|
|
1992
|
-
|
|
1993
|
-
|
|
1985
|
+
if (foundInputPeers.length !== 0) {
|
|
1986
|
+
const dialogs = await getPeerDialogs(client, foundInputPeers);
|
|
1987
|
+
if (foundInputPeers.length === peers.length) {
|
|
1988
|
+
return dialogs;
|
|
1989
|
+
}
|
|
1990
|
+
for (const [idx, origIdx] of foundIdxToOriginalIdx) {
|
|
1991
|
+
ret[origIdx] = dialogs[idx];
|
|
1992
|
+
}
|
|
1994
1993
|
}
|
|
1995
1994
|
for await (const dialog of iterDialogs(client, {
|
|
1996
1995
|
archived: "keep"
|
|
@@ -3855,6 +3854,23 @@ async function removeCloudPassword(client, password) {
|
|
|
3855
3854
|
}
|
|
3856
3855
|
});
|
|
3857
3856
|
}
|
|
3857
|
+
async function acceptStarGift(client, params) {
|
|
3858
|
+
const { action } = params;
|
|
3859
|
+
const { chatId, message: message2 } = normalizeInputMessageId(params);
|
|
3860
|
+
const userId = await resolveUser(client, chatId);
|
|
3861
|
+
return client.call(
|
|
3862
|
+
action === "convert" ? {
|
|
3863
|
+
_: "payments.convertStarGift",
|
|
3864
|
+
userId,
|
|
3865
|
+
msgId: message2
|
|
3866
|
+
} : {
|
|
3867
|
+
_: "payments.saveStarGift",
|
|
3868
|
+
unsave: action === "hide",
|
|
3869
|
+
userId,
|
|
3870
|
+
msgId: message2
|
|
3871
|
+
}
|
|
3872
|
+
);
|
|
3873
|
+
}
|
|
3858
3874
|
async function applyBoost(client, peerId) {
|
|
3859
3875
|
await client.call({
|
|
3860
3876
|
_: "premium.applyBoost",
|
|
@@ -3943,6 +3959,26 @@ async function getBusinessChatLinks(client) {
|
|
|
3943
3959
|
const res = await client.call({ _: "account.getBusinessChatLinks" });
|
|
3944
3960
|
return res.links.map((x) => new BusinessChatLink$2(x));
|
|
3945
3961
|
}
|
|
3962
|
+
async function getStarGiftOptions(client) {
|
|
3963
|
+
const res = await client.call({
|
|
3964
|
+
_: "payments.getStarGifts",
|
|
3965
|
+
hash: 0
|
|
3966
|
+
});
|
|
3967
|
+
assertTypeIsNot("payments.getStarGifts", res, "payments.starGiftsNotModified");
|
|
3968
|
+
return res.gifts.map((gift) => new StarGift$2(gift));
|
|
3969
|
+
}
|
|
3970
|
+
async function getStarGifts(client, userId, params) {
|
|
3971
|
+
const { offset = "", limit = 100 } = params ?? {};
|
|
3972
|
+
const res = await client.call({
|
|
3973
|
+
_: "payments.getUserStarGifts",
|
|
3974
|
+
userId: await resolveUser(client, userId),
|
|
3975
|
+
offset,
|
|
3976
|
+
limit
|
|
3977
|
+
});
|
|
3978
|
+
const peers = PeersIndex.from(res);
|
|
3979
|
+
const gifts = res.gifts.map((gift) => new UserStarGift$2(gift, peers));
|
|
3980
|
+
return makeArrayPaginated(gifts, res.count, offset);
|
|
3981
|
+
}
|
|
3946
3982
|
async function getStarsTransactions(client, peerId, params) {
|
|
3947
3983
|
const { direction, sort, subscriptionId, offset = "", limit = 100 } = params ?? {};
|
|
3948
3984
|
const res = await client.call({
|
|
@@ -3976,6 +4012,25 @@ async function* iterBoosters(client, peerId, params) {
|
|
|
3976
4012
|
offset = res.next;
|
|
3977
4013
|
}
|
|
3978
4014
|
}
|
|
4015
|
+
async function* iterStarGifts(client, peerId, params) {
|
|
4016
|
+
if (!params) params = {};
|
|
4017
|
+
const { limit = Infinity, chunkSize = 100 } = params;
|
|
4018
|
+
let { offset } = params;
|
|
4019
|
+
let current = 0;
|
|
4020
|
+
const peer = await resolvePeer(client, peerId);
|
|
4021
|
+
for (; ; ) {
|
|
4022
|
+
const res = await getStarGifts(client, peer, {
|
|
4023
|
+
offset,
|
|
4024
|
+
limit: Math.min(limit - current, chunkSize)
|
|
4025
|
+
});
|
|
4026
|
+
for (const gift of res) {
|
|
4027
|
+
yield gift;
|
|
4028
|
+
if (++current >= limit) return;
|
|
4029
|
+
}
|
|
4030
|
+
if (!res.next) return;
|
|
4031
|
+
offset = res.next;
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
3979
4034
|
async function* iterStarsTransactions(client, peerId, params) {
|
|
3980
4035
|
if (!params) params = {};
|
|
3981
4036
|
const { limit = Infinity, chunkSize = 100 } = params;
|
|
@@ -3995,6 +4050,27 @@ async function* iterStarsTransactions(client, peerId, params) {
|
|
|
3995
4050
|
offset = res.transactionsNextOffset;
|
|
3996
4051
|
}
|
|
3997
4052
|
}
|
|
4053
|
+
async function sendStarGift(client, params) {
|
|
4054
|
+
const { userId, gift, anonymous, message: message2, shouldDispatch } = params;
|
|
4055
|
+
const invoice = {
|
|
4056
|
+
_: "inputInvoiceStarGift",
|
|
4057
|
+
hideName: anonymous,
|
|
4058
|
+
userId: await resolveUser(client, userId),
|
|
4059
|
+
giftId: Long.isLong(gift) ? gift : gift.id,
|
|
4060
|
+
message: message2 ? inputTextToTl(message2) : void 0
|
|
4061
|
+
};
|
|
4062
|
+
const form = await client.call({
|
|
4063
|
+
_: "payments.getPaymentForm",
|
|
4064
|
+
invoice
|
|
4065
|
+
});
|
|
4066
|
+
const res = await client.call({
|
|
4067
|
+
_: "payments.sendStarsForm",
|
|
4068
|
+
invoice,
|
|
4069
|
+
formId: form.formId
|
|
4070
|
+
});
|
|
4071
|
+
assertTypeIs("payments.sendStarsForm", res, "payments.paymentResult");
|
|
4072
|
+
return _findMessageInUpdate(client, res.updates, false, !shouldDispatch);
|
|
4073
|
+
}
|
|
3998
4074
|
async function _normalizeFileToDocument(client, file, params) {
|
|
3999
4075
|
if (typeof file === "object" && tl.isAnyInputDocument(file)) {
|
|
4000
4076
|
return file;
|
|
@@ -4095,8 +4171,6 @@ async function createStickerSet(client, params) {
|
|
|
4095
4171
|
}
|
|
4096
4172
|
const res = await client.call({
|
|
4097
4173
|
_: "stickers.createStickerSet",
|
|
4098
|
-
animated: params.sourceType === "animated",
|
|
4099
|
-
videos: params.sourceType === "video",
|
|
4100
4174
|
masks: params.type === "mask",
|
|
4101
4175
|
emojis: params.type === "emoji",
|
|
4102
4176
|
textColor: params.adaptive,
|
|
@@ -4449,17 +4523,6 @@ async function readStories(client, peerId, maxId) {
|
|
|
4449
4523
|
maxId
|
|
4450
4524
|
});
|
|
4451
4525
|
}
|
|
4452
|
-
async function reportStory(client, peerId, storyIds, params) {
|
|
4453
|
-
const { reason = { _: "inputReportReasonSpam" }, message: message2 = "" } = params ?? {};
|
|
4454
|
-
const r = await client.call({
|
|
4455
|
-
_: "stories.report",
|
|
4456
|
-
peer: await resolvePeer(client, peerId),
|
|
4457
|
-
id: Array.isArray(storyIds) ? storyIds : [storyIds],
|
|
4458
|
-
message: message2,
|
|
4459
|
-
reason
|
|
4460
|
-
});
|
|
4461
|
-
assertTrue("stories.report", r);
|
|
4462
|
-
}
|
|
4463
4526
|
async function sendStoryReaction(client, params) {
|
|
4464
4527
|
const { peerId, storyId, reaction, addToRecent } = params;
|
|
4465
4528
|
const res = await client.call({
|
|
@@ -4762,6 +4825,7 @@ async function updateProfile(client, params) {
|
|
|
4762
4825
|
}
|
|
4763
4826
|
export {
|
|
4764
4827
|
_normalizePrivacyRules,
|
|
4828
|
+
acceptStarGift,
|
|
4765
4829
|
addChatMembers,
|
|
4766
4830
|
addContact,
|
|
4767
4831
|
addStickerToSet,
|
|
@@ -4883,6 +4947,8 @@ export {
|
|
|
4883
4947
|
getReplyTo,
|
|
4884
4948
|
getScheduledMessages,
|
|
4885
4949
|
getSimilarChannels,
|
|
4950
|
+
getStarGiftOptions,
|
|
4951
|
+
getStarGifts,
|
|
4886
4952
|
getStarsTransactions,
|
|
4887
4953
|
getStickerSet,
|
|
4888
4954
|
getStoriesById,
|
|
@@ -4913,6 +4979,7 @@ export {
|
|
|
4913
4979
|
iterSearchGlobal,
|
|
4914
4980
|
iterSearchHashtag,
|
|
4915
4981
|
iterSearchMessages,
|
|
4982
|
+
iterStarGifts,
|
|
4916
4983
|
iterStarsTransactions,
|
|
4917
4984
|
iterStoryViewers,
|
|
4918
4985
|
joinChat,
|
|
@@ -4937,7 +5004,6 @@ export {
|
|
|
4937
5004
|
replyMedia,
|
|
4938
5005
|
replyMediaGroup,
|
|
4939
5006
|
replyText,
|
|
4940
|
-
reportStory,
|
|
4941
5007
|
resendCode,
|
|
4942
5008
|
resendPasswordEmail,
|
|
4943
5009
|
restrictChatMember,
|
|
@@ -4954,6 +5020,7 @@ export {
|
|
|
4954
5020
|
sendReaction,
|
|
4955
5021
|
sendRecoveryCode,
|
|
4956
5022
|
sendScheduled,
|
|
5023
|
+
sendStarGift,
|
|
4957
5024
|
sendStory,
|
|
4958
5025
|
sendStoryReaction,
|
|
4959
5026
|
sendTyping,
|
package/client.cjs
CHANGED
|
@@ -7,7 +7,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
8
|
const EventEmitter = require("events");
|
|
9
9
|
const tl = require("@mtcute/tl");
|
|
10
|
-
const client = require("./chunks/cjs/
|
|
10
|
+
const client = require("./chunks/cjs/B_4IhLh8.js");
|
|
11
11
|
const platform = require("./chunks/cjs/j7rWn_1y.js");
|
|
12
12
|
const sortedArray = require("./chunks/cjs/C1cFqHcW.js");
|
|
13
13
|
const logger = require("./chunks/cjs/D4qcXFYA.js");
|
|
@@ -15,12 +15,12 @@ const controllablePromise = require("./chunks/cjs/CZAB54t2.js");
|
|
|
15
15
|
require("@mtcute/tl-runtime");
|
|
16
16
|
const tlJson = require("./chunks/cjs/BQETTb_8.js");
|
|
17
17
|
const conditionVariable = require("./chunks/cjs/eX3zeDAz.js");
|
|
18
|
-
const storyViewer = require("./chunks/cjs/
|
|
19
|
-
const updateProfile = require("./chunks/cjs/
|
|
18
|
+
const storyViewer = require("./chunks/cjs/CSfUPcui.js");
|
|
19
|
+
const updateProfile = require("./chunks/cjs/CgIc6lxt.js");
|
|
20
20
|
function reportUnknownError(log, error, method) {
|
|
21
21
|
if (typeof fetch !== "function") return;
|
|
22
|
-
fetch(`https://rpc.
|
|
23
|
-
if (r.
|
|
22
|
+
fetch(`https://report-rpc-error.madelineproto.xyz/?code=${error.code}&method=${method}&error=${error.text}`).then((r) => r.json()).then((r) => {
|
|
23
|
+
if (r.result) {
|
|
24
24
|
log.info("telerpc responded with error info for %s: %s", error.text, r.result);
|
|
25
25
|
} else {
|
|
26
26
|
log.info(
|
|
@@ -1080,6 +1080,9 @@ TelegramClient.prototype.cancelPasswordEmail = function(...args) {
|
|
|
1080
1080
|
TelegramClient.prototype.removeCloudPassword = function(...args) {
|
|
1081
1081
|
return updateProfile.removeCloudPassword(this._client, ...args);
|
|
1082
1082
|
};
|
|
1083
|
+
TelegramClient.prototype.acceptStarGift = function(...args) {
|
|
1084
|
+
return updateProfile.acceptStarGift(this._client, ...args);
|
|
1085
|
+
};
|
|
1083
1086
|
TelegramClient.prototype.applyBoost = function(...args) {
|
|
1084
1087
|
return updateProfile.applyBoost(this._client, ...args);
|
|
1085
1088
|
};
|
|
@@ -1110,15 +1113,27 @@ TelegramClient.prototype.getBusinessConnection = function(...args) {
|
|
|
1110
1113
|
TelegramClient.prototype.getMyBoostSlots = function(...args) {
|
|
1111
1114
|
return updateProfile.getMyBoostSlots(this._client, ...args);
|
|
1112
1115
|
};
|
|
1116
|
+
TelegramClient.prototype.getStarGiftOptions = function(...args) {
|
|
1117
|
+
return updateProfile.getStarGiftOptions(this._client, ...args);
|
|
1118
|
+
};
|
|
1119
|
+
TelegramClient.prototype.getStarGifts = function(...args) {
|
|
1120
|
+
return updateProfile.getStarGifts(this._client, ...args);
|
|
1121
|
+
};
|
|
1113
1122
|
TelegramClient.prototype.getStarsTransactions = function(...args) {
|
|
1114
1123
|
return updateProfile.getStarsTransactions(this._client, ...args);
|
|
1115
1124
|
};
|
|
1116
1125
|
TelegramClient.prototype.iterBoosters = function(...args) {
|
|
1117
1126
|
return updateProfile.iterBoosters(this._client, ...args);
|
|
1118
1127
|
};
|
|
1128
|
+
TelegramClient.prototype.iterStarGifts = function(...args) {
|
|
1129
|
+
return updateProfile.iterStarGifts(this._client, ...args);
|
|
1130
|
+
};
|
|
1119
1131
|
TelegramClient.prototype.iterStarsTransactions = function(...args) {
|
|
1120
1132
|
return updateProfile.iterStarsTransactions(this._client, ...args);
|
|
1121
1133
|
};
|
|
1134
|
+
TelegramClient.prototype.sendStarGift = function(...args) {
|
|
1135
|
+
return updateProfile.sendStarGift(this._client, ...args);
|
|
1136
|
+
};
|
|
1122
1137
|
TelegramClient.prototype.setBusinessIntro = function(...args) {
|
|
1123
1138
|
return updateProfile.setBusinessIntro(this._client, ...args);
|
|
1124
1139
|
};
|
|
@@ -1209,9 +1224,6 @@ TelegramClient.prototype.iterStoryViewers = function(...args) {
|
|
|
1209
1224
|
TelegramClient.prototype.readStories = function(...args) {
|
|
1210
1225
|
return updateProfile.readStories(this._client, ...args);
|
|
1211
1226
|
};
|
|
1212
|
-
TelegramClient.prototype.reportStory = function(...args) {
|
|
1213
|
-
return updateProfile.reportStory(this._client, ...args);
|
|
1214
|
-
};
|
|
1215
1227
|
TelegramClient.prototype.sendStoryReaction = function(...args) {
|
|
1216
1228
|
return updateProfile.sendStoryReaction(this._client, ...args);
|
|
1217
1229
|
};
|
package/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import EventEmitter from "events";
|
|
2
2
|
import { tl } from "@mtcute/tl";
|
|
3
|
-
import { Reloadable, MtClient, UpdatesManager, TelegramStorageManager, BusinessCallbackQuery$2, DeleteBusinessMessageUpdate$2, BusinessMessage, BotReactionCountUpdate$2, BotReactionUpdate$2, DeleteStoryUpdate$2, StoryUpdate$2, PreCheckoutQuery$2, ChatJoinRequestUpdate$2, BotChatJoinRequestUpdate$2, BotStoppedUpdate$2, HistoryReadUpdate$1, DeleteMessageUpdate$1, UserTypingUpdate$1, UserStatusUpdate$2, PollVoteUpdate$2, PollUpdate$2, InlineCallbackQuery$2, CallbackQuery$2, ChosenInlineResult$2, InlineQuery$2, ChatMemberUpdate$2, Conversation } from "./chunks/es/
|
|
3
|
+
import { Reloadable, MtClient, UpdatesManager, TelegramStorageManager, BusinessCallbackQuery$2, DeleteBusinessMessageUpdate$2, BusinessMessage, BotReactionCountUpdate$2, BotReactionUpdate$2, DeleteStoryUpdate$2, StoryUpdate$2, PreCheckoutQuery$2, ChatJoinRequestUpdate$2, BotChatJoinRequestUpdate$2, BotStoppedUpdate$2, HistoryReadUpdate$1, DeleteMessageUpdate$1, UserTypingUpdate$1, UserStatusUpdate$2, PollVoteUpdate$2, PollUpdate$2, InlineCallbackQuery$2, CallbackQuery$2, ChosenInlineResult$2, InlineQuery$2, ChatMemberUpdate$2, Conversation } from "./chunks/es/DzOlHce2.js";
|
|
4
4
|
import { MtTypeAssertionError, MtArgumentError, MtUnsupportedError } from "./chunks/es/DBMBgE7t.js";
|
|
5
5
|
import { asyncResettable } from "./chunks/es/CO4G3ySK.js";
|
|
6
6
|
import { LogManager } from "./chunks/es/BRgz_-S8.js";
|
|
@@ -8,12 +8,12 @@ import { isTlRpcError } from "./chunks/es/BN3qj7tU.js";
|
|
|
8
8
|
import "@mtcute/tl-runtime";
|
|
9
9
|
import { tlJsonToJson, readStringSession, writeStringSession, computeSrpParams, computeNewPasswordHash } from "./chunks/es/hecWgeql.js";
|
|
10
10
|
import { setTimeoutWrap } from "./chunks/es/DY1E3mHM.js";
|
|
11
|
-
import { BusinessConnection$2, Message$2, getPeerDialogs, _normalizeInputFile, _normalizeInputMedia, uploadFile, getDiscussionMessage, getMessages, readHistory, sendMediaGroup, sendMedia, sendText, getBusinessConnection, resolvePeerMany, resolvePeer, resolveUser, resolveChannel } from "./chunks/es/
|
|
12
|
-
import { checkPassword, getPasswordHint, logOut, recoverPassword, resendCode, run, sendCode, sendRecoveryCode, signInBot, signInQr, signIn, startTest, start, isSelfPeer, answerCallbackQuery, answerInlineQuery, answerPreCheckoutQuery, deleteMyCommands, getBotInfo, getBotMenuButton, getCallbackAnswer, getGameHighScores, getInlineGameHighScores, getMyCommands, setBotInfo, setBotMenuButton, setGameScore, setInlineGameScore, setMyCommands, setMyDefaultRights, addChatMembers, archiveChats, banChatMember, createChannel, createGroup, createSupergroup, deleteChannel, deleteChatPhoto, deleteGroup, deleteHistory, deleteUserHistory, editAdminRights, getChatEventLog, getChatMember, getChatMembers, getChatPreview, getChat, getFullChat, getNearbyChats, getSimilarChannels, iterChatEventLog, iterChatMembers, joinChat, kickChatMember, leaveChat, markChatUnread, openChat, closeChat, reorderUsernames, restrictChatMember, saveDraft, setChatColor, setChatDefaultPermissions, setChatDescription, setChatPhoto, setChatTitle, setChatTtl, setChatUsername, setSlowMode, toggleContentProtection, toggleFragmentUsername, toggleJoinRequests, toggleJoinToSend, unarchiveChats, unbanChatMember, addContact, deleteContacts, getContacts, importContacts, createFolder, deleteFolder, editFolder, findDialogs, findFolder, getChatlistPreview, getFolders, iterDialogs, joinChatlist, setFoldersOrder, downloadAsBuffer, downloadAsIterable, downloadAsStream, uploadMedia, createForumTopic, deleteForumTopicHistory, editForumTopic, getForumTopicsById, getForumTopics, iterForumTopics, reorderPinnedForumTopics, toggleForumTopicClosed, toggleForumTopicPinned, toggleForum, toggleGeneralTopicHidden, createInviteLink, editInviteLink, exportInviteLink, getInviteLinkMembers, getInviteLink, getInviteLinks, getPrimaryInviteLink, hideAllJoinRequests, hideJoinRequest, iterInviteLinkMembers, iterInviteLinks, revokeInviteLink, closePoll, deleteMessagesById, deleteMessages, deleteScheduledMessages, editInlineMessage, editMessage, forwardMessagesById, forwardMessages, getAllScheduledMessages, getAvailableMessageEffects, getCallbackQueryMessage, getFactCheck, getHistory, getMessageByLink, getMessageGroup, getMessageReactionsById, getMessageReactions, getMessagesUnsafe, getReactionUsers, getReplyTo, getScheduledMessages, iterHistory, iterReactionUsers, iterSearchGlobal, iterSearchMessages, pinMessage, readReactions, searchGlobal, searchHashtag, iterSearchHashtag, searchMessages, answerText, answerMedia, answerMediaGroup, commentText, commentMedia, commentMediaGroup, sendCopyGroup, sendCopy, sendPaidReaction, quoteWithText, quoteWithMedia, quoteWithMediaGroup, sendReaction, replyText, replyMedia, replyMediaGroup, sendScheduled, sendTyping, sendVote, translateMessage, translateText, unpinAllMessages, unpinMessage, getCollectibleInfo, initTakeoutSession, _normalizePrivacyRules, changeCloudPassword, enableCloudPassword, verifyPasswordEmail, resendPasswordEmail, cancelPasswordEmail, removeCloudPassword, applyBoost, canApplyBoost, createBusinessChatLink, editBusinessChatLink, deleteBusinessChatLink, getBoostStats, getBoosts, getBusinessChatLinks, getMyBoostSlots, getStarsTransactions, iterBoosters, iterStarsTransactions, setBusinessIntro, setBusinessWorkHours, addStickerToSet, createStickerSet, deleteStickerFromSet, getCustomEmojis, getCustomEmojisFromMessages, getInstalledStickers, getMyStickerSets, getStickerSet, moveStickerInSet, replaceStickerInSet, setChatStickerSet, setStickerSetThumb, canSendStory, deleteStories, editStory, getAllStories, getPeerStories, getProfileStories, getStoriesById, getStoriesInteractions, getStoryLink, getStoryViewers, hideMyStoriesViews, incrementStoriesViews, iterAllStories, iterProfileStories, iterStoryViewers, readStories,
|
|
11
|
+
import { BusinessConnection$2, Message$2, getPeerDialogs, _normalizeInputFile, _normalizeInputMedia, uploadFile, getDiscussionMessage, getMessages, readHistory, sendMediaGroup, sendMedia, sendText, getBusinessConnection, resolvePeerMany, resolvePeer, resolveUser, resolveChannel } from "./chunks/es/DKzd1_Yg.js";
|
|
12
|
+
import { checkPassword, getPasswordHint, logOut, recoverPassword, resendCode, run, sendCode, sendRecoveryCode, signInBot, signInQr, signIn, startTest, start, isSelfPeer, answerCallbackQuery, answerInlineQuery, answerPreCheckoutQuery, deleteMyCommands, getBotInfo, getBotMenuButton, getCallbackAnswer, getGameHighScores, getInlineGameHighScores, getMyCommands, setBotInfo, setBotMenuButton, setGameScore, setInlineGameScore, setMyCommands, setMyDefaultRights, addChatMembers, archiveChats, banChatMember, createChannel, createGroup, createSupergroup, deleteChannel, deleteChatPhoto, deleteGroup, deleteHistory, deleteUserHistory, editAdminRights, getChatEventLog, getChatMember, getChatMembers, getChatPreview, getChat, getFullChat, getNearbyChats, getSimilarChannels, iterChatEventLog, iterChatMembers, joinChat, kickChatMember, leaveChat, markChatUnread, openChat, closeChat, reorderUsernames, restrictChatMember, saveDraft, setChatColor, setChatDefaultPermissions, setChatDescription, setChatPhoto, setChatTitle, setChatTtl, setChatUsername, setSlowMode, toggleContentProtection, toggleFragmentUsername, toggleJoinRequests, toggleJoinToSend, unarchiveChats, unbanChatMember, addContact, deleteContacts, getContacts, importContacts, createFolder, deleteFolder, editFolder, findDialogs, findFolder, getChatlistPreview, getFolders, iterDialogs, joinChatlist, setFoldersOrder, downloadAsBuffer, downloadAsIterable, downloadAsStream, uploadMedia, createForumTopic, deleteForumTopicHistory, editForumTopic, getForumTopicsById, getForumTopics, iterForumTopics, reorderPinnedForumTopics, toggleForumTopicClosed, toggleForumTopicPinned, toggleForum, toggleGeneralTopicHidden, createInviteLink, editInviteLink, exportInviteLink, getInviteLinkMembers, getInviteLink, getInviteLinks, getPrimaryInviteLink, hideAllJoinRequests, hideJoinRequest, iterInviteLinkMembers, iterInviteLinks, revokeInviteLink, closePoll, deleteMessagesById, deleteMessages, deleteScheduledMessages, editInlineMessage, editMessage, forwardMessagesById, forwardMessages, getAllScheduledMessages, getAvailableMessageEffects, getCallbackQueryMessage, getFactCheck, getHistory, getMessageByLink, getMessageGroup, getMessageReactionsById, getMessageReactions, getMessagesUnsafe, getReactionUsers, getReplyTo, getScheduledMessages, iterHistory, iterReactionUsers, iterSearchGlobal, iterSearchMessages, pinMessage, readReactions, searchGlobal, searchHashtag, iterSearchHashtag, searchMessages, answerText, answerMedia, answerMediaGroup, commentText, commentMedia, commentMediaGroup, sendCopyGroup, sendCopy, sendPaidReaction, quoteWithText, quoteWithMedia, quoteWithMediaGroup, sendReaction, replyText, replyMedia, replyMediaGroup, sendScheduled, sendTyping, sendVote, translateMessage, translateText, unpinAllMessages, unpinMessage, getCollectibleInfo, initTakeoutSession, _normalizePrivacyRules, changeCloudPassword, enableCloudPassword, verifyPasswordEmail, resendPasswordEmail, cancelPasswordEmail, removeCloudPassword, acceptStarGift, applyBoost, canApplyBoost, createBusinessChatLink, editBusinessChatLink, deleteBusinessChatLink, getBoostStats, getBoosts, getBusinessChatLinks, getMyBoostSlots, getStarGiftOptions, getStarGifts, getStarsTransactions, iterBoosters, iterStarGifts, iterStarsTransactions, sendStarGift, setBusinessIntro, setBusinessWorkHours, addStickerToSet, createStickerSet, deleteStickerFromSet, getCustomEmojis, getCustomEmojisFromMessages, getInstalledStickers, getMyStickerSets, getStickerSet, moveStickerInSet, replaceStickerInSet, setChatStickerSet, setStickerSetThumb, canSendStory, deleteStories, editStory, getAllStories, getPeerStories, getProfileStories, getStoriesById, getStoriesInteractions, getStoryLink, getStoryViewers, hideMyStoriesViews, incrementStoriesViews, iterAllStories, iterProfileStories, iterStoryViewers, readStories, sendStoryReaction, sendStory, togglePeerStoriesArchived, toggleStoriesPinned, blockUser, deleteProfilePhotos, editCloseFriendsRaw, editCloseFriends, getCommonChats, getGlobalTtl, getMe, getMyUsername, getProfilePhoto, getProfilePhotos, getUsers, isPeerAvailable, iterProfilePhotos, setGlobalTtl, setMyBirthday, setMyEmojiStatus, setMyProfilePhoto, setMyUsername, setOffline, unblockUser, updateProfile } from "./chunks/es/KKzIgirK.js";
|
|
13
13
|
function reportUnknownError(log, error, method) {
|
|
14
14
|
if (typeof fetch !== "function") return;
|
|
15
|
-
fetch(`https://rpc.
|
|
16
|
-
if (r.
|
|
15
|
+
fetch(`https://report-rpc-error.madelineproto.xyz/?code=${error.code}&method=${method}&error=${error.text}`).then((r) => r.json()).then((r) => {
|
|
16
|
+
if (r.result) {
|
|
17
17
|
log.info("telerpc responded with error info for %s: %s", error.text, r.result);
|
|
18
18
|
} else {
|
|
19
19
|
log.info(
|
|
@@ -1073,6 +1073,9 @@ TelegramClient.prototype.cancelPasswordEmail = function(...args) {
|
|
|
1073
1073
|
TelegramClient.prototype.removeCloudPassword = function(...args) {
|
|
1074
1074
|
return removeCloudPassword(this._client, ...args);
|
|
1075
1075
|
};
|
|
1076
|
+
TelegramClient.prototype.acceptStarGift = function(...args) {
|
|
1077
|
+
return acceptStarGift(this._client, ...args);
|
|
1078
|
+
};
|
|
1076
1079
|
TelegramClient.prototype.applyBoost = function(...args) {
|
|
1077
1080
|
return applyBoost(this._client, ...args);
|
|
1078
1081
|
};
|
|
@@ -1103,15 +1106,27 @@ TelegramClient.prototype.getBusinessConnection = function(...args) {
|
|
|
1103
1106
|
TelegramClient.prototype.getMyBoostSlots = function(...args) {
|
|
1104
1107
|
return getMyBoostSlots(this._client, ...args);
|
|
1105
1108
|
};
|
|
1109
|
+
TelegramClient.prototype.getStarGiftOptions = function(...args) {
|
|
1110
|
+
return getStarGiftOptions(this._client, ...args);
|
|
1111
|
+
};
|
|
1112
|
+
TelegramClient.prototype.getStarGifts = function(...args) {
|
|
1113
|
+
return getStarGifts(this._client, ...args);
|
|
1114
|
+
};
|
|
1106
1115
|
TelegramClient.prototype.getStarsTransactions = function(...args) {
|
|
1107
1116
|
return getStarsTransactions(this._client, ...args);
|
|
1108
1117
|
};
|
|
1109
1118
|
TelegramClient.prototype.iterBoosters = function(...args) {
|
|
1110
1119
|
return iterBoosters(this._client, ...args);
|
|
1111
1120
|
};
|
|
1121
|
+
TelegramClient.prototype.iterStarGifts = function(...args) {
|
|
1122
|
+
return iterStarGifts(this._client, ...args);
|
|
1123
|
+
};
|
|
1112
1124
|
TelegramClient.prototype.iterStarsTransactions = function(...args) {
|
|
1113
1125
|
return iterStarsTransactions(this._client, ...args);
|
|
1114
1126
|
};
|
|
1127
|
+
TelegramClient.prototype.sendStarGift = function(...args) {
|
|
1128
|
+
return sendStarGift(this._client, ...args);
|
|
1129
|
+
};
|
|
1115
1130
|
TelegramClient.prototype.setBusinessIntro = function(...args) {
|
|
1116
1131
|
return setBusinessIntro(this._client, ...args);
|
|
1117
1132
|
};
|
|
@@ -1202,9 +1217,6 @@ TelegramClient.prototype.iterStoryViewers = function(...args) {
|
|
|
1202
1217
|
TelegramClient.prototype.readStories = function(...args) {
|
|
1203
1218
|
return readStories(this._client, ...args);
|
|
1204
1219
|
};
|
|
1205
|
-
TelegramClient.prototype.reportStory = function(...args) {
|
|
1206
|
-
return reportStory(this._client, ...args);
|
|
1207
|
-
};
|
|
1208
1220
|
TelegramClient.prototype.sendStoryReaction = function(...args) {
|
|
1209
1221
|
return sendStoryReaction(this._client, ...args);
|
|
1210
1222
|
};
|
package/highlevel/client.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { RpcCallOptions } from '../network/index.js';
|
|
|
6
6
|
import { MaybeArray, MaybePromise, PartialExcept, PartialOnly } from '../types/index.js';
|
|
7
7
|
import { BaseTelegramClientOptions } from './base.js';
|
|
8
8
|
import { ITelegramClient } from './client.types.js';
|
|
9
|
-
import { AllStories, ArrayPaginated, ArrayWithTotal, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatMember, ChatMemberUpdate, ChatPreview, ChatlistPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputFileLike, InputInlineResult, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStickerSet, InputStickerSetItem, InputText, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, PeerReaction, PeerStories, PeersIndex, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SentCode, StarsStatus, StarsTransaction, Sticker, StickerSet,
|
|
9
|
+
import { AllStories, ArrayPaginated, ArrayWithTotal, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatMember, ChatMemberUpdate, ChatPreview, ChatlistPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputFileLike, InputInlineResult, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStickerSet, InputStickerSetItem, InputText, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, PeerReaction, PeerStories, PeersIndex, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SentCode, StarGift, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadFileLike, UploadedFile, User, UserStarGift, UserStatusUpdate, UserTypingUpdate } from './types/index.js';
|
|
10
10
|
import { StringSessionData } from './utils/string-session.js';
|
|
11
11
|
import { ITelegramStorageProvider } from './storage/provider.js';
|
|
12
12
|
import { ParsedUpdateHandlerParams } from './updates/parsed.js';
|
|
@@ -34,6 +34,7 @@ import { QuoteParamsFrom } from './methods/messages/send-quote.js';
|
|
|
34
34
|
import { sendText } from './methods/messages/send-text.js';
|
|
35
35
|
import { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
|
|
36
36
|
import { getBoosts } from './methods/premium/get-boosts.js';
|
|
37
|
+
import { getStarGifts } from './methods/premium/get-star-gifts.js';
|
|
37
38
|
import { getStarsTransactions } from './methods/premium/get-stars-transactions.js';
|
|
38
39
|
import { CanSendStoryResult } from './methods/stories/can-send-story.js';
|
|
39
40
|
import { getAllStories } from './methods/stories/get-all-stories.js';
|
|
@@ -2119,6 +2120,14 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
2119
2120
|
* the stream will be buffered in memory and the file size will be inferred from the buffer.
|
|
2120
2121
|
*/
|
|
2121
2122
|
requireFileSize?: boolean;
|
|
2123
|
+
/**
|
|
2124
|
+
* When using `inputMediaUploadedPhoto` (e.g. when sending an uploaded photo) require
|
|
2125
|
+
* the file extension to be known beforehand.
|
|
2126
|
+
*
|
|
2127
|
+
* This will make the library try to guess the file extension from the file mime type,
|
|
2128
|
+
* or throw an error if it cannot be guessed.
|
|
2129
|
+
*/
|
|
2130
|
+
requireExtension?: boolean;
|
|
2122
2131
|
}): Promise<UploadedFile>;
|
|
2123
2132
|
/**
|
|
2124
2133
|
* Upload a media to Telegram servers, without actually
|
|
@@ -3788,6 +3797,22 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3788
3797
|
* @param password 2FA password as plaintext
|
|
3789
3798
|
*/
|
|
3790
3799
|
removeCloudPassword(password: string): Promise<void>;
|
|
3800
|
+
/**
|
|
3801
|
+
* Accept, hide or convert a star gift.
|
|
3802
|
+
*
|
|
3803
|
+
* **Available**: 👤 users only
|
|
3804
|
+
*
|
|
3805
|
+
* @returns Whether the action was successful
|
|
3806
|
+
*/
|
|
3807
|
+
acceptStarGift(params: InputMessageId & {
|
|
3808
|
+
/**
|
|
3809
|
+
* Action to perform on the gift.
|
|
3810
|
+
* - `save` - save the gift to your profile
|
|
3811
|
+
* - `hide` - hide the gift from your profile
|
|
3812
|
+
* - `convert` - convert the gift to stars (can't be undone)
|
|
3813
|
+
*/
|
|
3814
|
+
action: 'save' | 'hide' | 'convert';
|
|
3815
|
+
}): Promise<boolean>;
|
|
3791
3816
|
/**
|
|
3792
3817
|
* Boost a given channel
|
|
3793
3818
|
*
|
|
@@ -3891,6 +3916,32 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3891
3916
|
*
|
|
3892
3917
|
*/
|
|
3893
3918
|
getMyBoostSlots(): Promise<BoostSlot[]>;
|
|
3919
|
+
/**
|
|
3920
|
+
* Get the list of available star gifts.
|
|
3921
|
+
* **Available**: 👤 users only
|
|
3922
|
+
*
|
|
3923
|
+
*/
|
|
3924
|
+
getStarGiftOptions(): Promise<StarGift[]>;
|
|
3925
|
+
/**
|
|
3926
|
+
* Get a list of gifts sent to a user.
|
|
3927
|
+
*
|
|
3928
|
+
* **Available**: 👤 users only
|
|
3929
|
+
*
|
|
3930
|
+
* @param userId User whose gifts to fetch
|
|
3931
|
+
* @returns Gifts sent to the user
|
|
3932
|
+
*/
|
|
3933
|
+
getStarGifts(userId: InputPeerLike, params?: {
|
|
3934
|
+
/**
|
|
3935
|
+
* Offset for pagination.
|
|
3936
|
+
*/
|
|
3937
|
+
offset?: string;
|
|
3938
|
+
/**
|
|
3939
|
+
* Maximum number of gifts to fetch.
|
|
3940
|
+
*
|
|
3941
|
+
* @default 100
|
|
3942
|
+
*/
|
|
3943
|
+
limit?: number;
|
|
3944
|
+
}): Promise<ArrayPaginated<UserStarGift, string>>;
|
|
3894
3945
|
/**
|
|
3895
3946
|
* Get Telegram Stars transactions for a given peer.
|
|
3896
3947
|
*
|
|
@@ -3946,6 +3997,31 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3946
3997
|
*/
|
|
3947
3998
|
chunkSize?: number;
|
|
3948
3999
|
}): AsyncIterableIterator<Boost>;
|
|
4000
|
+
/**
|
|
4001
|
+
* Iterate over gifts sent to a given user.
|
|
4002
|
+
*
|
|
4003
|
+
* Wrapper over {@link getStarGifts}
|
|
4004
|
+
*
|
|
4005
|
+
* **Available**: 👤 users only
|
|
4006
|
+
*
|
|
4007
|
+
* @param peerId Peer ID
|
|
4008
|
+
* @param params Additional parameters
|
|
4009
|
+
*/
|
|
4010
|
+
iterStarGifts(peerId: InputPeerLike, params?: Parameters<typeof getStarGifts>[2] & {
|
|
4011
|
+
/**
|
|
4012
|
+
* Total number of gifts to fetch
|
|
4013
|
+
*
|
|
4014
|
+
* @default Infinity, i.e. fetch all gifts
|
|
4015
|
+
*/
|
|
4016
|
+
limit?: number;
|
|
4017
|
+
/**
|
|
4018
|
+
* Number of gifts to fetch per request
|
|
4019
|
+
* Usually you don't need to change this
|
|
4020
|
+
*
|
|
4021
|
+
* @default 100
|
|
4022
|
+
*/
|
|
4023
|
+
chunkSize?: number;
|
|
4024
|
+
}): AsyncIterableIterator<UserStarGift>;
|
|
3949
4025
|
/**
|
|
3950
4026
|
* Iterate over Telegram Stars transactions for a given peer.
|
|
3951
4027
|
*
|
|
@@ -3974,6 +4050,37 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3974
4050
|
*/
|
|
3975
4051
|
chunkSize?: number;
|
|
3976
4052
|
}): AsyncIterableIterator<StarsTransaction>;
|
|
4053
|
+
/**
|
|
4054
|
+
* Send a star gift to a user.
|
|
4055
|
+
*
|
|
4056
|
+
* > **Note**: this method is not indended to be used by full-fledged clients,
|
|
4057
|
+
* > as this method hides the actual invoice and payment form from the user.
|
|
4058
|
+
* > For GUI clients, you should refer to the method's source code and
|
|
4059
|
+
* > present the payment form to the user.
|
|
4060
|
+
*
|
|
4061
|
+
* **Available**: 👤 users only
|
|
4062
|
+
*
|
|
4063
|
+
* @returns Service message about the sent gift
|
|
4064
|
+
*/
|
|
4065
|
+
sendStarGift(params: {
|
|
4066
|
+
/** ID of the user to send the gift to */
|
|
4067
|
+
userId: InputPeerLike;
|
|
4068
|
+
/** ID of the gift to send */
|
|
4069
|
+
gift: Long | StarGift;
|
|
4070
|
+
/**
|
|
4071
|
+
* Whether to send the gift anonymously
|
|
4072
|
+
* (i.e. if the recipient chooses to display the gift
|
|
4073
|
+
* on their profile, your name won't be visible)
|
|
4074
|
+
*/
|
|
4075
|
+
anonymous?: boolean;
|
|
4076
|
+
/** Message to send along with the gift */
|
|
4077
|
+
message?: InputText;
|
|
4078
|
+
/**
|
|
4079
|
+
* Whether to dispatch the new message event
|
|
4080
|
+
* to the client's update handler.
|
|
4081
|
+
*/
|
|
4082
|
+
shouldDispatch?: true;
|
|
4083
|
+
}): Promise<Message>;
|
|
3977
4084
|
/**
|
|
3978
4085
|
* Set current user's business introduction.
|
|
3979
4086
|
*
|
|
@@ -4067,12 +4174,6 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4067
4174
|
* @default `sticker`, i.e. regular stickers.
|
|
4068
4175
|
*/
|
|
4069
4176
|
type?: StickerType;
|
|
4070
|
-
/**
|
|
4071
|
-
* File source type for the stickers in this set.
|
|
4072
|
-
*
|
|
4073
|
-
* @default `static`, i.e. regular WEBP stickers.
|
|
4074
|
-
*/
|
|
4075
|
-
sourceType?: StickerSourceType;
|
|
4076
4177
|
/**
|
|
4077
4178
|
* Whether to create "adaptive" emoji set.
|
|
4078
4179
|
*
|
|
@@ -4505,23 +4606,6 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4505
4606
|
* @returns IDs of the stores that were marked as read
|
|
4506
4607
|
*/
|
|
4507
4608
|
readStories(peerId: InputPeerLike, maxId: number): Promise<number[]>;
|
|
4508
|
-
/**
|
|
4509
|
-
* Report a story (or multiple stories) to the moderation team
|
|
4510
|
-
* **Available**: 👤 users only
|
|
4511
|
-
*
|
|
4512
|
-
*/
|
|
4513
|
-
reportStory(peerId: InputPeerLike, storyIds: MaybeArray<number>, params?: {
|
|
4514
|
-
/**
|
|
4515
|
-
* Reason for reporting
|
|
4516
|
-
*
|
|
4517
|
-
* @default inputReportReasonSpam
|
|
4518
|
-
*/
|
|
4519
|
-
reason?: tl.TypeReportReason;
|
|
4520
|
-
/**
|
|
4521
|
-
* Additional comment to the report
|
|
4522
|
-
*/
|
|
4523
|
-
message?: string;
|
|
4524
|
-
}): Promise<void>;
|
|
4525
4609
|
/**
|
|
4526
4610
|
* Send (or remove) a reaction to a story
|
|
4527
4611
|
* **Available**: 👤 users only
|
|
@@ -61,4 +61,12 @@ export declare function uploadFile(client: ITelegramClient, params: {
|
|
|
61
61
|
* the stream will be buffered in memory and the file size will be inferred from the buffer.
|
|
62
62
|
*/
|
|
63
63
|
requireFileSize?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* When using `inputMediaUploadedPhoto` (e.g. when sending an uploaded photo) require
|
|
66
|
+
* the file extension to be known beforehand.
|
|
67
|
+
*
|
|
68
|
+
* This will make the library try to guess the file extension from the file mime type,
|
|
69
|
+
* or throw an error if it cannot be guessed.
|
|
70
|
+
*/
|
|
71
|
+
requireExtension?: boolean;
|
|
64
72
|
}): Promise<UploadedFile>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputMessageId } from '../../types/messages/input-message-id.js';
|
|
3
|
+
/**
|
|
4
|
+
* Accept, hide or convert a star gift.
|
|
5
|
+
*
|
|
6
|
+
* @returns Whether the action was successful
|
|
7
|
+
*/
|
|
8
|
+
export declare function acceptStarGift(client: ITelegramClient, params: InputMessageId & {
|
|
9
|
+
/**
|
|
10
|
+
* Action to perform on the gift.
|
|
11
|
+
* - `save` - save the gift to your profile
|
|
12
|
+
* - `hide` - hide the gift from your profile
|
|
13
|
+
* - `convert` - convert the gift to stars (can't be undone)
|
|
14
|
+
*/
|
|
15
|
+
action: 'save' | 'hide' | 'convert';
|
|
16
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike } from '../../types/peers/peer.js';
|
|
3
|
+
import { UserStarGift } from '../../types/premium/stars-gift.js';
|
|
4
|
+
import { ArrayPaginated } from '../../types/utils.js';
|
|
5
|
+
/**
|
|
6
|
+
* Get a list of gifts sent to a user.
|
|
7
|
+
*
|
|
8
|
+
* @param userId User whose gifts to fetch
|
|
9
|
+
* @returns Gifts sent to the user
|
|
10
|
+
*/
|
|
11
|
+
export declare function getStarGifts(client: ITelegramClient, userId: InputPeerLike, params?: {
|
|
12
|
+
/**
|
|
13
|
+
* Offset for pagination.
|
|
14
|
+
*/
|
|
15
|
+
offset?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Maximum number of gifts to fetch.
|
|
18
|
+
*
|
|
19
|
+
* @default 100
|
|
20
|
+
*/
|
|
21
|
+
limit?: number;
|
|
22
|
+
}): Promise<ArrayPaginated<UserStarGift, string>>;
|