@mtcute/core 0.23.1 → 0.23.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/client.cjs +12 -0
- package/client.js +12 -0
- package/highlevel/client.d.cts +44 -5
- package/highlevel/client.d.ts +44 -5
- package/highlevel/methods/chats/get-chat-event-log.cjs +5 -3
- package/highlevel/methods/chats/get-chat-event-log.js +3 -1
- package/highlevel/methods/premium/_normalize-input-star-gift.cjs +6 -0
- package/highlevel/methods/premium/_normalize-input-star-gift.js +6 -0
- package/highlevel/methods/premium/buy-resale-gift.cjs +30 -0
- package/highlevel/methods/premium/buy-resale-gift.d.cts +13 -0
- package/highlevel/methods/premium/buy-resale-gift.d.ts +13 -0
- package/highlevel/methods/premium/buy-resale-gift.js +25 -0
- package/highlevel/methods/premium/get-resale-star-gifts.cjs +107 -0
- package/highlevel/methods/premium/get-resale-star-gifts.d.cts +45 -0
- package/highlevel/methods/premium/get-resale-star-gifts.d.ts +45 -0
- package/highlevel/methods/premium/get-resale-star-gifts.js +102 -0
- package/highlevel/methods/premium/get-unique-star-gift.cjs +1 -1
- package/highlevel/methods/premium/get-unique-star-gift.js +1 -1
- package/highlevel/methods/premium/set-gift-resale-price.cjs +19 -0
- package/highlevel/methods/premium/set-gift-resale-price.d.cts +9 -0
- package/highlevel/methods/premium/set-gift-resale-price.d.ts +9 -0
- package/highlevel/methods/premium/set-gift-resale-price.js +14 -0
- package/highlevel/methods/premium/transfer-star-gift.cjs +26 -11
- package/highlevel/methods/premium/transfer-star-gift.js +26 -11
- package/highlevel/methods/premium/upgrade-star-gift.cjs +26 -11
- package/highlevel/methods/premium/upgrade-star-gift.js +26 -11
- package/highlevel/methods.d.cts +4 -0
- package/highlevel/methods.d.ts +4 -0
- package/highlevel/types/messages/message-action.cjs +8 -2
- package/highlevel/types/messages/message-action.d.cts +6 -0
- package/highlevel/types/messages/message-action.d.ts +6 -0
- package/highlevel/types/messages/message-action.js +8 -2
- package/highlevel/types/peers/chat-event/actions.cjs +49 -1
- package/highlevel/types/peers/chat-event/actions.d.cts +60 -2
- package/highlevel/types/peers/chat-event/actions.d.ts +60 -2
- package/highlevel/types/peers/chat-event/actions.js +49 -1
- package/highlevel/types/peers/chat-event/filters.cjs +9 -0
- package/highlevel/types/peers/chat-event/filters.js +9 -0
- package/highlevel/types/peers/chat-event/index.cjs +3 -2
- package/highlevel/types/peers/chat-event/index.d.cts +2 -1
- package/highlevel/types/peers/chat-event/index.d.ts +2 -1
- package/highlevel/types/peers/chat-event/index.js +3 -2
- package/highlevel/types/peers/chat.cjs +5 -4
- package/highlevel/types/peers/chat.d.cts +2 -0
- package/highlevel/types/peers/chat.d.ts +2 -0
- package/highlevel/types/peers/chat.js +5 -4
- package/highlevel/types/peers/user.cjs +1 -4
- package/highlevel/types/peers/user.js +1 -4
- package/highlevel/types/premium/saved-star-gift.cjs +8 -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 +8 -0
- package/highlevel/types/premium/stars-gift-unique.cjs +11 -1
- package/highlevel/types/premium/stars-gift-unique.d.cts +4 -0
- package/highlevel/types/premium/stars-gift-unique.d.ts +4 -0
- package/highlevel/types/premium/stars-gift-unique.js +11 -1
- package/highlevel/types/premium/stars-gift.cjs +11 -1
- package/highlevel/types/premium/stars-gift.d.cts +8 -1
- package/highlevel/types/premium/stars-gift.d.ts +8 -1
- package/highlevel/types/premium/stars-gift.js +11 -1
- 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/reactions/emoji-status.cjs +6 -0
- package/highlevel/types/reactions/emoji-status.d.cts +1 -0
- package/highlevel/types/reactions/emoji-status.d.ts +1 -0
- package/highlevel/types/reactions/emoji-status.js +6 -0
- package/highlevel/types/utils.d.cts +4 -0
- package/highlevel/types/utils.d.ts +4 -0
- package/highlevel/utils/misc-utils.cjs +8 -0
- package/highlevel/utils/misc-utils.d.cts +2 -1
- package/highlevel/utils/misc-utils.d.ts +2 -1
- package/highlevel/utils/misc-utils.js +8 -0
- package/methods.cjs +6 -0
- package/methods.js +6 -0
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/network/session-connection.cjs +10 -5
- package/network/session-connection.js +10 -5
- package/package.json +2 -2
- package/utils/binary/compat.cjs +9 -0
- package/utils/binary/compat.js +9 -0
- package/utils.cjs +1 -0
- package/utils.js +2 -1
package/client.cjs
CHANGED
|
@@ -191,6 +191,7 @@ const removeCloudPassword = require("./highlevel/methods/password/remove-cloud-p
|
|
|
191
191
|
const _normalizeInputStarGift = require("./highlevel/methods/premium/_normalize-input-star-gift.cjs");
|
|
192
192
|
const acceptStarGift = require("./highlevel/methods/premium/accept-star-gift.cjs");
|
|
193
193
|
const applyBoost = require("./highlevel/methods/premium/apply-boost.cjs");
|
|
194
|
+
const buyResaleGift = require("./highlevel/methods/premium/buy-resale-gift.cjs");
|
|
194
195
|
const canApplyBoost = require("./highlevel/methods/premium/can-apply-boost.cjs");
|
|
195
196
|
const createBusinessChatLink = require("./highlevel/methods/premium/create-business-chat-link.cjs");
|
|
196
197
|
const editBusinessChatLink = require("./highlevel/methods/premium/edit-business-chat-link.cjs");
|
|
@@ -199,6 +200,7 @@ const getBoosts = require("./highlevel/methods/premium/get-boosts.cjs");
|
|
|
199
200
|
const getBusinessChatLinks = require("./highlevel/methods/premium/get-business-chat-links.cjs");
|
|
200
201
|
const getBusinessConnection = require("./highlevel/methods/premium/get-business-connection.cjs");
|
|
201
202
|
const getMyBoostSlots = require("./highlevel/methods/premium/get-my-boost-slots.cjs");
|
|
203
|
+
const getResaleStarGifts = require("./highlevel/methods/premium/get-resale-star-gifts.cjs");
|
|
202
204
|
const getSavedStarGiftsById = require("./highlevel/methods/premium/get-saved-star-gifts-by-id.cjs");
|
|
203
205
|
const getSavedStarGifts = require("./highlevel/methods/premium/get-saved-star-gifts.cjs");
|
|
204
206
|
const getStarGiftOptions = require("./highlevel/methods/premium/get-star-gift-options.cjs");
|
|
@@ -212,6 +214,7 @@ const pinStarGift = require("./highlevel/methods/premium/pin-star-gift.cjs");
|
|
|
212
214
|
const sendStarGift = require("./highlevel/methods/premium/send-star-gift.cjs");
|
|
213
215
|
const setBusinessIntro = require("./highlevel/methods/premium/set-business-intro.cjs");
|
|
214
216
|
const setBusinessWorkHours = require("./highlevel/methods/premium/set-business-work-hours.cjs");
|
|
217
|
+
const setGiftResalePrice = require("./highlevel/methods/premium/set-gift-resale-price.cjs");
|
|
215
218
|
const transferStarGift = require("./highlevel/methods/premium/transfer-star-gift.cjs");
|
|
216
219
|
const upgradeStarGift = require("./highlevel/methods/premium/upgrade-star-gift.cjs");
|
|
217
220
|
const addStickerToSet = require("./highlevel/methods/stickers/add-sticker-to-set.cjs");
|
|
@@ -1036,6 +1039,9 @@ TelegramClient.prototype.acceptStarGift = function(...args) {
|
|
|
1036
1039
|
TelegramClient.prototype.applyBoost = function(...args) {
|
|
1037
1040
|
return applyBoost.applyBoost(this._client, ...args);
|
|
1038
1041
|
};
|
|
1042
|
+
TelegramClient.prototype.buyResaleGift = function(...args) {
|
|
1043
|
+
return buyResaleGift.buyResaleGift(this._client, ...args);
|
|
1044
|
+
};
|
|
1039
1045
|
TelegramClient.prototype.canApplyBoost = function(...args) {
|
|
1040
1046
|
return canApplyBoost.canApplyBoost(this._client, ...args);
|
|
1041
1047
|
};
|
|
@@ -1063,6 +1069,9 @@ TelegramClient.prototype.getBusinessConnection = function(...args) {
|
|
|
1063
1069
|
TelegramClient.prototype.getMyBoostSlots = function(...args) {
|
|
1064
1070
|
return getMyBoostSlots.getMyBoostSlots(this._client, ...args);
|
|
1065
1071
|
};
|
|
1072
|
+
TelegramClient.prototype.getResaleOptions = function(...args) {
|
|
1073
|
+
return getResaleStarGifts.getResaleOptions(this._client, ...args);
|
|
1074
|
+
};
|
|
1066
1075
|
TelegramClient.prototype.getSavedStarGiftsById = function(...args) {
|
|
1067
1076
|
return getSavedStarGiftsById.getSavedStarGiftsById(this._client, ...args);
|
|
1068
1077
|
};
|
|
@@ -1102,6 +1111,9 @@ TelegramClient.prototype.setBusinessIntro = function(...args) {
|
|
|
1102
1111
|
TelegramClient.prototype.setBusinessWorkHours = function(...args) {
|
|
1103
1112
|
return setBusinessWorkHours.setBusinessWorkHours(this._client, ...args);
|
|
1104
1113
|
};
|
|
1114
|
+
TelegramClient.prototype.setResaleStarGiftPrice = function(...args) {
|
|
1115
|
+
return setGiftResalePrice.setResaleStarGiftPrice(this._client, ...args);
|
|
1116
|
+
};
|
|
1105
1117
|
TelegramClient.prototype.transferStarGift = function(...args) {
|
|
1106
1118
|
return transferStarGift.transferStarGift(this._client, ...args);
|
|
1107
1119
|
};
|
package/client.js
CHANGED
|
@@ -184,6 +184,7 @@ import { removeCloudPassword } from "./highlevel/methods/password/remove-cloud-p
|
|
|
184
184
|
import { _normalizeInputStarGift } from "./highlevel/methods/premium/_normalize-input-star-gift.js";
|
|
185
185
|
import { acceptStarGift } from "./highlevel/methods/premium/accept-star-gift.js";
|
|
186
186
|
import { applyBoost } from "./highlevel/methods/premium/apply-boost.js";
|
|
187
|
+
import { buyResaleGift } from "./highlevel/methods/premium/buy-resale-gift.js";
|
|
187
188
|
import { canApplyBoost } from "./highlevel/methods/premium/can-apply-boost.js";
|
|
188
189
|
import { createBusinessChatLink } from "./highlevel/methods/premium/create-business-chat-link.js";
|
|
189
190
|
import { editBusinessChatLink, deleteBusinessChatLink } from "./highlevel/methods/premium/edit-business-chat-link.js";
|
|
@@ -192,6 +193,7 @@ import { getBoosts } from "./highlevel/methods/premium/get-boosts.js";
|
|
|
192
193
|
import { getBusinessChatLinks } from "./highlevel/methods/premium/get-business-chat-links.js";
|
|
193
194
|
import { getBusinessConnection } from "./highlevel/methods/premium/get-business-connection.js";
|
|
194
195
|
import { getMyBoostSlots } from "./highlevel/methods/premium/get-my-boost-slots.js";
|
|
196
|
+
import { getResaleOptions } from "./highlevel/methods/premium/get-resale-star-gifts.js";
|
|
195
197
|
import { getSavedStarGiftsById } from "./highlevel/methods/premium/get-saved-star-gifts-by-id.js";
|
|
196
198
|
import { getSavedStarGifts } from "./highlevel/methods/premium/get-saved-star-gifts.js";
|
|
197
199
|
import { getStarGiftOptions } from "./highlevel/methods/premium/get-star-gift-options.js";
|
|
@@ -205,6 +207,7 @@ import { togglePinnedStarGifts } from "./highlevel/methods/premium/pin-star-gift
|
|
|
205
207
|
import { sendStarGift } from "./highlevel/methods/premium/send-star-gift.js";
|
|
206
208
|
import { setBusinessIntro } from "./highlevel/methods/premium/set-business-intro.js";
|
|
207
209
|
import { setBusinessWorkHours } from "./highlevel/methods/premium/set-business-work-hours.js";
|
|
210
|
+
import { setResaleStarGiftPrice } from "./highlevel/methods/premium/set-gift-resale-price.js";
|
|
208
211
|
import { transferStarGift } from "./highlevel/methods/premium/transfer-star-gift.js";
|
|
209
212
|
import { upgradeStarGift } from "./highlevel/methods/premium/upgrade-star-gift.js";
|
|
210
213
|
import { addStickerToSet } from "./highlevel/methods/stickers/add-sticker-to-set.js";
|
|
@@ -1029,6 +1032,9 @@ TelegramClient.prototype.acceptStarGift = function(...args) {
|
|
|
1029
1032
|
TelegramClient.prototype.applyBoost = function(...args) {
|
|
1030
1033
|
return applyBoost(this._client, ...args);
|
|
1031
1034
|
};
|
|
1035
|
+
TelegramClient.prototype.buyResaleGift = function(...args) {
|
|
1036
|
+
return buyResaleGift(this._client, ...args);
|
|
1037
|
+
};
|
|
1032
1038
|
TelegramClient.prototype.canApplyBoost = function(...args) {
|
|
1033
1039
|
return canApplyBoost(this._client, ...args);
|
|
1034
1040
|
};
|
|
@@ -1056,6 +1062,9 @@ TelegramClient.prototype.getBusinessConnection = function(...args) {
|
|
|
1056
1062
|
TelegramClient.prototype.getMyBoostSlots = function(...args) {
|
|
1057
1063
|
return getMyBoostSlots(this._client, ...args);
|
|
1058
1064
|
};
|
|
1065
|
+
TelegramClient.prototype.getResaleOptions = function(...args) {
|
|
1066
|
+
return getResaleOptions(this._client, ...args);
|
|
1067
|
+
};
|
|
1059
1068
|
TelegramClient.prototype.getSavedStarGiftsById = function(...args) {
|
|
1060
1069
|
return getSavedStarGiftsById(this._client, ...args);
|
|
1061
1070
|
};
|
|
@@ -1095,6 +1104,9 @@ TelegramClient.prototype.setBusinessIntro = function(...args) {
|
|
|
1095
1104
|
TelegramClient.prototype.setBusinessWorkHours = function(...args) {
|
|
1096
1105
|
return setBusinessWorkHours(this._client, ...args);
|
|
1097
1106
|
};
|
|
1107
|
+
TelegramClient.prototype.setResaleStarGiftPrice = function(...args) {
|
|
1108
|
+
return setResaleStarGiftPrice(this._client, ...args);
|
|
1109
|
+
};
|
|
1098
1110
|
TelegramClient.prototype.transferStarGift = function(...args) {
|
|
1099
1111
|
return transferStarGift(this._client, ...args);
|
|
1100
1112
|
};
|
package/highlevel/client.d.cts
CHANGED
|
@@ -21,9 +21,10 @@ import { SendCopyGroupParams } from './methods/messages/send-copy-group.js';
|
|
|
21
21
|
import { SendCopyParams } from './methods/messages/send-copy.js';
|
|
22
22
|
import { QuoteParamsFrom } from './methods/messages/send-quote.js';
|
|
23
23
|
import { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
|
|
24
|
+
import { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/premium/get-resale-star-gifts.js';
|
|
24
25
|
import { CanSendStoryResult } from './methods/stories/can-send-story.js';
|
|
25
26
|
import { ITelegramStorageProvider } from './storage/provider.js';
|
|
26
|
-
import { AllStories, ArrayPaginated, ArrayWithTotal, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatlistPreview, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, FullUser, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputFileLike, InputInlineResult, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStarGift, InputStickerSet, InputStickerSetItem, InputText, InputWebview, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, Peer, PeerReaction, PeerSettings, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SavedStarGift, SentCode, StarGift, StarGiftUnique, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate, WebPageMedia, WebviewResult } from './types/index.js';
|
|
27
|
+
import { AllStories, ArrayPaginated, ArrayPaginatedWithMeta, ArrayWithTotal, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatlistPreview, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, FullUser, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputFileLike, InputInlineResult, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStarGift, InputStickerSet, InputStickerSetItem, InputText, InputWebview, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, Peer, PeerReaction, PeerSettings, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SavedStarGift, SentCode, StarGift, StarGiftUnique, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate, WebPageMedia, WebviewResult } from './types/index.js';
|
|
27
28
|
import { ParsedUpdateHandlerParams } from './updates/parsed.js';
|
|
28
29
|
import { RawUpdateInfo } from './updates/types.js';
|
|
29
30
|
import { InputStringSessionData } from './utils/string-session.js';
|
|
@@ -3864,6 +3865,17 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3864
3865
|
* @param peerId Peer ID to boost
|
|
3865
3866
|
*/
|
|
3866
3867
|
applyBoost(peerId: InputPeerLike): Promise<void>;
|
|
3868
|
+
buyResaleGift(params: {
|
|
3869
|
+
/** Slug of the star gift to buy */
|
|
3870
|
+
slug: string;
|
|
3871
|
+
/** ID of the user to buy the gift for */
|
|
3872
|
+
recipient: InputPeerLike;
|
|
3873
|
+
/**
|
|
3874
|
+
* Whether to dispatch the new message event
|
|
3875
|
+
* to the client's update handler.
|
|
3876
|
+
*/
|
|
3877
|
+
shouldDispatch?: true;
|
|
3878
|
+
}): Promise<Message | null>;
|
|
3867
3879
|
/**
|
|
3868
3880
|
* Check if the current user can apply boost to some channel
|
|
3869
3881
|
*
|
|
@@ -3959,6 +3971,30 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3959
3971
|
*
|
|
3960
3972
|
*/
|
|
3961
3973
|
getMyBoostSlots(): Promise<BoostSlot[]>;
|
|
3974
|
+
/**
|
|
3975
|
+
* Get a list of star gifts up for resale
|
|
3976
|
+
*/
|
|
3977
|
+
getResaleOptions(params: {
|
|
3978
|
+
/** ID of the gift to get resale options for */
|
|
3979
|
+
giftId: tl.Long;
|
|
3980
|
+
/**
|
|
3981
|
+
* Sorting attribute
|
|
3982
|
+
*
|
|
3983
|
+
* - `price`: Sort by price
|
|
3984
|
+
* - `num`: Sort by its unique number
|
|
3985
|
+
*/
|
|
3986
|
+
sort?: 'price' | 'num';
|
|
3987
|
+
/**
|
|
3988
|
+
* Hash of the `attributes` field, as returned by the server in the first response
|
|
3989
|
+
*/
|
|
3990
|
+
attributesHash?: Long;
|
|
3991
|
+
/** Attributes to filter for */
|
|
3992
|
+
attributes?: tl.TypeStarGiftAttributeId[] | InputStarGiftAttributeIds;
|
|
3993
|
+
/** Offset for pagination */
|
|
3994
|
+
offset?: string;
|
|
3995
|
+
/** Limit for pagination */
|
|
3996
|
+
limit?: number;
|
|
3997
|
+
}): Promise<ArrayPaginatedWithMeta<StarGiftUnique, string, ResaleStarGiftsMeta>>;
|
|
3962
3998
|
/** Get one or more saved star gifts by their IDs */
|
|
3963
3999
|
getSavedStarGiftsById(gifts: MaybeArray<InputStarGift>): Promise<SavedStarGift[]>;
|
|
3964
4000
|
/**
|
|
@@ -4189,6 +4225,13 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4189
4225
|
/** Business work intervals, raw intervals */
|
|
4190
4226
|
intervals: tl.TypeBusinessWeeklyOpen[];
|
|
4191
4227
|
})) | null): Promise<void>;
|
|
4228
|
+
/** Set resale price for an owned star gift */
|
|
4229
|
+
setResaleStarGiftPrice(params: {
|
|
4230
|
+
/** Star gift to update the price of */
|
|
4231
|
+
gift: InputStarGift;
|
|
4232
|
+
/** New price of the gift (in stars), or `null` to unlist */
|
|
4233
|
+
price: number | null;
|
|
4234
|
+
}): Promise<void>;
|
|
4192
4235
|
/**
|
|
4193
4236
|
* Transfer a unique star gift.
|
|
4194
4237
|
*
|
|
@@ -4197,8 +4240,6 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4197
4240
|
* > For GUI clients, you should refer to the method's source code and
|
|
4198
4241
|
* > present the payment form to the user.
|
|
4199
4242
|
*
|
|
4200
|
-
* **Available**: 👤 users only
|
|
4201
|
-
*
|
|
4202
4243
|
* @returns Service message about the transferred gift, if one was generated.
|
|
4203
4244
|
*/
|
|
4204
4245
|
transferStarGift(params: {
|
|
@@ -4220,8 +4261,6 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4220
4261
|
* > For GUI clients, you should refer to the method's source code and
|
|
4221
4262
|
* > present the payment form to the user.
|
|
4222
4263
|
*
|
|
4223
|
-
* **Available**: 👤 users only
|
|
4224
|
-
*
|
|
4225
4264
|
* @returns Service message about the upgraded gift, if one was generated.
|
|
4226
4265
|
*/
|
|
4227
4266
|
upgradeStarGift(params: {
|
package/highlevel/client.d.ts
CHANGED
|
@@ -21,9 +21,10 @@ import { SendCopyGroupParams } from './methods/messages/send-copy-group.js';
|
|
|
21
21
|
import { SendCopyParams } from './methods/messages/send-copy.js';
|
|
22
22
|
import { QuoteParamsFrom } from './methods/messages/send-quote.js';
|
|
23
23
|
import { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
|
|
24
|
+
import { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/premium/get-resale-star-gifts.js';
|
|
24
25
|
import { CanSendStoryResult } from './methods/stories/can-send-story.js';
|
|
25
26
|
import { ITelegramStorageProvider } from './storage/provider.js';
|
|
26
|
-
import { AllStories, ArrayPaginated, ArrayWithTotal, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatlistPreview, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, FullUser, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputFileLike, InputInlineResult, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStarGift, InputStickerSet, InputStickerSetItem, InputText, InputWebview, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, Peer, PeerReaction, PeerSettings, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SavedStarGift, SentCode, StarGift, StarGiftUnique, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate, WebPageMedia, WebviewResult } from './types/index.js';
|
|
27
|
+
import { AllStories, ArrayPaginated, ArrayPaginatedWithMeta, ArrayWithTotal, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatlistPreview, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, FullUser, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputFileLike, InputInlineResult, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStarGift, InputStickerSet, InputStickerSetItem, InputText, InputWebview, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, Peer, PeerReaction, PeerSettings, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SavedStarGift, SentCode, StarGift, StarGiftUnique, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate, WebPageMedia, WebviewResult } from './types/index.js';
|
|
27
28
|
import { ParsedUpdateHandlerParams } from './updates/parsed.js';
|
|
28
29
|
import { RawUpdateInfo } from './updates/types.js';
|
|
29
30
|
import { InputStringSessionData } from './utils/string-session.js';
|
|
@@ -3864,6 +3865,17 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3864
3865
|
* @param peerId Peer ID to boost
|
|
3865
3866
|
*/
|
|
3866
3867
|
applyBoost(peerId: InputPeerLike): Promise<void>;
|
|
3868
|
+
buyResaleGift(params: {
|
|
3869
|
+
/** Slug of the star gift to buy */
|
|
3870
|
+
slug: string;
|
|
3871
|
+
/** ID of the user to buy the gift for */
|
|
3872
|
+
recipient: InputPeerLike;
|
|
3873
|
+
/**
|
|
3874
|
+
* Whether to dispatch the new message event
|
|
3875
|
+
* to the client's update handler.
|
|
3876
|
+
*/
|
|
3877
|
+
shouldDispatch?: true;
|
|
3878
|
+
}): Promise<Message | null>;
|
|
3867
3879
|
/**
|
|
3868
3880
|
* Check if the current user can apply boost to some channel
|
|
3869
3881
|
*
|
|
@@ -3959,6 +3971,30 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3959
3971
|
*
|
|
3960
3972
|
*/
|
|
3961
3973
|
getMyBoostSlots(): Promise<BoostSlot[]>;
|
|
3974
|
+
/**
|
|
3975
|
+
* Get a list of star gifts up for resale
|
|
3976
|
+
*/
|
|
3977
|
+
getResaleOptions(params: {
|
|
3978
|
+
/** ID of the gift to get resale options for */
|
|
3979
|
+
giftId: tl.Long;
|
|
3980
|
+
/**
|
|
3981
|
+
* Sorting attribute
|
|
3982
|
+
*
|
|
3983
|
+
* - `price`: Sort by price
|
|
3984
|
+
* - `num`: Sort by its unique number
|
|
3985
|
+
*/
|
|
3986
|
+
sort?: 'price' | 'num';
|
|
3987
|
+
/**
|
|
3988
|
+
* Hash of the `attributes` field, as returned by the server in the first response
|
|
3989
|
+
*/
|
|
3990
|
+
attributesHash?: Long;
|
|
3991
|
+
/** Attributes to filter for */
|
|
3992
|
+
attributes?: tl.TypeStarGiftAttributeId[] | InputStarGiftAttributeIds;
|
|
3993
|
+
/** Offset for pagination */
|
|
3994
|
+
offset?: string;
|
|
3995
|
+
/** Limit for pagination */
|
|
3996
|
+
limit?: number;
|
|
3997
|
+
}): Promise<ArrayPaginatedWithMeta<StarGiftUnique, string, ResaleStarGiftsMeta>>;
|
|
3962
3998
|
/** Get one or more saved star gifts by their IDs */
|
|
3963
3999
|
getSavedStarGiftsById(gifts: MaybeArray<InputStarGift>): Promise<SavedStarGift[]>;
|
|
3964
4000
|
/**
|
|
@@ -4189,6 +4225,13 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4189
4225
|
/** Business work intervals, raw intervals */
|
|
4190
4226
|
intervals: tl.TypeBusinessWeeklyOpen[];
|
|
4191
4227
|
})) | null): Promise<void>;
|
|
4228
|
+
/** Set resale price for an owned star gift */
|
|
4229
|
+
setResaleStarGiftPrice(params: {
|
|
4230
|
+
/** Star gift to update the price of */
|
|
4231
|
+
gift: InputStarGift;
|
|
4232
|
+
/** New price of the gift (in stars), or `null` to unlist */
|
|
4233
|
+
price: number | null;
|
|
4234
|
+
}): Promise<void>;
|
|
4192
4235
|
/**
|
|
4193
4236
|
* Transfer a unique star gift.
|
|
4194
4237
|
*
|
|
@@ -4197,8 +4240,6 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4197
4240
|
* > For GUI clients, you should refer to the method's source code and
|
|
4198
4241
|
* > present the payment form to the user.
|
|
4199
4242
|
*
|
|
4200
|
-
* **Available**: 👤 users only
|
|
4201
|
-
*
|
|
4202
4243
|
* @returns Service message about the transferred gift, if one was generated.
|
|
4203
4244
|
*/
|
|
4204
4245
|
transferStarGift(params: {
|
|
@@ -4220,8 +4261,6 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4220
4261
|
* > For GUI clients, you should refer to the method's source code and
|
|
4221
4262
|
* > present the payment form to the user.
|
|
4222
4263
|
*
|
|
4223
|
-
* **Available**: 👤 users only
|
|
4224
|
-
*
|
|
4225
4264
|
* @returns Service message about the upgraded gift, if one was generated.
|
|
4226
4265
|
*/
|
|
4227
4266
|
upgradeStarGift(params: {
|
|
@@ -6,8 +6,9 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
8
|
const Long = require("long");
|
|
9
|
+
const peerUtils = require("../../../utils/peer-utils.cjs");
|
|
9
10
|
const filters = require("../../types/peers/chat-event/filters.cjs");
|
|
10
|
-
const peerUtils = require("../../utils/peer-utils.cjs");
|
|
11
|
+
const peerUtils$1 = require("../../utils/peer-utils.cjs");
|
|
11
12
|
const resolvePeerMany = require("../users/resolve-peer-many.cjs");
|
|
12
13
|
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
13
14
|
const index = require("../../types/peers/chat-event/index.cjs");
|
|
@@ -15,7 +16,7 @@ const peersIndex = require("../../types/peers/peers-index.cjs");
|
|
|
15
16
|
async function getChatEventLog(client, chatId, params) {
|
|
16
17
|
const { maxId = Long.ZERO, minId = Long.ZERO, query = "", limit = 100, users, filters: filters$1 } = params ?? {};
|
|
17
18
|
const channel = await resolvePeer.resolveChannel(client, chatId);
|
|
18
|
-
const admins = users ? await resolvePeerMany.resolvePeerMany(client, users, peerUtils.toInputUser) : void 0;
|
|
19
|
+
const admins = users ? await resolvePeerMany.resolvePeerMany(client, users, peerUtils$1.toInputUser) : void 0;
|
|
19
20
|
const { serverFilter, localFilter } = filters.normalizeChatEventFilters(filters$1);
|
|
20
21
|
const res = await client.call({
|
|
21
22
|
_: "channels.getAdminLog",
|
|
@@ -30,8 +31,9 @@ async function getChatEventLog(client, chatId, params) {
|
|
|
30
31
|
if (!res.events.length) return [];
|
|
31
32
|
const peers = peersIndex.PeersIndex.from(res);
|
|
32
33
|
const results = [];
|
|
34
|
+
const chatIdNum = peerUtils.toggleChannelIdMark(peerUtils.getMarkedPeerId(channel));
|
|
33
35
|
for (const evt of res.events) {
|
|
34
|
-
const parsed = new index.ChatEvent(evt, peers);
|
|
36
|
+
const parsed = new index.ChatEvent(evt, peers, chatIdNum);
|
|
35
37
|
if (localFilter && (!parsed.action || !localFilter[parsed.action.type])) {
|
|
36
38
|
continue;
|
|
37
39
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Long from "long";
|
|
2
|
+
import { toggleChannelIdMark, getMarkedPeerId } from "../../../utils/peer-utils.js";
|
|
2
3
|
import { normalizeChatEventFilters } from "../../types/peers/chat-event/filters.js";
|
|
3
4
|
import { toInputUser } from "../../utils/peer-utils.js";
|
|
4
5
|
import { resolvePeerMany } from "../users/resolve-peer-many.js";
|
|
@@ -23,8 +24,9 @@ async function getChatEventLog(client, chatId, params) {
|
|
|
23
24
|
if (!res.events.length) return [];
|
|
24
25
|
const peers = PeersIndex.from(res);
|
|
25
26
|
const results = [];
|
|
27
|
+
const chatIdNum = toggleChannelIdMark(getMarkedPeerId(channel));
|
|
26
28
|
for (const evt of res.events) {
|
|
27
|
-
const parsed = new ChatEvent$2(evt, peers);
|
|
29
|
+
const parsed = new ChatEvent$2(evt, peers, chatIdNum);
|
|
28
30
|
if (localFilter && (!parsed.action || !localFilter[parsed.action.type])) {
|
|
29
31
|
continue;
|
|
30
32
|
}
|
|
@@ -7,6 +7,12 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
8
|
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
9
9
|
async function _normalizeInputStarGift(client, gift) {
|
|
10
|
+
if (typeof gift === "string") {
|
|
11
|
+
return {
|
|
12
|
+
_: "inputSavedStarGiftSlug",
|
|
13
|
+
slug: gift
|
|
14
|
+
};
|
|
15
|
+
}
|
|
10
16
|
if ("message" in gift) {
|
|
11
17
|
return {
|
|
12
18
|
_: "inputSavedStarGiftUser",
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { resolvePeer } from "../users/resolve-peer.js";
|
|
2
2
|
async function _normalizeInputStarGift(client, gift) {
|
|
3
|
+
if (typeof gift === "string") {
|
|
4
|
+
return {
|
|
5
|
+
_: "inputSavedStarGiftSlug",
|
|
6
|
+
slug: gift
|
|
7
|
+
};
|
|
8
|
+
}
|
|
3
9
|
if ("message" in gift) {
|
|
4
10
|
return {
|
|
5
11
|
_: "inputSavedStarGiftUser",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS support is deprecated and will be removed in 0.25.0. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const typeAssertions = require("../../../utils/type-assertions.cjs");
|
|
9
|
+
const findInUpdate = require("../messages/find-in-update.cjs");
|
|
10
|
+
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
11
|
+
async function buyResaleGift(client, params) {
|
|
12
|
+
const { slug, recipient, shouldDispatch } = params;
|
|
13
|
+
const invoice = {
|
|
14
|
+
_: "inputInvoiceStarGiftResale",
|
|
15
|
+
slug,
|
|
16
|
+
toId: await resolvePeer.resolvePeer(client, recipient)
|
|
17
|
+
};
|
|
18
|
+
const form = await client.call({
|
|
19
|
+
_: "payments.getPaymentForm",
|
|
20
|
+
invoice
|
|
21
|
+
});
|
|
22
|
+
const res = await client.call({
|
|
23
|
+
_: "payments.sendStarsForm",
|
|
24
|
+
invoice,
|
|
25
|
+
formId: form.formId
|
|
26
|
+
});
|
|
27
|
+
typeAssertions.assertTypeIs("payments.sendStarsForm", res, "payments.paymentResult");
|
|
28
|
+
return findInUpdate._findMessageInUpdate(client, res.updates, false, !shouldDispatch, true);
|
|
29
|
+
}
|
|
30
|
+
exports.buyResaleGift = buyResaleGift;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike, Message } from '../../types/index.js';
|
|
3
|
+
export declare function buyResaleGift(client: ITelegramClient, params: {
|
|
4
|
+
/** Slug of the star gift to buy */
|
|
5
|
+
slug: string;
|
|
6
|
+
/** ID of the user to buy the gift for */
|
|
7
|
+
recipient: InputPeerLike;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to dispatch the new message event
|
|
10
|
+
* to the client's update handler.
|
|
11
|
+
*/
|
|
12
|
+
shouldDispatch?: true;
|
|
13
|
+
}): Promise<Message | null>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike, Message } from '../../types/index.js';
|
|
3
|
+
export declare function buyResaleGift(client: ITelegramClient, params: {
|
|
4
|
+
/** Slug of the star gift to buy */
|
|
5
|
+
slug: string;
|
|
6
|
+
/** ID of the user to buy the gift for */
|
|
7
|
+
recipient: InputPeerLike;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to dispatch the new message event
|
|
10
|
+
* to the client's update handler.
|
|
11
|
+
*/
|
|
12
|
+
shouldDispatch?: true;
|
|
13
|
+
}): Promise<Message | null>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { assertTypeIs } from "../../../utils/type-assertions.js";
|
|
2
|
+
import { _findMessageInUpdate } from "../messages/find-in-update.js";
|
|
3
|
+
import { resolvePeer } from "../users/resolve-peer.js";
|
|
4
|
+
async function buyResaleGift(client, params) {
|
|
5
|
+
const { slug, recipient, shouldDispatch } = params;
|
|
6
|
+
const invoice = {
|
|
7
|
+
_: "inputInvoiceStarGiftResale",
|
|
8
|
+
slug,
|
|
9
|
+
toId: await resolvePeer(client, recipient)
|
|
10
|
+
};
|
|
11
|
+
const form = await client.call({
|
|
12
|
+
_: "payments.getPaymentForm",
|
|
13
|
+
invoice
|
|
14
|
+
});
|
|
15
|
+
const res = await client.call({
|
|
16
|
+
_: "payments.sendStarsForm",
|
|
17
|
+
invoice,
|
|
18
|
+
formId: form.formId
|
|
19
|
+
});
|
|
20
|
+
assertTypeIs("payments.sendStarsForm", res, "payments.paymentResult");
|
|
21
|
+
return _findMessageInUpdate(client, res.updates, false, !shouldDispatch, true);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
buyResaleGift
|
|
25
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS support is deprecated and will be removed in 0.25.0. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const utils = require("@fuman/utils");
|
|
9
|
+
const Long = require("long");
|
|
10
|
+
const longUtils = require("../../../utils/long-utils.cjs");
|
|
11
|
+
const miscUtils = require("../../utils/misc-utils.cjs");
|
|
12
|
+
const starsGiftUnique = require("../../types/premium/stars-gift-unique.cjs");
|
|
13
|
+
const peersIndex = require("../../types/peers/peers-index.cjs");
|
|
14
|
+
function _normalizeResaleAttributes(attrs) {
|
|
15
|
+
if (Array.isArray(attrs)) {
|
|
16
|
+
return attrs;
|
|
17
|
+
}
|
|
18
|
+
const res = [];
|
|
19
|
+
if (attrs.model) {
|
|
20
|
+
if (Array.isArray(attrs.model)) {
|
|
21
|
+
for (const id of attrs.model) {
|
|
22
|
+
res.push({
|
|
23
|
+
_: "starGiftAttributeIdModel",
|
|
24
|
+
documentId: id
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
res.push({
|
|
29
|
+
_: "starGiftAttributeIdModel",
|
|
30
|
+
documentId: attrs.model
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (attrs.pattern) {
|
|
35
|
+
if (Array.isArray(attrs.pattern)) {
|
|
36
|
+
for (const id of attrs.pattern) {
|
|
37
|
+
res.push({
|
|
38
|
+
_: "starGiftAttributeIdPattern",
|
|
39
|
+
documentId: id
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
res.push({
|
|
44
|
+
_: "starGiftAttributeIdPattern",
|
|
45
|
+
documentId: attrs.pattern
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (attrs.backdrop) {
|
|
50
|
+
if (Array.isArray(attrs.backdrop)) {
|
|
51
|
+
for (const id of attrs.backdrop) {
|
|
52
|
+
res.push({
|
|
53
|
+
_: "starGiftAttributeIdBackdrop",
|
|
54
|
+
backdropId: id
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
res.push({
|
|
59
|
+
_: "starGiftAttributeIdBackdrop",
|
|
60
|
+
backdropId: attrs.backdrop
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return res;
|
|
65
|
+
}
|
|
66
|
+
async function getResaleOptions(client, params) {
|
|
67
|
+
const res = await client.call({
|
|
68
|
+
_: "payments.getResaleStarGifts",
|
|
69
|
+
sortByNum: params.sort === "num",
|
|
70
|
+
sortByPrice: params.sort === "price",
|
|
71
|
+
attributesHash: params.attributesHash,
|
|
72
|
+
giftId: params.giftId,
|
|
73
|
+
attributes: params.attributes ? _normalizeResaleAttributes(params.attributes) : void 0,
|
|
74
|
+
offset: params.offset ?? "",
|
|
75
|
+
limit: params.limit ?? 100
|
|
76
|
+
});
|
|
77
|
+
const peers = peersIndex.PeersIndex.from(res);
|
|
78
|
+
const attributes = {
|
|
79
|
+
model: new longUtils.LongMap(),
|
|
80
|
+
pattern: new longUtils.LongMap(),
|
|
81
|
+
backdrop: /* @__PURE__ */ new Map()
|
|
82
|
+
};
|
|
83
|
+
for (const attr of res.attributes ?? []) {
|
|
84
|
+
if (attr._ === "starGiftAttributeModel") {
|
|
85
|
+
attributes.model.set(attr.document.id, new starsGiftUnique.StarGiftUniqueAttribute(attr));
|
|
86
|
+
} else if (attr._ === "starGiftAttributePattern") {
|
|
87
|
+
attributes.pattern.set(attr.document.id, new starsGiftUnique.StarGiftUniqueAttribute(attr));
|
|
88
|
+
} else if (attr._ === "starGiftAttributeBackdrop") {
|
|
89
|
+
attributes.backdrop.set(attr.backdropId, new starsGiftUnique.StarGiftUniqueBackdrop(attr));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return miscUtils.makeArrayPaginatedWithMeta(
|
|
93
|
+
res.gifts.map((it) => {
|
|
94
|
+
utils.assert(it._ === "starGiftUnique");
|
|
95
|
+
return new starsGiftUnique.StarGiftUnique(it, peers);
|
|
96
|
+
}),
|
|
97
|
+
res.count,
|
|
98
|
+
{
|
|
99
|
+
attributes,
|
|
100
|
+
attributesHash: res.attributesHash ?? params.attributesHash ?? Long.ZERO,
|
|
101
|
+
counters: res.counters ?? []
|
|
102
|
+
},
|
|
103
|
+
res.nextOffset
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
exports._normalizeResaleAttributes = _normalizeResaleAttributes;
|
|
107
|
+
exports.getResaleOptions = getResaleOptions;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
3
|
+
import { ArrayPaginatedWithMeta, StarGiftUnique, StarGiftUniqueAttribute, StarGiftUniqueBackdrop } from '../../types/index.js';
|
|
4
|
+
import { MaybeArray } from '@fuman/utils';
|
|
5
|
+
import { default as Long } from 'long';
|
|
6
|
+
import { LongMap } from '../../../utils/long-utils.js';
|
|
7
|
+
export interface InputStarGiftAttributeIds {
|
|
8
|
+
model?: MaybeArray<Long>;
|
|
9
|
+
pattern?: MaybeArray<Long>;
|
|
10
|
+
backdrop?: MaybeArray<number>;
|
|
11
|
+
}
|
|
12
|
+
export declare function _normalizeResaleAttributes(attrs: tl.TypeStarGiftAttributeId[] | InputStarGiftAttributeIds): tl.TypeStarGiftAttributeId[];
|
|
13
|
+
export interface ResaleStarGiftsMeta {
|
|
14
|
+
attributes: {
|
|
15
|
+
model: LongMap<StarGiftUniqueAttribute>;
|
|
16
|
+
pattern: LongMap<StarGiftUniqueAttribute>;
|
|
17
|
+
backdrop: Map<number, StarGiftUniqueBackdrop>;
|
|
18
|
+
};
|
|
19
|
+
attributesHash: tl.Long;
|
|
20
|
+
counters: tl.RawStarGiftAttributeCounter[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get a list of star gifts up for resale
|
|
24
|
+
*/
|
|
25
|
+
export declare function getResaleOptions(client: ITelegramClient, params: {
|
|
26
|
+
/** ID of the gift to get resale options for */
|
|
27
|
+
giftId: tl.Long;
|
|
28
|
+
/**
|
|
29
|
+
* Sorting attribute
|
|
30
|
+
*
|
|
31
|
+
* - `price`: Sort by price
|
|
32
|
+
* - `num`: Sort by its unique number
|
|
33
|
+
*/
|
|
34
|
+
sort?: 'price' | 'num';
|
|
35
|
+
/**
|
|
36
|
+
* Hash of the `attributes` field, as returned by the server in the first response
|
|
37
|
+
*/
|
|
38
|
+
attributesHash?: Long;
|
|
39
|
+
/** Attributes to filter for */
|
|
40
|
+
attributes?: tl.TypeStarGiftAttributeId[] | InputStarGiftAttributeIds;
|
|
41
|
+
/** Offset for pagination */
|
|
42
|
+
offset?: string;
|
|
43
|
+
/** Limit for pagination */
|
|
44
|
+
limit?: number;
|
|
45
|
+
}): Promise<ArrayPaginatedWithMeta<StarGiftUnique, string, ResaleStarGiftsMeta>>;
|