@mtcute/core 0.25.6 → 0.25.8

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.
Files changed (69) hide show
  1. package/client.cjs +7 -0
  2. package/client.js +8 -1
  3. package/highlevel/client.d.cts +61 -4
  4. package/highlevel/client.d.ts +61 -4
  5. package/highlevel/methods/files/normalize-input-media.cjs +13 -4
  6. package/highlevel/methods/files/normalize-input-media.js +13 -4
  7. package/highlevel/methods/messages/search-posts-global.cjs +48 -0
  8. package/highlevel/methods/messages/search-posts-global.d.cts +27 -0
  9. package/highlevel/methods/messages/search-posts-global.d.ts +27 -0
  10. package/highlevel/methods/messages/search-posts-global.js +43 -0
  11. package/highlevel/methods/premium/buy-resale-gift.cjs +3 -2
  12. package/highlevel/methods/premium/buy-resale-gift.d.cts +2 -0
  13. package/highlevel/methods/premium/buy-resale-gift.d.ts +2 -0
  14. package/highlevel/methods/premium/buy-resale-gift.js +3 -2
  15. package/highlevel/methods/premium/get-resale-star-gifts.cjs +5 -1
  16. package/highlevel/methods/premium/get-resale-star-gifts.d.cts +7 -1
  17. package/highlevel/methods/premium/get-resale-star-gifts.d.ts +7 -1
  18. package/highlevel/methods/premium/get-resale-star-gifts.js +6 -2
  19. package/highlevel/methods/premium/set-gift-resale-price.cjs +11 -1
  20. package/highlevel/methods/premium/set-gift-resale-price.d.cts +5 -2
  21. package/highlevel/methods/premium/set-gift-resale-price.d.ts +5 -2
  22. package/highlevel/methods/premium/set-gift-resale-price.js +11 -1
  23. package/highlevel/methods/stories/send-story.cjs +3 -2
  24. package/highlevel/methods/stories/send-story.d.cts +4 -0
  25. package/highlevel/methods/stories/send-story.d.ts +4 -0
  26. package/highlevel/methods/stories/send-story.js +3 -2
  27. package/highlevel/methods.d.cts +3 -0
  28. package/highlevel/methods.d.ts +3 -0
  29. package/highlevel/types/messages/message-action.cjs +2 -1
  30. package/highlevel/types/messages/message-action.d.cts +2 -0
  31. package/highlevel/types/messages/message-action.d.ts +2 -0
  32. package/highlevel/types/messages/message-action.js +2 -1
  33. package/highlevel/types/peers/chat.cjs +5 -1
  34. package/highlevel/types/peers/chat.d.cts +5 -1
  35. package/highlevel/types/peers/chat.d.ts +5 -1
  36. package/highlevel/types/peers/chat.js +5 -1
  37. package/highlevel/types/peers/full-chat.cjs +4 -0
  38. package/highlevel/types/peers/full-chat.d.cts +2 -0
  39. package/highlevel/types/peers/full-chat.d.ts +2 -0
  40. package/highlevel/types/peers/full-chat.js +4 -0
  41. package/highlevel/types/peers/full-user.cjs +14 -1
  42. package/highlevel/types/peers/full-user.d.cts +9 -0
  43. package/highlevel/types/peers/full-user.d.ts +9 -0
  44. package/highlevel/types/peers/full-user.js +14 -1
  45. package/highlevel/types/premium/stars-gift-unique.cjs +8 -1
  46. package/highlevel/types/premium/stars-gift-unique.d.cts +2 -0
  47. package/highlevel/types/premium/stars-gift-unique.d.ts +2 -0
  48. package/highlevel/types/premium/stars-gift-unique.js +8 -1
  49. package/highlevel/types/stories/story.cjs +6 -0
  50. package/highlevel/types/stories/story.d.cts +4 -0
  51. package/highlevel/types/stories/story.d.ts +4 -0
  52. package/highlevel/types/stories/story.js +6 -0
  53. package/methods.cjs +3 -0
  54. package/methods.js +4 -1
  55. package/network/mtproto-session.cjs +1 -0
  56. package/network/mtproto-session.d.cts +1 -0
  57. package/network/mtproto-session.d.ts +1 -0
  58. package/network/mtproto-session.js +1 -0
  59. package/network/network-manager.cjs +1 -1
  60. package/network/network-manager.js +1 -1
  61. package/network/session-connection.cjs +27 -10
  62. package/network/session-connection.d.cts +1 -0
  63. package/network/session-connection.d.ts +1 -0
  64. package/network/session-connection.js +27 -10
  65. package/package.json +2 -2
  66. package/utils/binary/compat.cjs +30 -0
  67. package/utils/binary/compat.js +30 -0
  68. package/utils/binary/serialization.d.cts +3 -3
  69. package/utils/binary/serialization.d.ts +3 -3
