@mtcute/core 0.25.7 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.cjs +20 -11
- package/client.js +23 -14
- package/highlevel/client.d.cts +80 -64
- package/highlevel/client.d.ts +80 -64
- package/highlevel/methods/files/normalize-input-media.cjs +13 -4
- package/highlevel/methods/files/normalize-input-media.js +13 -4
- package/highlevel/methods/forums/toggle-forum.cjs +0 -10
- package/highlevel/methods/forums/toggle-forum.d.cts +0 -10
- package/highlevel/methods/forums/toggle-forum.d.ts +0 -10
- package/highlevel/methods/forums/toggle-forum.js +0 -10
- package/highlevel/methods/premium/buy-resale-gift.cjs +3 -2
- package/highlevel/methods/premium/buy-resale-gift.d.cts +2 -0
- package/highlevel/methods/premium/buy-resale-gift.d.ts +2 -0
- package/highlevel/methods/premium/buy-resale-gift.js +3 -2
- package/highlevel/methods/premium/get-resale-star-gifts.cjs +2 -2
- package/highlevel/methods/premium/get-resale-star-gifts.d.cts +1 -1
- package/highlevel/methods/premium/get-resale-star-gifts.d.ts +1 -1
- package/highlevel/methods/premium/get-resale-star-gifts.js +2 -2
- package/highlevel/methods/premium/get-saved-star-gifts.cjs +2 -1
- package/highlevel/methods/premium/get-saved-star-gifts.d.cts +4 -2
- package/highlevel/methods/premium/get-saved-star-gifts.d.ts +4 -2
- package/highlevel/methods/premium/get-saved-star-gifts.js +2 -1
- package/highlevel/methods/{auth/run.cjs → premium/get-star-gift-value.cjs} +8 -5
- package/highlevel/methods/premium/get-star-gift-value.d.cts +9 -0
- package/highlevel/methods/premium/get-star-gift-value.d.ts +9 -0
- package/highlevel/methods/premium/get-star-gift-value.js +11 -0
- package/highlevel/methods/premium/get-stars-transactions.cjs +3 -2
- package/highlevel/methods/premium/get-stars-transactions.d.cts +2 -0
- package/highlevel/methods/premium/get-stars-transactions.d.ts +2 -0
- package/highlevel/methods/premium/get-stars-transactions.js +3 -2
- package/highlevel/methods/premium/iter-saved-star-gifts.cjs +15 -10
- package/highlevel/methods/premium/iter-saved-star-gifts.d.cts +13 -19
- package/highlevel/methods/premium/iter-saved-star-gifts.d.ts +13 -19
- package/highlevel/methods/premium/iter-saved-star-gifts.js +15 -10
- package/highlevel/methods/premium/prepay-star-gift-upgrade.cjs +30 -0
- package/highlevel/methods/premium/prepay-star-gift-upgrade.d.cts +23 -0
- package/highlevel/methods/premium/prepay-star-gift-upgrade.d.ts +23 -0
- package/highlevel/methods/premium/prepay-star-gift-upgrade.js +25 -0
- package/highlevel/methods/stickers/delete-sticker-from-set.d.cts +2 -4
- package/highlevel/methods/stickers/delete-sticker-from-set.d.ts +2 -4
- package/highlevel/methods/stickers/move-sticker-in-set.d.cts +2 -4
- package/highlevel/methods/stickers/move-sticker-in-set.d.ts +2 -4
- package/highlevel/methods/stickers/replace-sticker-in-set.d.cts +2 -4
- package/highlevel/methods/stickers/replace-sticker-in-set.d.ts +2 -4
- package/highlevel/methods/users/get-saved-music.cjs +38 -0
- package/highlevel/methods/users/get-saved-music.d.cts +13 -0
- package/highlevel/methods/users/get-saved-music.d.ts +13 -0
- package/highlevel/methods/users/get-saved-music.js +33 -0
- package/highlevel/methods/users/save-music-to-profile.cjs +57 -0
- package/highlevel/methods/users/save-music-to-profile.d.cts +19 -0
- package/highlevel/methods/users/save-music-to-profile.d.ts +19 -0
- package/highlevel/methods/users/save-music-to-profile.js +52 -0
- package/highlevel/methods/users/set-emoji-status.cjs +0 -8
- package/highlevel/methods/users/set-emoji-status.d.cts +0 -11
- package/highlevel/methods/users/set-emoji-status.d.ts +0 -11
- package/highlevel/methods/users/set-emoji-status.js +1 -9
- package/highlevel/methods.d.cts +6 -4
- package/highlevel/methods.d.ts +6 -4
- package/highlevel/types/files/utils.d.cts +7 -0
- package/highlevel/types/files/utils.d.ts +7 -0
- package/highlevel/types/media/document.d.cts +1 -1
- package/highlevel/types/media/document.d.ts +1 -1
- package/highlevel/types/messages/message-action.cjs +43 -21
- package/highlevel/types/messages/message-action.d.cts +58 -17
- package/highlevel/types/messages/message-action.d.ts +58 -17
- package/highlevel/types/messages/message-action.js +43 -21
- package/highlevel/types/peers/chat.cjs +5 -1
- package/highlevel/types/peers/chat.d.cts +5 -1
- package/highlevel/types/peers/chat.d.ts +5 -1
- package/highlevel/types/peers/chat.js +5 -1
- package/highlevel/types/peers/full-chat.cjs +4 -0
- package/highlevel/types/peers/full-chat.d.cts +2 -0
- package/highlevel/types/peers/full-chat.d.ts +2 -0
- package/highlevel/types/peers/full-chat.js +4 -0
- package/highlevel/types/peers/full-user.cjs +10 -1
- package/highlevel/types/peers/full-user.d.cts +3 -0
- package/highlevel/types/peers/full-user.d.ts +3 -0
- package/highlevel/types/peers/full-user.js +10 -1
- package/highlevel/types/premium/index.d.cts +1 -0
- package/highlevel/types/premium/index.d.ts +1 -0
- package/highlevel/types/premium/saved-star-gift.cjs +6 -0
- package/highlevel/types/premium/saved-star-gift.d.cts +4 -0
- package/highlevel/types/premium/saved-star-gift.d.ts +4 -0
- package/highlevel/types/premium/saved-star-gift.js +6 -0
- package/highlevel/types/premium/star-gift-value.cjs +65 -0
- package/highlevel/types/premium/star-gift-value.d.cts +41 -0
- package/highlevel/types/premium/star-gift-value.d.ts +41 -0
- package/highlevel/types/premium/star-gift-value.js +60 -0
- package/highlevel/types/premium/stars-gift-unique.cjs +10 -3
- package/highlevel/types/premium/stars-gift-unique.d.cts +1 -1
- package/highlevel/types/premium/stars-gift-unique.d.ts +1 -1
- package/highlevel/types/premium/stars-gift-unique.js +10 -3
- package/highlevel/types/premium/stars-transaction.cjs +9 -0
- package/highlevel/types/premium/stars-transaction.d.cts +10 -0
- package/highlevel/types/premium/stars-transaction.d.ts +10 -0
- package/highlevel/types/premium/stars-transaction.js +9 -0
- package/index.cjs +2 -0
- package/index.js +2 -0
- package/methods.cjs +10 -5
- package/methods.js +13 -8
- package/network/mtproto-session.cjs +1 -0
- package/network/mtproto-session.d.cts +1 -0
- package/network/mtproto-session.d.ts +1 -0
- package/network/mtproto-session.js +1 -0
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/network/session-connection.cjs +27 -10
- package/network/session-connection.d.cts +1 -0
- package/network/session-connection.d.ts +1 -0
- package/network/session-connection.js +27 -10
- package/package.json +2 -2
- package/utils/binary/compat.cjs +35 -4
- package/utils/binary/compat.js +35 -4
- package/utils/binary/serialization.d.cts +3 -3
- package/utils/binary/serialization.d.ts +3 -3
- package/highlevel/methods/auth/run.d.cts +0 -16
- package/highlevel/methods/auth/run.d.ts +0 -16
- package/highlevel/methods/auth/run.js +0 -8
package/highlevel/client.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { tdFileId } from '@mtcute/file-id';
|
|
2
1
|
import { tl } from '@mtcute/tl';
|
|
3
2
|
import { default as Long } from 'long';
|
|
4
3
|
import { RpcCallOptions } from '../network/index.js';
|
|
@@ -25,12 +24,11 @@ import { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
|
|
|
25
24
|
import { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/premium/get-resale-star-gifts.js';
|
|
26
25
|
import { CanSendStoryResult } from './methods/stories/can-send-story.js';
|
|
27
26
|
import { ITelegramStorageProvider } from './storage/provider.js';
|
|
28
|
-
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
|
+
import { AllStories, ArrayPaginated, ArrayPaginatedWithMeta, ArrayWithTotal, Audio, 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, InputDocumentId, InputFileLike, InputInlineResult, InputMediaAudio, 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, StarGiftValue, 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';
|
|
29
28
|
import { ParsedUpdateHandlerParams } from './updates/parsed.js';
|
|
30
29
|
import { RawUpdateInfo } from './updates/types.js';
|
|
31
30
|
import { InputStringSessionData } from './utils/string-session.js';
|
|
32
31
|
import { Emitter } from '@fuman/utils';
|
|
33
|
-
import { start } from './methods/auth/start.js';
|
|
34
32
|
import { getChatEventLog } from './methods/chats/get-chat-event-log.js';
|
|
35
33
|
import { getChatMembers } from './methods/chats/get-chat-members.js';
|
|
36
34
|
import { getInviteLinkMembers } from './methods/invite-links/get-invite-link-members.js';
|
|
@@ -38,6 +36,7 @@ import { sendMediaGroup } from './methods/messages/send-media-group.js';
|
|
|
38
36
|
import { sendMedia } from './methods/messages/send-media.js';
|
|
39
37
|
import { sendText } from './methods/messages/send-text.js';
|
|
40
38
|
import { getBoosts } from './methods/premium/get-boosts.js';
|
|
39
|
+
import { getSavedStarGifts } from './methods/premium/get-saved-star-gifts.js';
|
|
41
40
|
import { getStarsTransactions } from './methods/premium/get-stars-transactions.js';
|
|
42
41
|
import { getAllStories } from './methods/stories/get-all-stories.js';
|
|
43
42
|
import { getProfileStories } from './methods/stories/get-profile-stories.js';
|
|
@@ -203,21 +202,6 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
203
202
|
/** Abort signal */
|
|
204
203
|
abortSignal?: AbortSignal;
|
|
205
204
|
}): Promise<SentCode>;
|
|
206
|
-
/**
|
|
207
|
-
* Simple wrapper that calls {@link start} and then
|
|
208
|
-
* provided callback function (if any) without the
|
|
209
|
-
* need to introduce a `main()` function manually.
|
|
210
|
-
*
|
|
211
|
-
* Errors that were encountered while calling {@link start}
|
|
212
|
-
* and `then` will be emitted as usual, and can be caught with {@link onError}
|
|
213
|
-
*
|
|
214
|
-
* **Available**: ✅ both users and bots
|
|
215
|
-
*
|
|
216
|
-
* @param params Parameters to be passed to {@link start}
|
|
217
|
-
* @param then Function to be called after {@link start} returns
|
|
218
|
-
* @deprecated This method provides no real value over {@link start}, please use it instead
|
|
219
|
-
*/
|
|
220
|
-
run(params: Parameters<typeof start>[1], then?: (user: User) => void | Promise<void>): void;
|
|
221
205
|
/**
|
|
222
206
|
* Send the confirmation code to the given phone number
|
|
223
207
|
*
|
|
@@ -2328,18 +2312,6 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
2328
2312
|
/** Whether the topic should be pinned */
|
|
2329
2313
|
pinned: boolean;
|
|
2330
2314
|
}): Promise<void>;
|
|
2331
|
-
/**
|
|
2332
|
-
* Set whether a supergroup is a forum.
|
|
2333
|
-
*
|
|
2334
|
-
* Only owner of the supergroup can change this setting.
|
|
2335
|
-
*
|
|
2336
|
-
* **Available**: 👤 users only
|
|
2337
|
-
*
|
|
2338
|
-
* @param chatId Chat ID or username
|
|
2339
|
-
* @param [enabled=false] Whether the supergroup should be a forum
|
|
2340
|
-
* @deprecated Use {@link updateForumSettings} instead
|
|
2341
|
-
*/
|
|
2342
|
-
toggleForum(chatId: InputPeerLike, enabled?: boolean): Promise<void>;
|
|
2343
2315
|
/**
|
|
2344
2316
|
* Update forum settings of a supergroup.
|
|
2345
2317
|
*
|
|
@@ -3947,6 +3919,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3947
3919
|
* to the client's update handler.
|
|
3948
3920
|
*/
|
|
3949
3921
|
shouldDispatch?: true;
|
|
3922
|
+
/** Whether to use TON currency for payment */
|
|
3923
|
+
ton?: boolean;
|
|
3950
3924
|
}): Promise<Message | null>;
|
|
3951
3925
|
/**
|
|
3952
3926
|
* Check if the current user can apply boost to some channel
|
|
@@ -4048,7 +4022,7 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4048
4022
|
* **Available**: ✅ both users and bots
|
|
4049
4023
|
*
|
|
4050
4024
|
*/
|
|
4051
|
-
|
|
4025
|
+
getStarGiftResaleOptions(params: {
|
|
4052
4026
|
/** ID of the gift to get resale options for */
|
|
4053
4027
|
giftId: tl.Long;
|
|
4054
4028
|
/**
|
|
@@ -4087,10 +4061,12 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4087
4061
|
excludePublic?: boolean;
|
|
4088
4062
|
/** Whether to exclude gifts with unlimited availability */
|
|
4089
4063
|
excludeUnlimited?: boolean;
|
|
4090
|
-
/** Whether to exclude gifts with limited availability */
|
|
4091
|
-
excludeLimited?: boolean;
|
|
4092
4064
|
/** Whether to exclude unique gifts */
|
|
4093
4065
|
excludeUnique?: boolean;
|
|
4066
|
+
/** Whether to exclude gifts that cannot be upgraded (either not limited or already upgraded) */
|
|
4067
|
+
excludeUnupgradable?: boolean;
|
|
4068
|
+
/** Whether to exclude gifts that can be upgraded */
|
|
4069
|
+
excludeUpgradable?: boolean;
|
|
4094
4070
|
/** ID of the collection to get gifts from */
|
|
4095
4071
|
collectionId?: number;
|
|
4096
4072
|
/** Whether to sort by value */
|
|
@@ -4106,6 +4082,13 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4106
4082
|
*
|
|
4107
4083
|
*/
|
|
4108
4084
|
getStarGiftOptions(): Promise<StarGift[]>;
|
|
4085
|
+
/**
|
|
4086
|
+
* Get the value of a unique star gift
|
|
4087
|
+
*/
|
|
4088
|
+
getStarGiftValue(params: {
|
|
4089
|
+
/** Slug of the star gift */
|
|
4090
|
+
slug: string;
|
|
4091
|
+
}): Promise<StarGiftValue>;
|
|
4109
4092
|
getStarGiftWithdrawalUrl(params: {
|
|
4110
4093
|
/** The star gift to withdraw */
|
|
4111
4094
|
gift: InputStarGift;
|
|
@@ -4138,6 +4121,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4138
4121
|
subscriptionId?: string;
|
|
4139
4122
|
/** Pagination offset */
|
|
4140
4123
|
offset?: string;
|
|
4124
|
+
/** Whether to return transactions made in TON */
|
|
4125
|
+
ton?: boolean;
|
|
4141
4126
|
/**
|
|
4142
4127
|
* Pagination limit
|
|
4143
4128
|
*
|
|
@@ -4179,24 +4164,18 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4179
4164
|
* **Available**: ✅ both users and bots
|
|
4180
4165
|
*
|
|
4181
4166
|
*/
|
|
4182
|
-
iterSavedStarGifts(params: {
|
|
4183
|
-
/**
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
/**
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
excludeUnique?: boolean;
|
|
4195
|
-
/** Whether to sort by value */
|
|
4196
|
-
sortByValue?: boolean;
|
|
4197
|
-
/** Offset for pagination */
|
|
4198
|
-
offset?: string;
|
|
4199
|
-
/** Limit for pagination */
|
|
4167
|
+
iterSavedStarGifts(params: Parameters<typeof getSavedStarGifts>[1] & {
|
|
4168
|
+
/**
|
|
4169
|
+
* Number of gifts to fetch per request
|
|
4170
|
+
*
|
|
4171
|
+
* @default 100
|
|
4172
|
+
*/
|
|
4173
|
+
chunkSize?: number;
|
|
4174
|
+
/**
|
|
4175
|
+
* Total number of gifts to fetch
|
|
4176
|
+
*
|
|
4177
|
+
* @default Infinity
|
|
4178
|
+
*/
|
|
4200
4179
|
limit?: number;
|
|
4201
4180
|
}): AsyncIterableIterator<SavedStarGift>;
|
|
4202
4181
|
/**
|
|
@@ -4238,6 +4217,28 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4238
4217
|
/** Peer where the gift is sent */
|
|
4239
4218
|
peer: InputPeerLike;
|
|
4240
4219
|
}): Promise<void>;
|
|
4220
|
+
/**
|
|
4221
|
+
* Pay for other user's star gift upgrade.
|
|
4222
|
+
*
|
|
4223
|
+
* > **Note**: this method is not indended to be used by full-fledged clients,
|
|
4224
|
+
* > as this method hides the actual invoice and payment form from the user.
|
|
4225
|
+
* > For GUI clients, you should refer to the method's source code and
|
|
4226
|
+
* > present the payment form to the user.
|
|
4227
|
+
*
|
|
4228
|
+
* **Available**: 👤 users only
|
|
4229
|
+
*
|
|
4230
|
+
* @returns Service message about the payment for the upgrade, if one was generated.
|
|
4231
|
+
*/
|
|
4232
|
+
prepayStarGiftUpgrade(params: {
|
|
4233
|
+
peer: InputPeerLike;
|
|
4234
|
+
/** Prepaid upgrade hash, taken from `SavedStarGift.prepaidUpgradeHash` */
|
|
4235
|
+
hash: string;
|
|
4236
|
+
/**
|
|
4237
|
+
* Whether to dispatch the new message event
|
|
4238
|
+
* to the client's update handler.
|
|
4239
|
+
*/
|
|
4240
|
+
shouldDispatch?: true;
|
|
4241
|
+
}): Promise<Message | null>;
|
|
4241
4242
|
/**
|
|
4242
4243
|
* Send a star gift to a user.
|
|
4243
4244
|
*
|
|
@@ -4465,7 +4466,7 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4465
4466
|
* TL object representing a sticker to be removed
|
|
4466
4467
|
* @returns Modfiied sticker set
|
|
4467
4468
|
*/
|
|
4468
|
-
deleteStickerFromSet(sticker:
|
|
4469
|
+
deleteStickerFromSet(sticker: InputDocumentId): Promise<StickerSet>;
|
|
4469
4470
|
/**
|
|
4470
4471
|
* Get custom emoji stickers by their IDs
|
|
4471
4472
|
*
|
|
@@ -4523,7 +4524,7 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4523
4524
|
* @param position New sticker position (starting from 0)
|
|
4524
4525
|
* @returns Modified sticker set
|
|
4525
4526
|
*/
|
|
4526
|
-
moveStickerInSet(sticker:
|
|
4527
|
+
moveStickerInSet(sticker: InputDocumentId, position: number): Promise<StickerSet>;
|
|
4527
4528
|
/**
|
|
4528
4529
|
* Replace a sticker in a sticker set with another sticker
|
|
4529
4530
|
*
|
|
@@ -4537,7 +4538,7 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4537
4538
|
* @param newSticker New sticker to replace the old one with
|
|
4538
4539
|
* @returns Modfiied sticker set
|
|
4539
4540
|
*/
|
|
4540
|
-
replaceStickerInSet(sticker:
|
|
4541
|
+
replaceStickerInSet(sticker: InputDocumentId, newSticker: InputStickerSetItem, params?: {
|
|
4541
4542
|
/**
|
|
4542
4543
|
* Upload progress callback
|
|
4543
4544
|
*
|
|
@@ -5048,6 +5049,17 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
5048
5049
|
*/
|
|
5049
5050
|
limit?: number;
|
|
5050
5051
|
}): Promise<ArrayPaginated<Photo, number>>;
|
|
5052
|
+
/**
|
|
5053
|
+
* Get music files saved to the user's profile
|
|
5054
|
+
*/
|
|
5055
|
+
getSavedMusic(params: {
|
|
5056
|
+
/** User ID, username, phone number, `"me"` or `"self"` */
|
|
5057
|
+
userId: InputPeerLike;
|
|
5058
|
+
/** Offset for pagination */
|
|
5059
|
+
offset?: number;
|
|
5060
|
+
/** Limit for pagination */
|
|
5061
|
+
limit?: number;
|
|
5062
|
+
}): Promise<ArrayPaginated<Audio, number>>;
|
|
5051
5063
|
/**
|
|
5052
5064
|
* Get information about multiple users.
|
|
5053
5065
|
* You can retrieve up to 200 users at once.
|
|
@@ -5156,18 +5168,22 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
5156
5168
|
* @param [force=false] Whether to force re-fetch the peer from the server
|
|
5157
5169
|
*/
|
|
5158
5170
|
resolvePhoneNumber(phone: string, force?: boolean): Promise<tl.TypeInputPeer>;
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
* @deprecated – use {@link setEmojiStatus} with `self` instead
|
|
5165
|
-
*/
|
|
5166
|
-
setMyEmojiStatus(emoji: tl.Long | null, params?: {
|
|
5171
|
+
saveMusicToProfile(params: {
|
|
5172
|
+
/** Audio file to save (or its ID) */
|
|
5173
|
+
audio: InputMediaAudio | InputDocumentId;
|
|
5174
|
+
/** Optionally, document ID after which we should insert the music */
|
|
5175
|
+
after?: InputDocumentId;
|
|
5167
5176
|
/**
|
|
5168
|
-
*
|
|
5177
|
+
* Upload progress callback
|
|
5178
|
+
*
|
|
5179
|
+
* @param uploaded Number of bytes uploaded
|
|
5180
|
+
* @param total Total file size
|
|
5169
5181
|
*/
|
|
5170
|
-
|
|
5182
|
+
progressCallback?: (uploaded: number, total: number) => void;
|
|
5183
|
+
}): Promise<void>;
|
|
5184
|
+
unsaveMusicFromProfile(params: {
|
|
5185
|
+
/** ID of the Audio file to unsave */
|
|
5186
|
+
audio: InputDocumentId;
|
|
5171
5187
|
}): Promise<void>;
|
|
5172
5188
|
/**
|
|
5173
5189
|
* Set an emoji status for the given user/chat
|
|
@@ -278,11 +278,14 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
|
|
|
278
278
|
};
|
|
279
279
|
const input = media.file;
|
|
280
280
|
if (fileId.tdFileId.isFileIdLike(input)) {
|
|
281
|
+
const spoiler = (media.type === "video" || media.type === "photo") && media.spoiler;
|
|
281
282
|
if (typeof input === "string" && input.match(/^https?:\/\//)) {
|
|
282
283
|
return uploadMediaIfNeeded(
|
|
283
284
|
{
|
|
284
285
|
_: media.type === "photo" ? "inputMediaPhotoExternal" : "inputMediaDocumentExternal",
|
|
285
|
-
url: input
|
|
286
|
+
url: input,
|
|
287
|
+
ttlSeconds: media.ttlSeconds,
|
|
288
|
+
spoiler
|
|
286
289
|
},
|
|
287
290
|
media.type === "photo"
|
|
288
291
|
);
|
|
@@ -293,20 +296,26 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
|
|
|
293
296
|
if (parsed.location._ === "photo") {
|
|
294
297
|
return {
|
|
295
298
|
_: "inputMediaPhoto",
|
|
296
|
-
id: convertFileId.fileIdToInputPhoto(parsed)
|
|
299
|
+
id: convertFileId.fileIdToInputPhoto(parsed),
|
|
300
|
+
ttlSeconds: media.ttlSeconds,
|
|
301
|
+
spoiler
|
|
297
302
|
};
|
|
298
303
|
} else if (parsed.location._ === "web") {
|
|
299
304
|
return uploadMediaIfNeeded(
|
|
300
305
|
{
|
|
301
306
|
_: parsed.type === fileId.tdFileId.FileType.Photo ? "inputMediaPhotoExternal" : "inputMediaDocumentExternal",
|
|
302
|
-
url: parsed.location.url
|
|
307
|
+
url: parsed.location.url,
|
|
308
|
+
ttlSeconds: media.ttlSeconds,
|
|
309
|
+
spoiler
|
|
303
310
|
},
|
|
304
311
|
parsed.type === fileId.tdFileId.FileType.Photo
|
|
305
312
|
);
|
|
306
313
|
}
|
|
307
314
|
return {
|
|
308
315
|
_: "inputMediaDocument",
|
|
309
|
-
id: convertFileId.fileIdToInputDocument(parsed)
|
|
316
|
+
id: convertFileId.fileIdToInputDocument(parsed),
|
|
317
|
+
ttlSeconds: media.ttlSeconds,
|
|
318
|
+
spoiler
|
|
310
319
|
};
|
|
311
320
|
}
|
|
312
321
|
} else if (typeof input === "object" && tl.tl.isAnyInputMedia(input)) {
|
|
@@ -271,11 +271,14 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
|
|
|
271
271
|
};
|
|
272
272
|
const input = media.file;
|
|
273
273
|
if (tdFileId.isFileIdLike(input)) {
|
|
274
|
+
const spoiler = (media.type === "video" || media.type === "photo") && media.spoiler;
|
|
274
275
|
if (typeof input === "string" && input.match(/^https?:\/\//)) {
|
|
275
276
|
return uploadMediaIfNeeded(
|
|
276
277
|
{
|
|
277
278
|
_: media.type === "photo" ? "inputMediaPhotoExternal" : "inputMediaDocumentExternal",
|
|
278
|
-
url: input
|
|
279
|
+
url: input,
|
|
280
|
+
ttlSeconds: media.ttlSeconds,
|
|
281
|
+
spoiler
|
|
279
282
|
},
|
|
280
283
|
media.type === "photo"
|
|
281
284
|
);
|
|
@@ -286,20 +289,26 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
|
|
|
286
289
|
if (parsed.location._ === "photo") {
|
|
287
290
|
return {
|
|
288
291
|
_: "inputMediaPhoto",
|
|
289
|
-
id: fileIdToInputPhoto(parsed)
|
|
292
|
+
id: fileIdToInputPhoto(parsed),
|
|
293
|
+
ttlSeconds: media.ttlSeconds,
|
|
294
|
+
spoiler
|
|
290
295
|
};
|
|
291
296
|
} else if (parsed.location._ === "web") {
|
|
292
297
|
return uploadMediaIfNeeded(
|
|
293
298
|
{
|
|
294
299
|
_: parsed.type === tdFileId.FileType.Photo ? "inputMediaPhotoExternal" : "inputMediaDocumentExternal",
|
|
295
|
-
url: parsed.location.url
|
|
300
|
+
url: parsed.location.url,
|
|
301
|
+
ttlSeconds: media.ttlSeconds,
|
|
302
|
+
spoiler
|
|
296
303
|
},
|
|
297
304
|
parsed.type === tdFileId.FileType.Photo
|
|
298
305
|
);
|
|
299
306
|
}
|
|
300
307
|
return {
|
|
301
308
|
_: "inputMediaDocument",
|
|
302
|
-
id: fileIdToInputDocument(parsed)
|
|
309
|
+
id: fileIdToInputDocument(parsed),
|
|
310
|
+
ttlSeconds: media.ttlSeconds,
|
|
311
|
+
spoiler
|
|
303
312
|
};
|
|
304
313
|
}
|
|
305
314
|
} else if (typeof input === "object" && tl.isAnyInputMedia(input)) {
|
|
@@ -6,15 +6,6 @@ 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 resolvePeer = require("../users/resolve-peer.cjs");
|
|
9
|
-
async function toggleForum(client, chatId, enabled = false) {
|
|
10
|
-
const res = await client.call({
|
|
11
|
-
_: "channels.toggleForum",
|
|
12
|
-
channel: await resolvePeer.resolveChannel(client, chatId),
|
|
13
|
-
enabled,
|
|
14
|
-
tabs: false
|
|
15
|
-
});
|
|
16
|
-
client.handleClientUpdate(res);
|
|
17
|
-
}
|
|
18
9
|
async function updateForumSettings(client, chatId, settings) {
|
|
19
10
|
const res = await client.call({
|
|
20
11
|
_: "channels.toggleForum",
|
|
@@ -24,5 +15,4 @@ async function updateForumSettings(client, chatId, settings) {
|
|
|
24
15
|
});
|
|
25
16
|
client.handleClientUpdate(res);
|
|
26
17
|
}
|
|
27
|
-
exports.toggleForum = toggleForum;
|
|
28
18
|
exports.updateForumSettings = updateForumSettings;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
2
|
import { InputPeerLike } from '../../types/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Set whether a supergroup is a forum.
|
|
5
|
-
*
|
|
6
|
-
* Only owner of the supergroup can change this setting.
|
|
7
|
-
*
|
|
8
|
-
* @param chatId Chat ID or username
|
|
9
|
-
* @param enabled Whether the supergroup should be a forum
|
|
10
|
-
* @deprecated Use {@link updateForumSettings} instead
|
|
11
|
-
*/
|
|
12
|
-
export declare function toggleForum(client: ITelegramClient, chatId: InputPeerLike, enabled?: boolean): Promise<void>;
|
|
13
3
|
/**
|
|
14
4
|
* Update forum settings of a supergroup.
|
|
15
5
|
*
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
2
|
import { InputPeerLike } from '../../types/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Set whether a supergroup is a forum.
|
|
5
|
-
*
|
|
6
|
-
* Only owner of the supergroup can change this setting.
|
|
7
|
-
*
|
|
8
|
-
* @param chatId Chat ID or username
|
|
9
|
-
* @param enabled Whether the supergroup should be a forum
|
|
10
|
-
* @deprecated Use {@link updateForumSettings} instead
|
|
11
|
-
*/
|
|
12
|
-
export declare function toggleForum(client: ITelegramClient, chatId: InputPeerLike, enabled?: boolean): Promise<void>;
|
|
13
3
|
/**
|
|
14
4
|
* Update forum settings of a supergroup.
|
|
15
5
|
*
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import { resolveChannel } from "../users/resolve-peer.js";
|
|
2
|
-
async function toggleForum(client, chatId, enabled = false) {
|
|
3
|
-
const res = await client.call({
|
|
4
|
-
_: "channels.toggleForum",
|
|
5
|
-
channel: await resolveChannel(client, chatId),
|
|
6
|
-
enabled,
|
|
7
|
-
tabs: false
|
|
8
|
-
});
|
|
9
|
-
client.handleClientUpdate(res);
|
|
10
|
-
}
|
|
11
2
|
async function updateForumSettings(client, chatId, settings) {
|
|
12
3
|
const res = await client.call({
|
|
13
4
|
_: "channels.toggleForum",
|
|
@@ -18,6 +9,5 @@ async function updateForumSettings(client, chatId, settings) {
|
|
|
18
9
|
client.handleClientUpdate(res);
|
|
19
10
|
}
|
|
20
11
|
export {
|
|
21
|
-
toggleForum,
|
|
22
12
|
updateForumSettings
|
|
23
13
|
};
|
|
@@ -9,11 +9,12 @@ const typeAssertions = require("../../../utils/type-assertions.cjs");
|
|
|
9
9
|
const findInUpdate = require("../messages/find-in-update.cjs");
|
|
10
10
|
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
11
11
|
async function buyResaleGift(client, params) {
|
|
12
|
-
const { slug, recipient, shouldDispatch } = params;
|
|
12
|
+
const { slug, recipient, shouldDispatch, ton } = params;
|
|
13
13
|
const invoice = {
|
|
14
14
|
_: "inputInvoiceStarGiftResale",
|
|
15
15
|
slug,
|
|
16
|
-
toId: await resolvePeer.resolvePeer(client, recipient)
|
|
16
|
+
toId: await resolvePeer.resolvePeer(client, recipient),
|
|
17
|
+
ton
|
|
17
18
|
};
|
|
18
19
|
const form = await client.call({
|
|
19
20
|
_: "payments.getPaymentForm",
|
|
@@ -2,11 +2,12 @@ import { assertTypeIs } from "../../../utils/type-assertions.js";
|
|
|
2
2
|
import { _findMessageInUpdate } from "../messages/find-in-update.js";
|
|
3
3
|
import { resolvePeer } from "../users/resolve-peer.js";
|
|
4
4
|
async function buyResaleGift(client, params) {
|
|
5
|
-
const { slug, recipient, shouldDispatch } = params;
|
|
5
|
+
const { slug, recipient, shouldDispatch, ton } = params;
|
|
6
6
|
const invoice = {
|
|
7
7
|
_: "inputInvoiceStarGiftResale",
|
|
8
8
|
slug,
|
|
9
|
-
toId: await resolvePeer(client, recipient)
|
|
9
|
+
toId: await resolvePeer(client, recipient),
|
|
10
|
+
ton
|
|
10
11
|
};
|
|
11
12
|
const form = await client.call({
|
|
12
13
|
_: "payments.getPaymentForm",
|
|
@@ -63,7 +63,7 @@ function _normalizeResaleAttributes(attrs) {
|
|
|
63
63
|
}
|
|
64
64
|
return res;
|
|
65
65
|
}
|
|
66
|
-
async function
|
|
66
|
+
async function getStarGiftResaleOptions(client, params) {
|
|
67
67
|
const res = await client.call({
|
|
68
68
|
_: "payments.getResaleStarGifts",
|
|
69
69
|
sortByNum: params.sort === "num",
|
|
@@ -104,4 +104,4 @@ async function getResaleOptions(client, params) {
|
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
exports._normalizeResaleAttributes = _normalizeResaleAttributes;
|
|
107
|
-
exports.
|
|
107
|
+
exports.getStarGiftResaleOptions = getStarGiftResaleOptions;
|
|
@@ -22,7 +22,7 @@ export interface ResaleStarGiftsMeta {
|
|
|
22
22
|
/**
|
|
23
23
|
* Get a list of star gifts up for resale
|
|
24
24
|
*/
|
|
25
|
-
export declare function
|
|
25
|
+
export declare function getStarGiftResaleOptions(client: ITelegramClient, params: {
|
|
26
26
|
/** ID of the gift to get resale options for */
|
|
27
27
|
giftId: tl.Long;
|
|
28
28
|
/**
|
|
@@ -22,7 +22,7 @@ export interface ResaleStarGiftsMeta {
|
|
|
22
22
|
/**
|
|
23
23
|
* Get a list of star gifts up for resale
|
|
24
24
|
*/
|
|
25
|
-
export declare function
|
|
25
|
+
export declare function getStarGiftResaleOptions(client: ITelegramClient, params: {
|
|
26
26
|
/** ID of the gift to get resale options for */
|
|
27
27
|
giftId: tl.Long;
|
|
28
28
|
/**
|
|
@@ -56,7 +56,7 @@ function _normalizeResaleAttributes(attrs) {
|
|
|
56
56
|
}
|
|
57
57
|
return res;
|
|
58
58
|
}
|
|
59
|
-
async function
|
|
59
|
+
async function getStarGiftResaleOptions(client, params) {
|
|
60
60
|
const res = await client.call({
|
|
61
61
|
_: "payments.getResaleStarGifts",
|
|
62
62
|
sortByNum: params.sort === "num",
|
|
@@ -98,5 +98,5 @@ async function getResaleOptions(client, params) {
|
|
|
98
98
|
}
|
|
99
99
|
export {
|
|
100
100
|
_normalizeResaleAttributes,
|
|
101
|
-
|
|
101
|
+
getStarGiftResaleOptions
|
|
102
102
|
};
|
|
@@ -16,7 +16,8 @@ async function getSavedStarGifts(client, params) {
|
|
|
16
16
|
excludeUnsaved: params.excludeHidden,
|
|
17
17
|
excludeSaved: params.excludePublic,
|
|
18
18
|
excludeUnlimited: params.excludeUnlimited,
|
|
19
|
-
|
|
19
|
+
excludeUnupgradable: params.excludeUnupgradable,
|
|
20
|
+
excludeUpgradable: params.excludeUpgradable,
|
|
20
21
|
excludeUnique: params.excludeUnique,
|
|
21
22
|
sortByValue: params.sortByValue,
|
|
22
23
|
collectionId: params.collectionId,
|
|
@@ -15,10 +15,12 @@ export declare function getSavedStarGifts(client: ITelegramClient, params: {
|
|
|
15
15
|
excludePublic?: boolean;
|
|
16
16
|
/** Whether to exclude gifts with unlimited availability */
|
|
17
17
|
excludeUnlimited?: boolean;
|
|
18
|
-
/** Whether to exclude gifts with limited availability */
|
|
19
|
-
excludeLimited?: boolean;
|
|
20
18
|
/** Whether to exclude unique gifts */
|
|
21
19
|
excludeUnique?: boolean;
|
|
20
|
+
/** Whether to exclude gifts that cannot be upgraded (either not limited or already upgraded) */
|
|
21
|
+
excludeUnupgradable?: boolean;
|
|
22
|
+
/** Whether to exclude gifts that can be upgraded */
|
|
23
|
+
excludeUpgradable?: boolean;
|
|
22
24
|
/** ID of the collection to get gifts from */
|
|
23
25
|
collectionId?: number;
|
|
24
26
|
/** Whether to sort by value */
|
|
@@ -15,10 +15,12 @@ export declare function getSavedStarGifts(client: ITelegramClient, params: {
|
|
|
15
15
|
excludePublic?: boolean;
|
|
16
16
|
/** Whether to exclude gifts with unlimited availability */
|
|
17
17
|
excludeUnlimited?: boolean;
|
|
18
|
-
/** Whether to exclude gifts with limited availability */
|
|
19
|
-
excludeLimited?: boolean;
|
|
20
18
|
/** Whether to exclude unique gifts */
|
|
21
19
|
excludeUnique?: boolean;
|
|
20
|
+
/** Whether to exclude gifts that cannot be upgraded (either not limited or already upgraded) */
|
|
21
|
+
excludeUnupgradable?: boolean;
|
|
22
|
+
/** Whether to exclude gifts that can be upgraded */
|
|
23
|
+
excludeUpgradable?: boolean;
|
|
22
24
|
/** ID of the collection to get gifts from */
|
|
23
25
|
collectionId?: number;
|
|
24
26
|
/** Whether to sort by value */
|
|
@@ -9,7 +9,8 @@ async function getSavedStarGifts(client, params) {
|
|
|
9
9
|
excludeUnsaved: params.excludeHidden,
|
|
10
10
|
excludeSaved: params.excludePublic,
|
|
11
11
|
excludeUnlimited: params.excludeUnlimited,
|
|
12
|
-
|
|
12
|
+
excludeUnupgradable: params.excludeUnupgradable,
|
|
13
|
+
excludeUpgradable: params.excludeUpgradable,
|
|
13
14
|
excludeUnique: params.excludeUnique,
|
|
14
15
|
sortByValue: params.sortByValue,
|
|
15
16
|
collectionId: params.collectionId,
|
|
@@ -5,9 +5,12 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const starGiftValue = require("../../types/premium/star-gift-value.cjs");
|
|
9
|
+
async function getStarGiftValue(client, params) {
|
|
10
|
+
const res = await client.call({
|
|
11
|
+
_: "payments.getUniqueStarGiftValueInfo",
|
|
12
|
+
slug: params.slug
|
|
13
|
+
});
|
|
14
|
+
return new starGiftValue.StarGiftValue(res);
|
|
12
15
|
}
|
|
13
|
-
exports.
|
|
16
|
+
exports.getStarGiftValue = getStarGiftValue;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { StarGiftValue } from '../../types/premium/star-gift-value.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get the value of a unique star gift
|
|
5
|
+
*/
|
|
6
|
+
export declare function getStarGiftValue(client: ITelegramClient, params: {
|
|
7
|
+
/** Slug of the star gift */
|
|
8
|
+
slug: string;
|
|
9
|
+
}): Promise<StarGiftValue>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { StarGiftValue } from '../../types/premium/star-gift-value.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get the value of a unique star gift
|
|
5
|
+
*/
|
|
6
|
+
export declare function getStarGiftValue(client: ITelegramClient, params: {
|
|
7
|
+
/** Slug of the star gift */
|
|
8
|
+
slug: string;
|
|
9
|
+
}): Promise<StarGiftValue>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StarGiftValue as StarGiftValue$2 } from "../../types/premium/star-gift-value.js";
|
|
2
|
+
async function getStarGiftValue(client, params) {
|
|
3
|
+
const res = await client.call({
|
|
4
|
+
_: "payments.getUniqueStarGiftValueInfo",
|
|
5
|
+
slug: params.slug
|
|
6
|
+
});
|
|
7
|
+
return new StarGiftValue$2(res);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
getStarGiftValue
|
|
11
|
+
};
|