@mtcute/core 0.25.6 → 0.25.7
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 +4 -0
- package/client.js +4 -0
- package/highlevel/client.d.cts +49 -2
- package/highlevel/client.d.ts +49 -2
- package/highlevel/methods/messages/search-posts-global.cjs +48 -0
- package/highlevel/methods/messages/search-posts-global.d.cts +27 -0
- package/highlevel/methods/messages/search-posts-global.d.ts +27 -0
- package/highlevel/methods/messages/search-posts-global.js +43 -0
- package/highlevel/methods/premium/set-gift-resale-price.cjs +11 -1
- package/highlevel/methods/premium/set-gift-resale-price.d.cts +5 -2
- package/highlevel/methods/premium/set-gift-resale-price.d.ts +5 -2
- package/highlevel/methods/premium/set-gift-resale-price.js +11 -1
- package/highlevel/methods/stories/send-story.cjs +3 -2
- package/highlevel/methods/stories/send-story.d.cts +4 -0
- package/highlevel/methods/stories/send-story.d.ts +4 -0
- package/highlevel/methods/stories/send-story.js +3 -2
- package/highlevel/methods.d.cts +2 -0
- package/highlevel/methods.d.ts +2 -0
- package/highlevel/types/messages/message-action.cjs +2 -1
- package/highlevel/types/messages/message-action.d.cts +2 -0
- package/highlevel/types/messages/message-action.d.ts +2 -0
- package/highlevel/types/messages/message-action.js +2 -1
- package/highlevel/types/peers/full-user.cjs +14 -1
- package/highlevel/types/peers/full-user.d.cts +9 -0
- package/highlevel/types/peers/full-user.d.ts +9 -0
- package/highlevel/types/peers/full-user.js +14 -1
- package/highlevel/types/premium/stars-gift-unique.cjs +8 -1
- package/highlevel/types/premium/stars-gift-unique.d.cts +2 -0
- package/highlevel/types/premium/stars-gift-unique.d.ts +2 -0
- package/highlevel/types/premium/stars-gift-unique.js +8 -1
- package/highlevel/types/stories/story.cjs +6 -0
- package/highlevel/types/stories/story.d.cts +4 -0
- package/highlevel/types/stories/story.d.ts +4 -0
- package/highlevel/types/stories/story.js +6 -0
- package/methods.cjs +2 -0
- package/methods.js +2 -0
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/package.json +2 -2
- package/utils/binary/compat.cjs +30 -0
- package/utils/binary/compat.js +30 -0
package/client.cjs
CHANGED
|
@@ -163,6 +163,7 @@ const readReactions = require("./highlevel/methods/messages/read-reactions.cjs")
|
|
|
163
163
|
const searchGlobal = require("./highlevel/methods/messages/search-global.cjs");
|
|
164
164
|
const searchHashtag = require("./highlevel/methods/messages/search-hashtag.cjs");
|
|
165
165
|
const searchMessages = require("./highlevel/methods/messages/search-messages.cjs");
|
|
166
|
+
const searchPostsGlobal = require("./highlevel/methods/messages/search-posts-global.cjs");
|
|
166
167
|
const sendAnswer = require("./highlevel/methods/messages/send-answer.cjs");
|
|
167
168
|
const sendComment = require("./highlevel/methods/messages/send-comment.cjs");
|
|
168
169
|
const sendCopyGroup = require("./highlevel/methods/messages/send-copy-group.cjs");
|
|
@@ -935,6 +936,9 @@ TelegramClient.prototype.iterSearchHashtag = function(...args) {
|
|
|
935
936
|
TelegramClient.prototype.searchMessages = function(...args) {
|
|
936
937
|
return searchMessages.searchMessages(this._client, ...args);
|
|
937
938
|
};
|
|
939
|
+
TelegramClient.prototype.searchPostsGlobal = function(...args) {
|
|
940
|
+
return searchPostsGlobal.searchPostsGlobal(this._client, ...args);
|
|
941
|
+
};
|
|
938
942
|
TelegramClient.prototype.answerText = function(...args) {
|
|
939
943
|
return sendAnswer.answerText(this._client, ...args);
|
|
940
944
|
};
|
package/client.js
CHANGED
|
@@ -156,6 +156,7 @@ import { readReactions } from "./highlevel/methods/messages/read-reactions.js";
|
|
|
156
156
|
import { searchGlobal } from "./highlevel/methods/messages/search-global.js";
|
|
157
157
|
import { searchHashtag, iterSearchHashtag } from "./highlevel/methods/messages/search-hashtag.js";
|
|
158
158
|
import { searchMessages } from "./highlevel/methods/messages/search-messages.js";
|
|
159
|
+
import { searchPostsGlobal } from "./highlevel/methods/messages/search-posts-global.js";
|
|
159
160
|
import { answerText, answerMedia, answerMediaGroup } from "./highlevel/methods/messages/send-answer.js";
|
|
160
161
|
import { commentText, commentMedia, commentMediaGroup } from "./highlevel/methods/messages/send-comment.js";
|
|
161
162
|
import { sendCopyGroup } from "./highlevel/methods/messages/send-copy-group.js";
|
|
@@ -928,6 +929,9 @@ TelegramClient.prototype.iterSearchHashtag = function(...args) {
|
|
|
928
929
|
TelegramClient.prototype.searchMessages = function(...args) {
|
|
929
930
|
return searchMessages(this._client, ...args);
|
|
930
931
|
};
|
|
932
|
+
TelegramClient.prototype.searchPostsGlobal = function(...args) {
|
|
933
|
+
return searchPostsGlobal(this._client, ...args);
|
|
934
|
+
};
|
|
931
935
|
TelegramClient.prototype.answerText = function(...args) {
|
|
932
936
|
return answerText(this._client, ...args);
|
|
933
937
|
};
|
package/highlevel/client.d.cts
CHANGED
|
@@ -16,6 +16,7 @@ import { GetReactionUsersOffset, getReactionUsers } from './methods/messages/get
|
|
|
16
16
|
import { SearchGlobalOffset, searchGlobal } from './methods/messages/search-global.js';
|
|
17
17
|
import { SearchHashtagOffset, searchHashtag } from './methods/messages/search-hashtag.js';
|
|
18
18
|
import { SearchMessagesOffset, searchMessages } from './methods/messages/search-messages.js';
|
|
19
|
+
import { SearchPostsGlobalOffset } from './methods/messages/search-posts-global.js';
|
|
19
20
|
import { CommonSendParams } from './methods/messages/send-common.js';
|
|
20
21
|
import { SendCopyGroupParams } from './methods/messages/send-copy-group.js';
|
|
21
22
|
import { SendCopyParams } from './methods/messages/send-copy.js';
|
|
@@ -2647,6 +2648,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
2647
2648
|
/**
|
|
2648
2649
|
* Append item(s) to a todo list
|
|
2649
2650
|
*
|
|
2651
|
+
* **Available**: ✅ both users and bots
|
|
2652
|
+
*
|
|
2650
2653
|
* @returns Service message about the appended todo item(s), if any.
|
|
2651
2654
|
*/
|
|
2652
2655
|
appendTodoList(params: InputMessageId & {
|
|
@@ -3401,6 +3404,26 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3401
3404
|
*/
|
|
3402
3405
|
fromUser?: InputPeerLike;
|
|
3403
3406
|
}): Promise<ArrayPaginated<Message, SearchMessagesOffset>>;
|
|
3407
|
+
/**
|
|
3408
|
+
* Search for posts globally across all public channels in Telegram
|
|
3409
|
+
*
|
|
3410
|
+
* **Available**: 👤 users only
|
|
3411
|
+
*
|
|
3412
|
+
* @param query Keyword to search for
|
|
3413
|
+
* @param params Additional parameters
|
|
3414
|
+
*/
|
|
3415
|
+
searchPostsGlobal(query: string, params?: {
|
|
3416
|
+
/** Offset for the search */
|
|
3417
|
+
offset?: SearchPostsGlobalOffset;
|
|
3418
|
+
/** Limit the number of results */
|
|
3419
|
+
limit?: number;
|
|
3420
|
+
/**
|
|
3421
|
+
* The amount of stars you are willing to pay for the search
|
|
3422
|
+
*/
|
|
3423
|
+
payStars?: tl.Long;
|
|
3424
|
+
}): Promise<ArrayPaginatedWithMeta<Message, SearchPostsGlobalOffset, {
|
|
3425
|
+
limits?: tl.TypeSearchPostsFlood;
|
|
3426
|
+
}>>;
|
|
3404
3427
|
/** Send a text to the same chat (and topic, if applicable) as a given message */
|
|
3405
3428
|
answerText(message: Message, ...params: ParametersSkip2<typeof sendText>): ReturnType<typeof sendText>;
|
|
3406
3429
|
/** Send a media to the same chat (and topic, if applicable) as a given message */
|
|
@@ -3742,6 +3765,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3742
3765
|
/**
|
|
3743
3766
|
* Toggle the completion status of a todo list item(s)
|
|
3744
3767
|
*
|
|
3768
|
+
* **Available**: ✅ both users and bots
|
|
3769
|
+
*
|
|
3745
3770
|
* @returns Service message about the toggled items, if any.
|
|
3746
3771
|
*/
|
|
3747
3772
|
toggleTodoCompleted(params: InputMessageId & {
|
|
@@ -4020,6 +4045,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4020
4045
|
getMyBoostSlots(): Promise<BoostSlot[]>;
|
|
4021
4046
|
/**
|
|
4022
4047
|
* Get a list of star gifts up for resale
|
|
4048
|
+
* **Available**: ✅ both users and bots
|
|
4049
|
+
*
|
|
4023
4050
|
*/
|
|
4024
4051
|
getResaleOptions(params: {
|
|
4025
4052
|
/** ID of the gift to get resale options for */
|
|
@@ -4048,6 +4075,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4048
4075
|
* Get a list of saved star gifts of a user/channel
|
|
4049
4076
|
*
|
|
4050
4077
|
* Note that filters currently only work for channels
|
|
4078
|
+
* **Available**: ✅ both users and bots
|
|
4079
|
+
*
|
|
4051
4080
|
*/
|
|
4052
4081
|
getSavedStarGifts(params: {
|
|
4053
4082
|
/** Peer to get saved gifts from */
|
|
@@ -4062,6 +4091,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4062
4091
|
excludeLimited?: boolean;
|
|
4063
4092
|
/** Whether to exclude unique gifts */
|
|
4064
4093
|
excludeUnique?: boolean;
|
|
4094
|
+
/** ID of the collection to get gifts from */
|
|
4095
|
+
collectionId?: number;
|
|
4065
4096
|
/** Whether to sort by value */
|
|
4066
4097
|
sortByValue?: boolean;
|
|
4067
4098
|
/** Offset for pagination */
|
|
@@ -4116,6 +4147,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4116
4147
|
}): Promise<StarsStatus>;
|
|
4117
4148
|
/**
|
|
4118
4149
|
* Get information about a unique star gift by its slug
|
|
4150
|
+
* **Available**: ✅ both users and bots
|
|
4151
|
+
*
|
|
4119
4152
|
*/
|
|
4120
4153
|
getUniqueStarGift(slug: string): Promise<StarGiftUnique>;
|
|
4121
4154
|
/**
|
|
@@ -4143,6 +4176,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4143
4176
|
/**
|
|
4144
4177
|
* Iterate over saved star gifts of a user,
|
|
4145
4178
|
* wrapper over {@link getSavedStarGifts}
|
|
4179
|
+
* **Available**: ✅ both users and bots
|
|
4180
|
+
*
|
|
4146
4181
|
*/
|
|
4147
4182
|
iterSavedStarGifts(params: {
|
|
4148
4183
|
/** Peer to get saved gifts from */
|
|
@@ -4194,6 +4229,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4194
4229
|
}): AsyncIterableIterator<StarsTransaction>;
|
|
4195
4230
|
/**
|
|
4196
4231
|
* Toggles whether one or more star gift is pinned to the top of the list
|
|
4232
|
+
* **Available**: ✅ both users and bots
|
|
4233
|
+
*
|
|
4197
4234
|
*/
|
|
4198
4235
|
togglePinnedStarGifts(params: {
|
|
4199
4236
|
/** One or more gifts to pin */
|
|
@@ -4276,8 +4313,10 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4276
4313
|
setResaleStarGiftPrice(params: {
|
|
4277
4314
|
/** Star gift to update the price of */
|
|
4278
4315
|
gift: InputStarGift;
|
|
4279
|
-
/**
|
|
4280
|
-
|
|
4316
|
+
/**
|
|
4317
|
+
* New price of the gift (in stars), or `null` to unlist
|
|
4318
|
+
*/
|
|
4319
|
+
price: tl.Long | number | tl.TypeStarsAmount | null;
|
|
4281
4320
|
}): Promise<void>;
|
|
4282
4321
|
/**
|
|
4283
4322
|
* Transfer a unique star gift.
|
|
@@ -4287,6 +4326,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4287
4326
|
* > For GUI clients, you should refer to the method's source code and
|
|
4288
4327
|
* > present the payment form to the user.
|
|
4289
4328
|
*
|
|
4329
|
+
* **Available**: 👤 users only
|
|
4330
|
+
*
|
|
4290
4331
|
* @returns Service message about the transferred gift, if one was generated.
|
|
4291
4332
|
*/
|
|
4292
4333
|
transferStarGift(params: {
|
|
@@ -4308,6 +4349,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4308
4349
|
* > For GUI clients, you should refer to the method's source code and
|
|
4309
4350
|
* > present the payment form to the user.
|
|
4310
4351
|
*
|
|
4352
|
+
* **Available**: 👤 users only
|
|
4353
|
+
*
|
|
4311
4354
|
* @returns Service message about the upgraded gift, if one was generated.
|
|
4312
4355
|
*/
|
|
4313
4356
|
upgradeStarGift(params: {
|
|
@@ -4873,6 +4916,10 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4873
4916
|
* @default 86400
|
|
4874
4917
|
*/
|
|
4875
4918
|
period?: number;
|
|
4919
|
+
/**
|
|
4920
|
+
* IDs of albums to add the story to
|
|
4921
|
+
*/
|
|
4922
|
+
addToAlbums?: number[];
|
|
4876
4923
|
}): Promise<Story>;
|
|
4877
4924
|
/**
|
|
4878
4925
|
* Toggle whether peer's stories are archived (hidden) or not.
|
package/highlevel/client.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { GetReactionUsersOffset, getReactionUsers } from './methods/messages/get
|
|
|
16
16
|
import { SearchGlobalOffset, searchGlobal } from './methods/messages/search-global.js';
|
|
17
17
|
import { SearchHashtagOffset, searchHashtag } from './methods/messages/search-hashtag.js';
|
|
18
18
|
import { SearchMessagesOffset, searchMessages } from './methods/messages/search-messages.js';
|
|
19
|
+
import { SearchPostsGlobalOffset } from './methods/messages/search-posts-global.js';
|
|
19
20
|
import { CommonSendParams } from './methods/messages/send-common.js';
|
|
20
21
|
import { SendCopyGroupParams } from './methods/messages/send-copy-group.js';
|
|
21
22
|
import { SendCopyParams } from './methods/messages/send-copy.js';
|
|
@@ -2647,6 +2648,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
2647
2648
|
/**
|
|
2648
2649
|
* Append item(s) to a todo list
|
|
2649
2650
|
*
|
|
2651
|
+
* **Available**: ✅ both users and bots
|
|
2652
|
+
*
|
|
2650
2653
|
* @returns Service message about the appended todo item(s), if any.
|
|
2651
2654
|
*/
|
|
2652
2655
|
appendTodoList(params: InputMessageId & {
|
|
@@ -3401,6 +3404,26 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3401
3404
|
*/
|
|
3402
3405
|
fromUser?: InputPeerLike;
|
|
3403
3406
|
}): Promise<ArrayPaginated<Message, SearchMessagesOffset>>;
|
|
3407
|
+
/**
|
|
3408
|
+
* Search for posts globally across all public channels in Telegram
|
|
3409
|
+
*
|
|
3410
|
+
* **Available**: 👤 users only
|
|
3411
|
+
*
|
|
3412
|
+
* @param query Keyword to search for
|
|
3413
|
+
* @param params Additional parameters
|
|
3414
|
+
*/
|
|
3415
|
+
searchPostsGlobal(query: string, params?: {
|
|
3416
|
+
/** Offset for the search */
|
|
3417
|
+
offset?: SearchPostsGlobalOffset;
|
|
3418
|
+
/** Limit the number of results */
|
|
3419
|
+
limit?: number;
|
|
3420
|
+
/**
|
|
3421
|
+
* The amount of stars you are willing to pay for the search
|
|
3422
|
+
*/
|
|
3423
|
+
payStars?: tl.Long;
|
|
3424
|
+
}): Promise<ArrayPaginatedWithMeta<Message, SearchPostsGlobalOffset, {
|
|
3425
|
+
limits?: tl.TypeSearchPostsFlood;
|
|
3426
|
+
}>>;
|
|
3404
3427
|
/** Send a text to the same chat (and topic, if applicable) as a given message */
|
|
3405
3428
|
answerText(message: Message, ...params: ParametersSkip2<typeof sendText>): ReturnType<typeof sendText>;
|
|
3406
3429
|
/** Send a media to the same chat (and topic, if applicable) as a given message */
|
|
@@ -3742,6 +3765,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
3742
3765
|
/**
|
|
3743
3766
|
* Toggle the completion status of a todo list item(s)
|
|
3744
3767
|
*
|
|
3768
|
+
* **Available**: ✅ both users and bots
|
|
3769
|
+
*
|
|
3745
3770
|
* @returns Service message about the toggled items, if any.
|
|
3746
3771
|
*/
|
|
3747
3772
|
toggleTodoCompleted(params: InputMessageId & {
|
|
@@ -4020,6 +4045,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4020
4045
|
getMyBoostSlots(): Promise<BoostSlot[]>;
|
|
4021
4046
|
/**
|
|
4022
4047
|
* Get a list of star gifts up for resale
|
|
4048
|
+
* **Available**: ✅ both users and bots
|
|
4049
|
+
*
|
|
4023
4050
|
*/
|
|
4024
4051
|
getResaleOptions(params: {
|
|
4025
4052
|
/** ID of the gift to get resale options for */
|
|
@@ -4048,6 +4075,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4048
4075
|
* Get a list of saved star gifts of a user/channel
|
|
4049
4076
|
*
|
|
4050
4077
|
* Note that filters currently only work for channels
|
|
4078
|
+
* **Available**: ✅ both users and bots
|
|
4079
|
+
*
|
|
4051
4080
|
*/
|
|
4052
4081
|
getSavedStarGifts(params: {
|
|
4053
4082
|
/** Peer to get saved gifts from */
|
|
@@ -4062,6 +4091,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4062
4091
|
excludeLimited?: boolean;
|
|
4063
4092
|
/** Whether to exclude unique gifts */
|
|
4064
4093
|
excludeUnique?: boolean;
|
|
4094
|
+
/** ID of the collection to get gifts from */
|
|
4095
|
+
collectionId?: number;
|
|
4065
4096
|
/** Whether to sort by value */
|
|
4066
4097
|
sortByValue?: boolean;
|
|
4067
4098
|
/** Offset for pagination */
|
|
@@ -4116,6 +4147,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4116
4147
|
}): Promise<StarsStatus>;
|
|
4117
4148
|
/**
|
|
4118
4149
|
* Get information about a unique star gift by its slug
|
|
4150
|
+
* **Available**: ✅ both users and bots
|
|
4151
|
+
*
|
|
4119
4152
|
*/
|
|
4120
4153
|
getUniqueStarGift(slug: string): Promise<StarGiftUnique>;
|
|
4121
4154
|
/**
|
|
@@ -4143,6 +4176,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4143
4176
|
/**
|
|
4144
4177
|
* Iterate over saved star gifts of a user,
|
|
4145
4178
|
* wrapper over {@link getSavedStarGifts}
|
|
4179
|
+
* **Available**: ✅ both users and bots
|
|
4180
|
+
*
|
|
4146
4181
|
*/
|
|
4147
4182
|
iterSavedStarGifts(params: {
|
|
4148
4183
|
/** Peer to get saved gifts from */
|
|
@@ -4194,6 +4229,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4194
4229
|
}): AsyncIterableIterator<StarsTransaction>;
|
|
4195
4230
|
/**
|
|
4196
4231
|
* Toggles whether one or more star gift is pinned to the top of the list
|
|
4232
|
+
* **Available**: ✅ both users and bots
|
|
4233
|
+
*
|
|
4197
4234
|
*/
|
|
4198
4235
|
togglePinnedStarGifts(params: {
|
|
4199
4236
|
/** One or more gifts to pin */
|
|
@@ -4276,8 +4313,10 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4276
4313
|
setResaleStarGiftPrice(params: {
|
|
4277
4314
|
/** Star gift to update the price of */
|
|
4278
4315
|
gift: InputStarGift;
|
|
4279
|
-
/**
|
|
4280
|
-
|
|
4316
|
+
/**
|
|
4317
|
+
* New price of the gift (in stars), or `null` to unlist
|
|
4318
|
+
*/
|
|
4319
|
+
price: tl.Long | number | tl.TypeStarsAmount | null;
|
|
4281
4320
|
}): Promise<void>;
|
|
4282
4321
|
/**
|
|
4283
4322
|
* Transfer a unique star gift.
|
|
@@ -4287,6 +4326,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4287
4326
|
* > For GUI clients, you should refer to the method's source code and
|
|
4288
4327
|
* > present the payment form to the user.
|
|
4289
4328
|
*
|
|
4329
|
+
* **Available**: 👤 users only
|
|
4330
|
+
*
|
|
4290
4331
|
* @returns Service message about the transferred gift, if one was generated.
|
|
4291
4332
|
*/
|
|
4292
4333
|
transferStarGift(params: {
|
|
@@ -4308,6 +4349,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4308
4349
|
* > For GUI clients, you should refer to the method's source code and
|
|
4309
4350
|
* > present the payment form to the user.
|
|
4310
4351
|
*
|
|
4352
|
+
* **Available**: 👤 users only
|
|
4353
|
+
*
|
|
4311
4354
|
* @returns Service message about the upgraded gift, if one was generated.
|
|
4312
4355
|
*/
|
|
4313
4356
|
upgradeStarGift(params: {
|
|
@@ -4873,6 +4916,10 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
4873
4916
|
* @default 86400
|
|
4874
4917
|
*/
|
|
4875
4918
|
period?: number;
|
|
4919
|
+
/**
|
|
4920
|
+
* IDs of albums to add the story to
|
|
4921
|
+
*/
|
|
4922
|
+
addToAlbums?: number[];
|
|
4876
4923
|
}): Promise<Story>;
|
|
4877
4924
|
/**
|
|
4878
4925
|
* Toggle whether peer's stories are archived (hidden) or not.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. 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 miscUtils = require("../../utils/misc-utils.cjs");
|
|
10
|
+
const peersIndex = require("../../types/peers/peers-index.cjs");
|
|
11
|
+
const message = require("../../types/messages/message.cjs");
|
|
12
|
+
const defaultOffset = {
|
|
13
|
+
rate: 0,
|
|
14
|
+
peer: { _: "inputPeerEmpty" },
|
|
15
|
+
id: 0
|
|
16
|
+
};
|
|
17
|
+
async function searchPostsGlobal(client, query, params) {
|
|
18
|
+
const {
|
|
19
|
+
offset: { rate: offsetRate, peer: offsetPeer, id: offsetId } = defaultOffset,
|
|
20
|
+
limit = 100,
|
|
21
|
+
payStars
|
|
22
|
+
} = params ?? {};
|
|
23
|
+
const res = await client.call({
|
|
24
|
+
_: "channels.searchPosts",
|
|
25
|
+
query,
|
|
26
|
+
allowPaidStars: payStars,
|
|
27
|
+
offsetId,
|
|
28
|
+
offsetRate,
|
|
29
|
+
offsetPeer,
|
|
30
|
+
limit
|
|
31
|
+
});
|
|
32
|
+
typeAssertions.assertTypeIsNot("searchHashtag", res, "messages.messagesNotModified");
|
|
33
|
+
const peers = peersIndex.PeersIndex.from(res);
|
|
34
|
+
const msgs = res.messages.filter((msg) => msg._ !== "messageEmpty").map((msg) => new message.Message(msg, peers));
|
|
35
|
+
const last = msgs[msgs.length - 1];
|
|
36
|
+
const next = last ? {
|
|
37
|
+
rate: res.nextRate ?? last.raw.date,
|
|
38
|
+
peer: last.chat.inputPeer,
|
|
39
|
+
id: last.id
|
|
40
|
+
} : void 0;
|
|
41
|
+
return miscUtils.makeArrayPaginatedWithMeta(
|
|
42
|
+
msgs,
|
|
43
|
+
res.count ?? msgs.length,
|
|
44
|
+
{ limits: res.searchFlood },
|
|
45
|
+
next
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
exports.searchPostsGlobal = searchPostsGlobal;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
3
|
+
import { ArrayPaginatedWithMeta } from '../../types/utils.js';
|
|
4
|
+
import { Message } from '../../types/index.js';
|
|
5
|
+
export interface SearchPostsGlobalOffset {
|
|
6
|
+
rate: number;
|
|
7
|
+
peer: tl.TypeInputPeer;
|
|
8
|
+
id: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Search for posts globally across all public channels in Telegram
|
|
12
|
+
*
|
|
13
|
+
* @param query Keyword to search for
|
|
14
|
+
* @param params Additional parameters
|
|
15
|
+
*/
|
|
16
|
+
export declare function searchPostsGlobal(client: ITelegramClient, query: string, params?: {
|
|
17
|
+
/** Offset for the search */
|
|
18
|
+
offset?: SearchPostsGlobalOffset;
|
|
19
|
+
/** Limit the number of results */
|
|
20
|
+
limit?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The amount of stars you are willing to pay for the search
|
|
23
|
+
*/
|
|
24
|
+
payStars?: tl.Long;
|
|
25
|
+
}): Promise<ArrayPaginatedWithMeta<Message, SearchPostsGlobalOffset, {
|
|
26
|
+
limits?: tl.TypeSearchPostsFlood;
|
|
27
|
+
}>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
3
|
+
import { ArrayPaginatedWithMeta } from '../../types/utils.js';
|
|
4
|
+
import { Message } from '../../types/index.js';
|
|
5
|
+
export interface SearchPostsGlobalOffset {
|
|
6
|
+
rate: number;
|
|
7
|
+
peer: tl.TypeInputPeer;
|
|
8
|
+
id: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Search for posts globally across all public channels in Telegram
|
|
12
|
+
*
|
|
13
|
+
* @param query Keyword to search for
|
|
14
|
+
* @param params Additional parameters
|
|
15
|
+
*/
|
|
16
|
+
export declare function searchPostsGlobal(client: ITelegramClient, query: string, params?: {
|
|
17
|
+
/** Offset for the search */
|
|
18
|
+
offset?: SearchPostsGlobalOffset;
|
|
19
|
+
/** Limit the number of results */
|
|
20
|
+
limit?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The amount of stars you are willing to pay for the search
|
|
23
|
+
*/
|
|
24
|
+
payStars?: tl.Long;
|
|
25
|
+
}): Promise<ArrayPaginatedWithMeta<Message, SearchPostsGlobalOffset, {
|
|
26
|
+
limits?: tl.TypeSearchPostsFlood;
|
|
27
|
+
}>>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { assertTypeIsNot } from "../../../utils/type-assertions.js";
|
|
2
|
+
import { makeArrayPaginatedWithMeta } from "../../utils/misc-utils.js";
|
|
3
|
+
import { PeersIndex } from "../../types/peers/peers-index.js";
|
|
4
|
+
import { Message as Message$2 } from "../../types/messages/message.js";
|
|
5
|
+
const defaultOffset = {
|
|
6
|
+
rate: 0,
|
|
7
|
+
peer: { _: "inputPeerEmpty" },
|
|
8
|
+
id: 0
|
|
9
|
+
};
|
|
10
|
+
async function searchPostsGlobal(client, query, params) {
|
|
11
|
+
const {
|
|
12
|
+
offset: { rate: offsetRate, peer: offsetPeer, id: offsetId } = defaultOffset,
|
|
13
|
+
limit = 100,
|
|
14
|
+
payStars
|
|
15
|
+
} = params ?? {};
|
|
16
|
+
const res = await client.call({
|
|
17
|
+
_: "channels.searchPosts",
|
|
18
|
+
query,
|
|
19
|
+
allowPaidStars: payStars,
|
|
20
|
+
offsetId,
|
|
21
|
+
offsetRate,
|
|
22
|
+
offsetPeer,
|
|
23
|
+
limit
|
|
24
|
+
});
|
|
25
|
+
assertTypeIsNot("searchHashtag", res, "messages.messagesNotModified");
|
|
26
|
+
const peers = PeersIndex.from(res);
|
|
27
|
+
const msgs = res.messages.filter((msg) => msg._ !== "messageEmpty").map((msg) => new Message$2(msg, peers));
|
|
28
|
+
const last = msgs[msgs.length - 1];
|
|
29
|
+
const next = last ? {
|
|
30
|
+
rate: res.nextRate ?? last.raw.date,
|
|
31
|
+
peer: last.chat.inputPeer,
|
|
32
|
+
id: last.id
|
|
33
|
+
} : void 0;
|
|
34
|
+
return makeArrayPaginatedWithMeta(
|
|
35
|
+
msgs,
|
|
36
|
+
res.count ?? msgs.length,
|
|
37
|
+
{ limits: res.searchFlood },
|
|
38
|
+
next
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
searchPostsGlobal
|
|
43
|
+
};
|
|
@@ -9,10 +9,20 @@ const Long = require("long");
|
|
|
9
9
|
const _normalizeInputStarGift = require("./_normalize-input-star-gift.cjs");
|
|
10
10
|
async function setResaleStarGiftPrice(client, params) {
|
|
11
11
|
const { gift, price } = params;
|
|
12
|
+
let starsAmount;
|
|
13
|
+
if (price === null) {
|
|
14
|
+
starsAmount = { _: "starsAmount", amount: Long.ZERO, nanos: 0 };
|
|
15
|
+
} else if (typeof price === "number") {
|
|
16
|
+
starsAmount = { _: "starsAmount", amount: Long.fromNumber(price), nanos: 0 };
|
|
17
|
+
} else if (Long.isLong(price)) {
|
|
18
|
+
starsAmount = { _: "starsAmount", amount: price, nanos: 0 };
|
|
19
|
+
} else {
|
|
20
|
+
starsAmount = price;
|
|
21
|
+
}
|
|
12
22
|
const r = await client.call({
|
|
13
23
|
_: "payments.updateStarGiftPrice",
|
|
14
24
|
stargift: await _normalizeInputStarGift._normalizeInputStarGift(client, gift),
|
|
15
|
-
|
|
25
|
+
resellAmount: starsAmount
|
|
16
26
|
});
|
|
17
27
|
client.handleClientUpdate(r);
|
|
18
28
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
1
2
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
3
|
import { InputStarGift } from '../../types/index.js';
|
|
3
4
|
/** Set resale price for an owned star gift */
|
|
4
5
|
export declare function setResaleStarGiftPrice(client: ITelegramClient, params: {
|
|
5
6
|
/** Star gift to update the price of */
|
|
6
7
|
gift: InputStarGift;
|
|
7
|
-
/**
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* New price of the gift (in stars), or `null` to unlist
|
|
10
|
+
*/
|
|
11
|
+
price: tl.Long | number | tl.TypeStarsAmount | null;
|
|
9
12
|
}): Promise<void>;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
1
2
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
3
|
import { InputStarGift } from '../../types/index.js';
|
|
3
4
|
/** Set resale price for an owned star gift */
|
|
4
5
|
export declare function setResaleStarGiftPrice(client: ITelegramClient, params: {
|
|
5
6
|
/** Star gift to update the price of */
|
|
6
7
|
gift: InputStarGift;
|
|
7
|
-
/**
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* New price of the gift (in stars), or `null` to unlist
|
|
10
|
+
*/
|
|
11
|
+
price: tl.Long | number | tl.TypeStarsAmount | null;
|
|
9
12
|
}): Promise<void>;
|
|
@@ -2,10 +2,20 @@ import Long from "long";
|
|
|
2
2
|
import { _normalizeInputStarGift } from "./_normalize-input-star-gift.js";
|
|
3
3
|
async function setResaleStarGiftPrice(client, params) {
|
|
4
4
|
const { gift, price } = params;
|
|
5
|
+
let starsAmount;
|
|
6
|
+
if (price === null) {
|
|
7
|
+
starsAmount = { _: "starsAmount", amount: Long.ZERO, nanos: 0 };
|
|
8
|
+
} else if (typeof price === "number") {
|
|
9
|
+
starsAmount = { _: "starsAmount", amount: Long.fromNumber(price), nanos: 0 };
|
|
10
|
+
} else if (Long.isLong(price)) {
|
|
11
|
+
starsAmount = { _: "starsAmount", amount: price, nanos: 0 };
|
|
12
|
+
} else {
|
|
13
|
+
starsAmount = price;
|
|
14
|
+
}
|
|
5
15
|
const r = await client.call({
|
|
6
16
|
_: "payments.updateStarGiftPrice",
|
|
7
17
|
stargift: await _normalizeInputStarGift(client, gift),
|
|
8
|
-
|
|
18
|
+
resellAmount: starsAmount
|
|
9
19
|
});
|
|
10
20
|
client.handleClientUpdate(r);
|
|
11
21
|
}
|
|
@@ -12,7 +12,7 @@ const normalizeText = require("../misc/normalize-text.cjs");
|
|
|
12
12
|
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
13
13
|
const findInUpdate = require("./find-in-update.cjs");
|
|
14
14
|
async function sendStory(client, params) {
|
|
15
|
-
const { peer = "me", pinned, forbidForwards, interactiveElements, period } = params;
|
|
15
|
+
const { peer = "me", pinned, forbidForwards, interactiveElements, period, addToAlbums } = params;
|
|
16
16
|
let { media } = params;
|
|
17
17
|
if (typeof media === "string") {
|
|
18
18
|
media = {
|
|
@@ -39,7 +39,8 @@ async function sendStory(client, params) {
|
|
|
39
39
|
entities,
|
|
40
40
|
privacyRules,
|
|
41
41
|
randomId: longUtils.randomLong(),
|
|
42
|
-
period
|
|
42
|
+
period,
|
|
43
|
+
albums: addToAlbums
|
|
43
44
|
});
|
|
44
45
|
return findInUpdate._findStoryInUpdate(client, res);
|
|
45
46
|
}
|
|
@@ -5,7 +5,7 @@ import { _normalizeInputText } from "../misc/normalize-text.js";
|
|
|
5
5
|
import { resolvePeer } from "../users/resolve-peer.js";
|
|
6
6
|
import { _findStoryInUpdate } from "./find-in-update.js";
|
|
7
7
|
async function sendStory(client, params) {
|
|
8
|
-
const { peer = "me", pinned, forbidForwards, interactiveElements, period } = params;
|
|
8
|
+
const { peer = "me", pinned, forbidForwards, interactiveElements, period, addToAlbums } = params;
|
|
9
9
|
let { media } = params;
|
|
10
10
|
if (typeof media === "string") {
|
|
11
11
|
media = {
|
|
@@ -32,7 +32,8 @@ async function sendStory(client, params) {
|
|
|
32
32
|
entities,
|
|
33
33
|
privacyRules,
|
|
34
34
|
randomId: randomLong(),
|
|
35
|
-
period
|
|
35
|
+
period,
|
|
36
|
+
albums: addToAlbums
|
|
36
37
|
});
|
|
37
38
|
return _findStoryInUpdate(client, res);
|
|
38
39
|
}
|
package/highlevel/methods.d.cts
CHANGED
|
@@ -174,6 +174,8 @@ export { iterSearchHashtag } from './methods/messages/search-hashtag.js';
|
|
|
174
174
|
export type { SearchHashtagOffset } from './methods/messages/search-hashtag.js';
|
|
175
175
|
export { searchMessages } from './methods/messages/search-messages.js';
|
|
176
176
|
export type { SearchMessagesOffset } from './methods/messages/search-messages.js';
|
|
177
|
+
export { searchPostsGlobal } from './methods/messages/search-posts-global.js';
|
|
178
|
+
export type { SearchPostsGlobalOffset } from './methods/messages/search-posts-global.js';
|
|
177
179
|
export { answerText } from './methods/messages/send-answer.js';
|
|
178
180
|
export { answerMedia } from './methods/messages/send-answer.js';
|
|
179
181
|
export { answerMediaGroup } from './methods/messages/send-answer.js';
|
package/highlevel/methods.d.ts
CHANGED
|
@@ -174,6 +174,8 @@ export { iterSearchHashtag } from './methods/messages/search-hashtag.js';
|
|
|
174
174
|
export type { SearchHashtagOffset } from './methods/messages/search-hashtag.js';
|
|
175
175
|
export { searchMessages } from './methods/messages/search-messages.js';
|
|
176
176
|
export type { SearchMessagesOffset } from './methods/messages/search-messages.js';
|
|
177
|
+
export { searchPostsGlobal } from './methods/messages/search-posts-global.js';
|
|
178
|
+
export type { SearchPostsGlobalOffset } from './methods/messages/search-posts-global.js';
|
|
177
179
|
export { answerText } from './methods/messages/send-answer.js';
|
|
178
180
|
export { answerMedia } from './methods/messages/send-answer.js';
|
|
179
181
|
export { answerMediaGroup } from './methods/messages/send-answer.js';
|
|
@@ -321,7 +321,8 @@ function _messageActionFromTl(act) {
|
|
|
321
321
|
upgradeStars: Long.ZERO,
|
|
322
322
|
upgradeMsgId: null,
|
|
323
323
|
canTransferSince: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
|
|
324
|
-
resaleStars: act.
|
|
324
|
+
resaleStars: act.resaleAmount?._ === "starsAmount" ? act.resaleAmount.amount : void 0,
|
|
325
|
+
resaleTon: act.resaleAmount?._ === "starsTonAmount" ? act.resaleAmount.amount : void 0,
|
|
325
326
|
canResellAt: act.canResellAt ? new Date(act.canResellAt * 1e3) : void 0,
|
|
326
327
|
fromId: act.fromId ? peerUtils.getMarkedPeerId(act.fromId) : void 0,
|
|
327
328
|
toId: act.peer ? peerUtils.getMarkedPeerId(act.peer) : void 0,
|
|
@@ -426,6 +426,8 @@ export interface ActionStarGift {
|
|
|
426
426
|
canTransferSince?: Date;
|
|
427
427
|
/** Number of stars this gift is up for resell for */
|
|
428
428
|
resaleStars?: tl.Long;
|
|
429
|
+
/** Number of nanoton this gift is up for resell for */
|
|
430
|
+
resaleTon?: tl.Long;
|
|
429
431
|
/** If the gift can be re-sold, date when it will become available */
|
|
430
432
|
canResellAt?: Date;
|
|
431
433
|
/** The gift itself */
|
|
@@ -426,6 +426,8 @@ export interface ActionStarGift {
|
|
|
426
426
|
canTransferSince?: Date;
|
|
427
427
|
/** Number of stars this gift is up for resell for */
|
|
428
428
|
resaleStars?: tl.Long;
|
|
429
|
+
/** Number of nanoton this gift is up for resell for */
|
|
430
|
+
resaleTon?: tl.Long;
|
|
429
431
|
/** If the gift can be re-sold, date when it will become available */
|
|
430
432
|
canResellAt?: Date;
|
|
431
433
|
/** The gift itself */
|
|
@@ -314,7 +314,8 @@ function _messageActionFromTl(act) {
|
|
|
314
314
|
upgradeStars: Long.ZERO,
|
|
315
315
|
upgradeMsgId: null,
|
|
316
316
|
canTransferSince: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
|
|
317
|
-
resaleStars: act.
|
|
317
|
+
resaleStars: act.resaleAmount?._ === "starsAmount" ? act.resaleAmount.amount : void 0,
|
|
318
|
+
resaleTon: act.resaleAmount?._ === "starsTonAmount" ? act.resaleAmount.amount : void 0,
|
|
318
319
|
canResellAt: act.canResellAt ? new Date(act.canResellAt * 1e3) : void 0,
|
|
319
320
|
fromId: act.fromId ? getMarkedPeerId(act.fromId) : void 0,
|
|
320
321
|
toId: act.peer ? getMarkedPeerId(act.peer) : void 0,
|
|
@@ -222,6 +222,18 @@ class FullUser extends user.User {
|
|
|
222
222
|
get starsRating() {
|
|
223
223
|
return this.full.starsRating ?? null;
|
|
224
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Information about the user's stars rating
|
|
227
|
+
*
|
|
228
|
+
* Only available for the current user
|
|
229
|
+
*/
|
|
230
|
+
get starsRatingPending() {
|
|
231
|
+
if (!this.full.starsMyPendingRating) return null;
|
|
232
|
+
return {
|
|
233
|
+
rating: this.full.starsMyPendingRating,
|
|
234
|
+
date: new Date(this.full.starsMyPendingRatingDate * 1e3)
|
|
235
|
+
};
|
|
236
|
+
}
|
|
225
237
|
}
|
|
226
238
|
const FullUser$1 = /* @__PURE__ */ memoize.memoizeGetters(FullUser, [
|
|
227
239
|
"fullPhoto",
|
|
@@ -230,7 +242,8 @@ const FullUser$1 = /* @__PURE__ */ memoize.memoizeGetters(FullUser, [
|
|
|
230
242
|
"publicPhoto",
|
|
231
243
|
"personalChannel",
|
|
232
244
|
"business",
|
|
233
|
-
"botVerification"
|
|
245
|
+
"botVerification",
|
|
246
|
+
"starsRatingPending"
|
|
234
247
|
]);
|
|
235
248
|
const FullUser$2 = /* @__PURE__ */ inspectable.makeInspectable(FullUser$1);
|
|
236
249
|
exports.FullUser = FullUser$2;
|
|
@@ -123,4 +123,13 @@ export declare class FullUser extends User {
|
|
|
123
123
|
* Information about the user's stars rating
|
|
124
124
|
*/
|
|
125
125
|
get starsRating(): tl.RawStarsRating | null;
|
|
126
|
+
/**
|
|
127
|
+
* Information about the user's stars rating
|
|
128
|
+
*
|
|
129
|
+
* Only available for the current user
|
|
130
|
+
*/
|
|
131
|
+
get starsRatingPending(): {
|
|
132
|
+
rating: tl.RawStarsRating;
|
|
133
|
+
date: Date;
|
|
134
|
+
} | null;
|
|
126
135
|
}
|
|
@@ -123,4 +123,13 @@ export declare class FullUser extends User {
|
|
|
123
123
|
* Information about the user's stars rating
|
|
124
124
|
*/
|
|
125
125
|
get starsRating(): tl.RawStarsRating | null;
|
|
126
|
+
/**
|
|
127
|
+
* Information about the user's stars rating
|
|
128
|
+
*
|
|
129
|
+
* Only available for the current user
|
|
130
|
+
*/
|
|
131
|
+
get starsRatingPending(): {
|
|
132
|
+
rating: tl.RawStarsRating;
|
|
133
|
+
date: Date;
|
|
134
|
+
} | null;
|
|
126
135
|
}
|
|
@@ -215,6 +215,18 @@ class FullUser extends User$2 {
|
|
|
215
215
|
get starsRating() {
|
|
216
216
|
return this.full.starsRating ?? null;
|
|
217
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Information about the user's stars rating
|
|
220
|
+
*
|
|
221
|
+
* Only available for the current user
|
|
222
|
+
*/
|
|
223
|
+
get starsRatingPending() {
|
|
224
|
+
if (!this.full.starsMyPendingRating) return null;
|
|
225
|
+
return {
|
|
226
|
+
rating: this.full.starsMyPendingRating,
|
|
227
|
+
date: new Date(this.full.starsMyPendingRatingDate * 1e3)
|
|
228
|
+
};
|
|
229
|
+
}
|
|
218
230
|
}
|
|
219
231
|
const FullUser$1 = /* @__PURE__ */ memoizeGetters(FullUser, [
|
|
220
232
|
"fullPhoto",
|
|
@@ -223,7 +235,8 @@ const FullUser$1 = /* @__PURE__ */ memoizeGetters(FullUser, [
|
|
|
223
235
|
"publicPhoto",
|
|
224
236
|
"personalChannel",
|
|
225
237
|
"business",
|
|
226
|
-
"botVerification"
|
|
238
|
+
"botVerification",
|
|
239
|
+
"starsRatingPending"
|
|
227
240
|
]);
|
|
228
241
|
const FullUser$2 = /* @__PURE__ */ makeInspectable(FullUser$1);
|
|
229
242
|
export {
|
|
@@ -172,9 +172,16 @@ class StarGiftUnique {
|
|
|
172
172
|
get availabilityTotal() {
|
|
173
173
|
return this.raw.availabilityTotal;
|
|
174
174
|
}
|
|
175
|
+
// todo for breaking: rename to resellPriceStars
|
|
175
176
|
/** Number of stars this gift is up for resell for */
|
|
176
177
|
get resellPrice() {
|
|
177
|
-
|
|
178
|
+
const resellPriceStars = this.raw.resellAmount?.find((it) => it._ === "starsAmount");
|
|
179
|
+
return resellPriceStars?.amount ?? null;
|
|
180
|
+
}
|
|
181
|
+
/** Number of nanoton this gift is up for resell for */
|
|
182
|
+
get resellPriceTon() {
|
|
183
|
+
const resellPriceTon = this.raw.resellAmount?.find((it) => it._ === "starsTonAmount");
|
|
184
|
+
return resellPriceTon?.amount ?? null;
|
|
178
185
|
}
|
|
179
186
|
/** Model (i.e. the gift itself) of the unique star gift */
|
|
180
187
|
get model() {
|
|
@@ -89,6 +89,8 @@ export declare class StarGiftUnique {
|
|
|
89
89
|
get availabilityTotal(): number;
|
|
90
90
|
/** Number of stars this gift is up for resell for */
|
|
91
91
|
get resellPrice(): tl.Long | null;
|
|
92
|
+
/** Number of nanoton this gift is up for resell for */
|
|
93
|
+
get resellPriceTon(): tl.Long | null;
|
|
92
94
|
/** Model (i.e. the gift itself) of the unique star gift */
|
|
93
95
|
get model(): StarGiftUniqueAttribute;
|
|
94
96
|
/** Pattern of the unique star gift */
|
|
@@ -89,6 +89,8 @@ export declare class StarGiftUnique {
|
|
|
89
89
|
get availabilityTotal(): number;
|
|
90
90
|
/** Number of stars this gift is up for resell for */
|
|
91
91
|
get resellPrice(): tl.Long | null;
|
|
92
|
+
/** Number of nanoton this gift is up for resell for */
|
|
93
|
+
get resellPriceTon(): tl.Long | null;
|
|
92
94
|
/** Model (i.e. the gift itself) of the unique star gift */
|
|
93
95
|
get model(): StarGiftUniqueAttribute;
|
|
94
96
|
/** Pattern of the unique star gift */
|
|
@@ -165,9 +165,16 @@ class StarGiftUnique {
|
|
|
165
165
|
get availabilityTotal() {
|
|
166
166
|
return this.raw.availabilityTotal;
|
|
167
167
|
}
|
|
168
|
+
// todo for breaking: rename to resellPriceStars
|
|
168
169
|
/** Number of stars this gift is up for resell for */
|
|
169
170
|
get resellPrice() {
|
|
170
|
-
|
|
171
|
+
const resellPriceStars = this.raw.resellAmount?.find((it) => it._ === "starsAmount");
|
|
172
|
+
return resellPriceStars?.amount ?? null;
|
|
173
|
+
}
|
|
174
|
+
/** Number of nanoton this gift is up for resell for */
|
|
175
|
+
get resellPriceTon() {
|
|
176
|
+
const resellPriceTon = this.raw.resellAmount?.find((it) => it._ === "starsTonAmount");
|
|
177
|
+
return resellPriceTon?.amount ?? null;
|
|
171
178
|
}
|
|
172
179
|
/** Model (i.e. the gift itself) of the unique star gift */
|
|
173
180
|
get model() {
|
|
@@ -135,6 +135,12 @@ class Story {
|
|
|
135
135
|
if (!this.raw.sentReaction) return null;
|
|
136
136
|
return types.toReactionEmoji(this.raw.sentReaction, true);
|
|
137
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Albums this story belongs to
|
|
140
|
+
*/
|
|
141
|
+
get albums() {
|
|
142
|
+
return this.raw.albums ?? [];
|
|
143
|
+
}
|
|
138
144
|
}
|
|
139
145
|
const Story$1 = /* @__PURE__ */ memoize.memoizeGetters(Story, ["entities", "media", "interactiveElements", "interactions"]);
|
|
140
146
|
const Story$2 = /* @__PURE__ */ inspectable.makeInspectable(Story$1);
|
|
@@ -128,6 +128,12 @@ class Story {
|
|
|
128
128
|
if (!this.raw.sentReaction) return null;
|
|
129
129
|
return toReactionEmoji(this.raw.sentReaction, true);
|
|
130
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Albums this story belongs to
|
|
133
|
+
*/
|
|
134
|
+
get albums() {
|
|
135
|
+
return this.raw.albums ?? [];
|
|
136
|
+
}
|
|
131
137
|
}
|
|
132
138
|
const Story$1 = /* @__PURE__ */ memoizeGetters(Story, ["entities", "media", "interactiveElements", "interactions"]);
|
|
133
139
|
const Story$2 = /* @__PURE__ */ makeInspectable(Story$1);
|
package/methods.cjs
CHANGED
|
@@ -161,6 +161,7 @@ const readReactions = require("./highlevel/methods/messages/read-reactions.cjs")
|
|
|
161
161
|
const searchGlobal = require("./highlevel/methods/messages/search-global.cjs");
|
|
162
162
|
const searchHashtag = require("./highlevel/methods/messages/search-hashtag.cjs");
|
|
163
163
|
const searchMessages = require("./highlevel/methods/messages/search-messages.cjs");
|
|
164
|
+
const searchPostsGlobal = require("./highlevel/methods/messages/search-posts-global.cjs");
|
|
164
165
|
const sendAnswer = require("./highlevel/methods/messages/send-answer.cjs");
|
|
165
166
|
const sendComment = require("./highlevel/methods/messages/send-comment.cjs");
|
|
166
167
|
const sendCopyGroup = require("./highlevel/methods/messages/send-copy-group.cjs");
|
|
@@ -437,6 +438,7 @@ exports.searchGlobal = searchGlobal.searchGlobal;
|
|
|
437
438
|
exports.iterSearchHashtag = searchHashtag.iterSearchHashtag;
|
|
438
439
|
exports.searchHashtag = searchHashtag.searchHashtag;
|
|
439
440
|
exports.searchMessages = searchMessages.searchMessages;
|
|
441
|
+
exports.searchPostsGlobal = searchPostsGlobal.searchPostsGlobal;
|
|
440
442
|
exports.answerMedia = sendAnswer.answerMedia;
|
|
441
443
|
exports.answerMediaGroup = sendAnswer.answerMediaGroup;
|
|
442
444
|
exports.answerText = sendAnswer.answerText;
|
package/methods.js
CHANGED
|
@@ -154,6 +154,7 @@ import { readReactions } from "./highlevel/methods/messages/read-reactions.js";
|
|
|
154
154
|
import { searchGlobal } from "./highlevel/methods/messages/search-global.js";
|
|
155
155
|
import { iterSearchHashtag, searchHashtag } from "./highlevel/methods/messages/search-hashtag.js";
|
|
156
156
|
import { searchMessages } from "./highlevel/methods/messages/search-messages.js";
|
|
157
|
+
import { searchPostsGlobal } from "./highlevel/methods/messages/search-posts-global.js";
|
|
157
158
|
import { answerMedia, answerMediaGroup, answerText } from "./highlevel/methods/messages/send-answer.js";
|
|
158
159
|
import { commentMedia, commentMediaGroup, commentText } from "./highlevel/methods/messages/send-comment.js";
|
|
159
160
|
import { sendCopyGroup } from "./highlevel/methods/messages/send-copy-group.js";
|
|
@@ -483,6 +484,7 @@ export {
|
|
|
483
484
|
searchGlobal,
|
|
484
485
|
searchHashtag,
|
|
485
486
|
searchMessages,
|
|
487
|
+
searchPostsGlobal,
|
|
486
488
|
sendCode,
|
|
487
489
|
sendCopy,
|
|
488
490
|
sendCopyGroup,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtcute/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.25.
|
|
4
|
+
"version": "0.25.7",
|
|
5
5
|
"description": "Type-safe library for MTProto (Telegram API)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@fuman/net": "0.0.15",
|
|
11
11
|
"@fuman/utils": "0.0.15",
|
|
12
12
|
"@mtcute/file-id": "^0.24.3",
|
|
13
|
-
"@mtcute/tl": "^
|
|
13
|
+
"@mtcute/tl": "^211.0.0",
|
|
14
14
|
"@mtcute/tl-runtime": "^0.24.3",
|
|
15
15
|
"@types/events": "3.0.0",
|
|
16
16
|
"long": "5.2.3"
|
package/utils/binary/compat.cjs
CHANGED
|
@@ -33,6 +33,16 @@ function mapCompatStarGift(obj) {
|
|
|
33
33
|
case "starGiftUnique_layer202":
|
|
34
34
|
case "starGiftUnique_layer206":
|
|
35
35
|
return replaceType(obj, "starGiftUnique");
|
|
36
|
+
case "starGiftUnique_layer210":
|
|
37
|
+
return {
|
|
38
|
+
...obj,
|
|
39
|
+
_: "starGiftUnique",
|
|
40
|
+
resellAmount: obj.resellStars ? [{
|
|
41
|
+
_: "starsAmount",
|
|
42
|
+
amount: obj.resellStars,
|
|
43
|
+
nanos: 0
|
|
44
|
+
}] : void 0
|
|
45
|
+
};
|
|
36
46
|
case "starGift_layer202":
|
|
37
47
|
case "starGift_layer206":
|
|
38
48
|
case "starGift_layer209":
|
|
@@ -70,6 +80,17 @@ function mapCompatMessageAction(obj) {
|
|
|
70
80
|
_: "messageActionStarGiftUnique",
|
|
71
81
|
gift: mapCompatStarGift(obj.gift)
|
|
72
82
|
};
|
|
83
|
+
case "messageActionStarGiftUnique_layer210":
|
|
84
|
+
return {
|
|
85
|
+
...obj,
|
|
86
|
+
_: "messageActionStarGiftUnique",
|
|
87
|
+
gift: mapCompatStarGift(obj.gift),
|
|
88
|
+
resaleAmount: obj.resaleStars ? {
|
|
89
|
+
_: "starsAmount",
|
|
90
|
+
amount: obj.resaleStars,
|
|
91
|
+
nanos: 0
|
|
92
|
+
} : void 0
|
|
93
|
+
};
|
|
73
94
|
case "messageActionStarGift_layer197":
|
|
74
95
|
return {
|
|
75
96
|
...obj,
|
|
@@ -124,6 +145,7 @@ function mapCompatObject(obj) {
|
|
|
124
145
|
case "starGift_layer202":
|
|
125
146
|
case "starGift_layer206":
|
|
126
147
|
case "starGift_layer209":
|
|
148
|
+
case "starGiftUnique_layer210":
|
|
127
149
|
return mapCompatStarGift(obj);
|
|
128
150
|
case "emojiStatus_layer197":
|
|
129
151
|
return mapCompatEmojiStatus(obj);
|
|
@@ -136,11 +158,13 @@ function mapCompatObject(obj) {
|
|
|
136
158
|
case "messageActionStarGift_layer197":
|
|
137
159
|
case "messageActionStarGiftUnique_layer202":
|
|
138
160
|
case "messageActionPaidMessagesPrice_layer203":
|
|
161
|
+
case "messageActionStarGiftUnique_layer210":
|
|
139
162
|
return mapCompatMessageAction(obj);
|
|
140
163
|
case "userFull_layer199":
|
|
141
164
|
return replaceType(dropFields(obj, ["premiumGifts"]), "userFull");
|
|
142
165
|
case "userFull_layer200":
|
|
143
166
|
case "userFull_layer209":
|
|
167
|
+
case "userFull_layer210":
|
|
144
168
|
return replaceType(obj, "userFull");
|
|
145
169
|
case "user_layer199":
|
|
146
170
|
return {
|
|
@@ -163,6 +187,12 @@ function mapCompatObject(obj) {
|
|
|
163
187
|
return mapCompatMessage(obj);
|
|
164
188
|
case "messageReplyHeader_layer206":
|
|
165
189
|
return mapMessageReplyHeader(obj);
|
|
190
|
+
case "storyItem_layer210":
|
|
191
|
+
return {
|
|
192
|
+
...obj,
|
|
193
|
+
_: "storyItem",
|
|
194
|
+
media: mapCompatMessageMedia(obj.media)
|
|
195
|
+
};
|
|
166
196
|
default:
|
|
167
197
|
return obj;
|
|
168
198
|
}
|
package/utils/binary/compat.js
CHANGED
|
@@ -26,6 +26,16 @@ function mapCompatStarGift(obj) {
|
|
|
26
26
|
case "starGiftUnique_layer202":
|
|
27
27
|
case "starGiftUnique_layer206":
|
|
28
28
|
return replaceType(obj, "starGiftUnique");
|
|
29
|
+
case "starGiftUnique_layer210":
|
|
30
|
+
return {
|
|
31
|
+
...obj,
|
|
32
|
+
_: "starGiftUnique",
|
|
33
|
+
resellAmount: obj.resellStars ? [{
|
|
34
|
+
_: "starsAmount",
|
|
35
|
+
amount: obj.resellStars,
|
|
36
|
+
nanos: 0
|
|
37
|
+
}] : void 0
|
|
38
|
+
};
|
|
29
39
|
case "starGift_layer202":
|
|
30
40
|
case "starGift_layer206":
|
|
31
41
|
case "starGift_layer209":
|
|
@@ -63,6 +73,17 @@ function mapCompatMessageAction(obj) {
|
|
|
63
73
|
_: "messageActionStarGiftUnique",
|
|
64
74
|
gift: mapCompatStarGift(obj.gift)
|
|
65
75
|
};
|
|
76
|
+
case "messageActionStarGiftUnique_layer210":
|
|
77
|
+
return {
|
|
78
|
+
...obj,
|
|
79
|
+
_: "messageActionStarGiftUnique",
|
|
80
|
+
gift: mapCompatStarGift(obj.gift),
|
|
81
|
+
resaleAmount: obj.resaleStars ? {
|
|
82
|
+
_: "starsAmount",
|
|
83
|
+
amount: obj.resaleStars,
|
|
84
|
+
nanos: 0
|
|
85
|
+
} : void 0
|
|
86
|
+
};
|
|
66
87
|
case "messageActionStarGift_layer197":
|
|
67
88
|
return {
|
|
68
89
|
...obj,
|
|
@@ -117,6 +138,7 @@ function mapCompatObject(obj) {
|
|
|
117
138
|
case "starGift_layer202":
|
|
118
139
|
case "starGift_layer206":
|
|
119
140
|
case "starGift_layer209":
|
|
141
|
+
case "starGiftUnique_layer210":
|
|
120
142
|
return mapCompatStarGift(obj);
|
|
121
143
|
case "emojiStatus_layer197":
|
|
122
144
|
return mapCompatEmojiStatus(obj);
|
|
@@ -129,11 +151,13 @@ function mapCompatObject(obj) {
|
|
|
129
151
|
case "messageActionStarGift_layer197":
|
|
130
152
|
case "messageActionStarGiftUnique_layer202":
|
|
131
153
|
case "messageActionPaidMessagesPrice_layer203":
|
|
154
|
+
case "messageActionStarGiftUnique_layer210":
|
|
132
155
|
return mapCompatMessageAction(obj);
|
|
133
156
|
case "userFull_layer199":
|
|
134
157
|
return replaceType(dropFields(obj, ["premiumGifts"]), "userFull");
|
|
135
158
|
case "userFull_layer200":
|
|
136
159
|
case "userFull_layer209":
|
|
160
|
+
case "userFull_layer210":
|
|
137
161
|
return replaceType(obj, "userFull");
|
|
138
162
|
case "user_layer199":
|
|
139
163
|
return {
|
|
@@ -156,6 +180,12 @@ function mapCompatObject(obj) {
|
|
|
156
180
|
return mapCompatMessage(obj);
|
|
157
181
|
case "messageReplyHeader_layer206":
|
|
158
182
|
return mapMessageReplyHeader(obj);
|
|
183
|
+
case "storyItem_layer210":
|
|
184
|
+
return {
|
|
185
|
+
...obj,
|
|
186
|
+
_: "storyItem",
|
|
187
|
+
media: mapCompatMessageMedia(obj.media)
|
|
188
|
+
};
|
|
159
189
|
default:
|
|
160
190
|
return obj;
|
|
161
191
|
}
|