@@ -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",
@@ -10,4 +10,6 @@ export declare function buyResaleGift(client: ITelegramClient, params: {
10
10
  * to the client's update handler.
11
11
  */
12
12
  shouldDispatch?: true;
13
+ /** Whether to use TON currency for payment */
14
+ ton?: boolean;
13
15
  }): Promise<Message | null>;
@@ -10,4 +10,6 @@ export declare function buyResaleGift(client: ITelegramClient, params: {
10
10
  * to the client's update handler.
11
11
  */
12
12
  shouldDispatch?: true;
13
+ /** Whether to use TON currency for payment */
14
+ ton?: boolean;
13
15
  }): Promise<Message | null>;
@@ -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 getResaleOptions(client, params) {
66
+ async function getStarGiftResaleOptions(client, params) {
67
67
  const res = await client.call({
68
68
  _: "payments.getResaleStarGifts",
69
69
  sortByNum: params.sort === "num",
@@ -103,5 +103,9 @@ async function getResaleOptions(client, params) {
103
103
  res.nextOffset
104
104
  );
105
105
  }
106
+ async function getResaleOptions(client, params) {
107
+ return getStarGiftResaleOptions(client, params);
108
+ }
106
109
  exports._normalizeResaleAttributes = _normalizeResaleAttributes;
107
110
  exports.getResaleOptions = getResaleOptions;
111
+ 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 getResaleOptions(client: ITelegramClient, params: {
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
  /**
@@ -43,3 +43,9 @@ export declare function getResaleOptions(client: ITelegramClient, params: {
43
43
  /** Limit for pagination */
44
44
  limit?: number;
45
45
  }): Promise<ArrayPaginatedWithMeta<StarGiftUnique, string, ResaleStarGiftsMeta>>;
46
+ /**
47
+ * Get a list of star gifts up for resale
48
+ *
49
+ * @deprecated Deprecated alias, use `getStarGiftResaleOptions` instead
50
+ */
51
+ export declare function getResaleOptions(client: ITelegramClient, params: Parameters<typeof getStarGiftResaleOptions>[1]): Promise<ArrayPaginatedWithMeta<StarGiftUnique, string, ResaleStarGiftsMeta>>;
@@ -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 getResaleOptions(client: ITelegramClient, params: {
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
  /**
@@ -43,3 +43,9 @@ export declare function getResaleOptions(client: ITelegramClient, params: {
43
43
  /** Limit for pagination */
44
44
  limit?: number;
45
45
  }): Promise<ArrayPaginatedWithMeta<StarGiftUnique, string, ResaleStarGiftsMeta>>;
46
+ /**
47
+ * Get a list of star gifts up for resale
48
+ *
49
+ * @deprecated Deprecated alias, use `getStarGiftResaleOptions` instead
50
+ */
51
+ export declare function getResaleOptions(client: ITelegramClient, params: Parameters<typeof getStarGiftResaleOptions>[1]): Promise<ArrayPaginatedWithMeta<StarGiftUnique, string, ResaleStarGiftsMeta>>;
@@ -56,7 +56,7 @@ function _normalizeResaleAttributes(attrs) {
56
56
  }
57
57
  return res;
58
58
  }
59
- async function getResaleOptions(client, params) {
59
+ async function getStarGiftResaleOptions(client, params) {
60
60
  const res = await client.call({
61
61
  _: "payments.getResaleStarGifts",
62
62
  sortByNum: params.sort === "num",
@@ -96,7 +96,11 @@ async function getResaleOptions(client, params) {
96
96
  res.nextOffset
97
97
  );
98
98
  }
99
+ async function getResaleOptions(client, params) {
100
+ return getStarGiftResaleOptions(client, params);
101
+ }
99
102
  export {
100
103
  _normalizeResaleAttributes,
101
- getResaleOptions
104
+ getResaleOptions,
105
+ getStarGiftResaleOptions
102
106
  };
@@ -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
- resellStars: price === null ? Long.ZERO : Long.fromNumber(price)
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
- /** New price of the gift (in stars), or `null` to unlist */
8
- price: number | null;
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
- /** New price of the gift (in stars), or `null` to unlist */
8
- price: number | null;
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
- resellStars: price === null ? Long.ZERO : Long.fromNumber(price)
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
  }
@@ -48,4 +48,8 @@ export declare function sendStory(client: ITelegramClient, params: {
48
48
  * @default 86400
49
49
  */
50
50
  period?: number;
51
+ /**
52
+ * IDs of albums to add the story to
53
+ */
54
+ addToAlbums?: number[];
51
55
  }): Promise<Story>;
@@ -48,4 +48,8 @@ export declare function sendStory(client: ITelegramClient, params: {
48
48
  * @default 86400
49
49
  */
50
50
  period?: number;
51
+ /**
52
+ * IDs of albums to add the story to
53
+ */
54
+ addToAlbums?: number[];
51
55
  }): Promise<Story>;
@@ -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
  }
@@ -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';
@@ -229,6 +231,7 @@ export { getBoosts } from './methods/premium/get-boosts.js';
229
231
  export { getBusinessChatLinks } from './methods/premium/get-business-chat-links.js';
230
232
  export { getBusinessConnection } from './methods/premium/get-business-connection.js';
231
233
  export { getMyBoostSlots } from './methods/premium/get-my-boost-slots.js';
234
+ export { getStarGiftResaleOptions } from './methods/premium/get-resale-star-gifts.js';
232
235
  export { getResaleOptions } from './methods/premium/get-resale-star-gifts.js';
233
236
  export type { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/premium/get-resale-star-gifts.js';
234
237
  export { getSavedStarGiftsById } from './methods/premium/get-saved-star-gifts-by-id.js';
@@ -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';
@@ -229,6 +231,7 @@ export { getBoosts } from './methods/premium/get-boosts.js';
229
231
  export { getBusinessChatLinks } from './methods/premium/get-business-chat-links.js';
230
232
  export { getBusinessConnection } from './methods/premium/get-business-connection.js';
231
233
  export { getMyBoostSlots } from './methods/premium/get-my-boost-slots.js';
234
+ export { getStarGiftResaleOptions } from './methods/premium/get-resale-star-gifts.js';
232
235
  export { getResaleOptions } from './methods/premium/get-resale-star-gifts.js';
233
236
  export type { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/premium/get-resale-star-gifts.js';
234
237
  export { getSavedStarGiftsById } from './methods/premium/get-saved-star-gifts-by-id.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.resaleStars,
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.resaleStars,
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,
@@ -398,7 +398,11 @@ class Chat {
398
398
  if (this.raw._ !== "channelForbidden" || !this.raw.untilDate) return null;
399
399
  return new Date(this.raw.untilDate * 1e3);
400
400
  }
401
- /** Number of members in this chat (if available) */
401
+ /**
402
+ * Number of members in this chat (if available)
403
+ *
404
+ * If not available, try fetching a full chat info with {@link TelegramClient.getFullChat}
405
+ */
402
406
  get membersCount() {
403
407
  return "participantsCount" in this.raw ? this.raw.participantsCount ?? null : null;
404
408
  }
@@ -227,7 +227,11 @@ export declare class Chat {
227
227
  * Returns `null` if the user is not banned, or if the ban is permanent
228
228
  */
229
229
  get bannedUntilDate(): Date | null;
230
- /** Number of members in this chat (if available) */
230
+ /**
231
+ * Number of members in this chat (if available)
232
+ *
233
+ * If not available, try fetching a full chat info with {@link TelegramClient.getFullChat}
234
+ */
231
235
  get membersCount(): number | null;
232
236
  /**
233
237
  * If this chat is a basic group that has been migrated to a supergroup,
@@ -227,7 +227,11 @@ export declare class Chat {
227
227
  * Returns `null` if the user is not banned, or if the ban is permanent
228
228
  */
229
229
  get bannedUntilDate(): Date | null;
230
- /** Number of members in this chat (if available) */
230
+ /**
231
+ * Number of members in this chat (if available)
232
+ *
233
+ * If not available, try fetching a full chat info with {@link TelegramClient.getFullChat}
234
+ */
231
235
  get membersCount(): number | null;
232
236
  /**
233
237
  * If this chat is a basic group that has been migrated to a supergroup,
@@ -391,7 +391,11 @@ class Chat {
391
391
  if (this.raw._ !== "channelForbidden" || !this.raw.untilDate) return null;
392
392
  return new Date(this.raw.untilDate * 1e3);
393
393
  }
394
- /** Number of members in this chat (if available) */
394
+ /**
395
+ * Number of members in this chat (if available)
396
+ *
397
+ * If not available, try fetching a full chat info with {@link TelegramClient.getFullChat}
398
+ */
395
399
  get membersCount() {
396
400
  return "participantsCount" in this.raw ? this.raw.participantsCount ?? null : null;
397
401
  }
@@ -178,6 +178,10 @@ class FullChat extends chat.Chat {
178
178
  get canViewAdRevenue() {
179
179
  return this.full._ === "channelFull" && this.full.canViewRevenue;
180
180
  }
181
+ /** Number of members in the chat (0 if not available) */
182
+ get membersCount() {
183
+ return this.full._ === "channelFull" ? this.full.participantsCount ?? 0 : 0;
184
+ }
181
185
  /** Number of admins in the chat (0 if not available) */
182
186
  get adminsCount() {
183
187
  return this.full._ === "channelFull" ? this.full.adminsCount ?? 0 : 0;
@@ -98,6 +98,8 @@ export declare class FullChat extends Chat {
98
98
  get canViewStarsRevenue(): boolean;
99
99
  /** Whether the current user can view ad revenue for this chat */
100
100
  get canViewAdRevenue(): boolean;
101
+ /** Number of members in the chat (0 if not available) */
102
+ get membersCount(): number;
101
103
  /** Number of admins in the chat (0 if not available) */
102
104
  get adminsCount(): number;
103
105
  /** Number of users kicked from the chat (if available) */
@@ -98,6 +98,8 @@ export declare class FullChat extends Chat {
98
98
  get canViewStarsRevenue(): boolean;
99
99
  /** Whether the current user can view ad revenue for this chat */
100
100
  get canViewAdRevenue(): boolean;
101
+ /** Number of members in the chat (0 if not available) */
102
+ get membersCount(): number;
101
103
  /** Number of admins in the chat (0 if not available) */
102
104
  get adminsCount(): number;
103
105
  /** Number of users kicked from the chat (if available) */
@@ -171,6 +171,10 @@ class FullChat extends Chat$2 {
171
171
  get canViewAdRevenue() {
172
172
  return this.full._ === "channelFull" && this.full.canViewRevenue;
173
173
  }
174
+ /** Number of members in the chat (0 if not available) */
175
+ get membersCount() {
176
+ return this.full._ === "channelFull" ? this.full.participantsCount ?? 0 : 0;
177
+ }
174
178
  /** Number of admins in the chat (0 if not available) */
175
179
  get adminsCount() {
176
180
  return this.full._ === "channelFull" ? this.full.adminsCount ?? 0 : 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
- return this.raw.resellStars ?? null;
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
- return this.raw.resellStars ?? null;
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);
@@ -76,4 +76,8 @@ export declare class Story {
76
76
  * Emoji representing a reaction sent by the current user, if any
77
77
  */
78
78
  get sentReactionEmoji(): ReactionEmoji | null;
79
+ /**
80
+ * Albums this story belongs to
81
+ */
82
+ get albums(): number[];
79
83
  }
@@ -76,4 +76,8 @@ export declare class Story {
76
76
  * Emoji representing a reaction sent by the current user, if any
77
77
  */
78
78
  get sentReactionEmoji(): ReactionEmoji | null;
79
+ /**
80
+ * Albums this story belongs to
81
+ */
82
+ get albums(): number[];
79
83
  }
@@ -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);