@mtcute/core 0.19.7 → 0.20.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.
Files changed (111) hide show
  1. package/client.cjs +24 -0
  2. package/client.js +24 -0
  3. package/highlevel/base.cjs +2 -2
  4. package/highlevel/base.js +2 -2
  5. package/highlevel/client.d.cts +68 -9
  6. package/highlevel/client.d.ts +68 -9
  7. package/highlevel/methods/files/normalize-input-media.cjs +12 -2
  8. package/highlevel/methods/files/normalize-input-media.js +12 -2
  9. package/highlevel/methods/messages/forward-messages.cjs +4 -2
  10. package/highlevel/methods/messages/forward-messages.d.cts +2 -0
  11. package/highlevel/methods/messages/forward-messages.d.ts +2 -0
  12. package/highlevel/methods/messages/forward-messages.js +4 -2
  13. package/highlevel/methods/premium/_normalize-input-star-gift.cjs +23 -0
  14. package/highlevel/methods/premium/_normalize-input-star-gift.d.cts +4 -0
  15. package/highlevel/methods/premium/_normalize-input-star-gift.d.ts +4 -0
  16. package/highlevel/methods/premium/_normalize-input-star-gift.js +18 -0
  17. package/highlevel/methods/premium/accept-star-gift.cjs +4 -3
  18. package/highlevel/methods/premium/accept-star-gift.d.cts +3 -3
  19. package/highlevel/methods/premium/accept-star-gift.d.ts +3 -3
  20. package/highlevel/methods/premium/accept-star-gift.js +4 -3
  21. package/highlevel/methods/premium/get-saved-star-gifts-by-id.cjs +21 -0
  22. package/highlevel/methods/premium/get-saved-star-gifts-by-id.d.cts +6 -0
  23. package/highlevel/methods/premium/get-saved-star-gifts-by-id.d.ts +6 -0
  24. package/highlevel/methods/premium/get-saved-star-gifts-by-id.js +16 -0
  25. package/highlevel/methods/premium/get-saved-star-gifts.cjs +32 -0
  26. package/highlevel/methods/premium/get-saved-star-gifts.d.cts +24 -0
  27. package/highlevel/methods/premium/get-saved-star-gifts.d.ts +24 -0
  28. package/highlevel/methods/premium/get-saved-star-gifts.js +27 -0
  29. package/highlevel/methods/premium/get-star-gift-withdrawal-url.cjs +23 -0
  30. package/highlevel/methods/premium/get-star-gift-withdrawal-url.d.cts +8 -0
  31. package/highlevel/methods/premium/get-star-gift-withdrawal-url.d.ts +8 -0
  32. package/highlevel/methods/premium/get-star-gift-withdrawal-url.js +18 -0
  33. package/highlevel/methods/premium/get-unique-star-gift.cjs +20 -0
  34. package/highlevel/methods/premium/get-unique-star-gift.d.cts +6 -0
  35. package/highlevel/methods/premium/get-unique-star-gift.d.ts +6 -0
  36. package/highlevel/methods/premium/get-unique-star-gift.js +15 -0
  37. package/highlevel/methods/premium/iter-saved-star-gifts.cjs +33 -0
  38. package/highlevel/methods/premium/iter-saved-star-gifts.d.cts +27 -0
  39. package/highlevel/methods/premium/iter-saved-star-gifts.d.ts +27 -0
  40. package/highlevel/methods/premium/iter-saved-star-gifts.js +28 -0
  41. package/highlevel/methods/premium/send-star-gift.cjs +2 -2
  42. package/highlevel/methods/premium/send-star-gift.d.cts +2 -2
  43. package/highlevel/methods/premium/send-star-gift.d.ts +2 -2
  44. package/highlevel/methods/premium/send-star-gift.js +3 -3
  45. package/highlevel/methods/premium/transfer-star-gift.cjs +4 -4
  46. package/highlevel/methods/premium/transfer-star-gift.d.cts +3 -3
  47. package/highlevel/methods/premium/transfer-star-gift.d.ts +3 -3
  48. package/highlevel/methods/premium/transfer-star-gift.js +5 -5
  49. package/highlevel/methods/premium/upgrade-star-gift.cjs +3 -3
  50. package/highlevel/methods/premium/upgrade-star-gift.d.cts +2 -2
  51. package/highlevel/methods/premium/upgrade-star-gift.d.ts +2 -2
  52. package/highlevel/methods/premium/upgrade-star-gift.js +3 -3
  53. package/highlevel/methods/users/set-emoji-status.cjs +8 -1
  54. package/highlevel/methods/users/set-emoji-status.d.cts +2 -0
  55. package/highlevel/methods/users/set-emoji-status.d.ts +2 -0
  56. package/highlevel/methods/users/set-emoji-status.js +8 -1
  57. package/highlevel/methods.d.cts +6 -0
  58. package/highlevel/methods.d.ts +6 -0
  59. package/highlevel/types/media/input-media/types.d.cts +4 -0
  60. package/highlevel/types/media/input-media/types.d.ts +4 -0
  61. package/highlevel/types/media/video.cjs +8 -0
  62. package/highlevel/types/media/video.d.cts +3 -0
  63. package/highlevel/types/media/video.d.ts +3 -0
  64. package/highlevel/types/media/video.js +8 -0
  65. package/highlevel/types/messages/message-action.cjs +22 -1
  66. package/highlevel/types/messages/message-action.d.cts +4 -0
  67. package/highlevel/types/messages/message-action.d.ts +4 -0
  68. package/highlevel/types/messages/message-action.js +22 -1
  69. package/highlevel/types/peers/chat.cjs +3 -1
  70. package/highlevel/types/peers/chat.js +3 -1
  71. package/highlevel/types/peers/full-chat.cjs +8 -0
  72. package/highlevel/types/peers/full-chat.d.cts +4 -0
  73. package/highlevel/types/peers/full-chat.d.ts +4 -0
  74. package/highlevel/types/peers/full-chat.js +8 -0
  75. package/highlevel/types/peers/user.cjs +3 -1
  76. package/highlevel/types/peers/user.js +3 -1
  77. package/highlevel/types/premium/index.d.cts +1 -0
  78. package/highlevel/types/premium/index.d.ts +1 -0
  79. package/highlevel/types/premium/saved-star-gift.cjs +80 -0
  80. package/highlevel/types/premium/saved-star-gift.d.cts +39 -0
  81. package/highlevel/types/premium/saved-star-gift.d.ts +39 -0
  82. package/highlevel/types/premium/saved-star-gift.js +75 -0
  83. package/highlevel/types/premium/stars-gift-unique.cjs +18 -5
  84. package/highlevel/types/premium/stars-gift-unique.d.cts +11 -5
  85. package/highlevel/types/premium/stars-gift-unique.d.ts +11 -5
  86. package/highlevel/types/premium/stars-gift-unique.js +18 -5
  87. package/highlevel/types/premium/stars-gift.d.cts +12 -1
  88. package/highlevel/types/premium/stars-gift.d.ts +12 -1
  89. package/highlevel/types/reactions/emoji-status.cjs +38 -1
  90. package/highlevel/types/reactions/emoji-status.d.cts +23 -2
  91. package/highlevel/types/reactions/emoji-status.d.ts +23 -2
  92. package/highlevel/types/reactions/emoji-status.js +39 -2
  93. package/highlevel/types/stories/interactive/index.cjs +4 -0
  94. package/highlevel/types/stories/interactive/index.d.cts +3 -2
  95. package/highlevel/types/stories/interactive/index.d.ts +3 -2
  96. package/highlevel/types/stories/interactive/index.js +4 -0
  97. package/highlevel/types/stories/interactive/star-gift.cjs +22 -0
  98. package/highlevel/types/stories/interactive/star-gift.d.cts +12 -0
  99. package/highlevel/types/stories/interactive/star-gift.d.ts +12 -0
  100. package/highlevel/types/stories/interactive/star-gift.js +17 -0
  101. package/highlevel/updates/manager.cjs +11 -9
  102. package/highlevel/updates/manager.d.cts +1 -3
  103. package/highlevel/updates/manager.d.ts +1 -3
  104. package/highlevel/updates/manager.js +11 -9
  105. package/index.cjs +5 -0
  106. package/index.js +6 -1
  107. package/methods.cjs +12 -0
  108. package/methods.js +12 -0
  109. package/network/network-manager.cjs +1 -1
  110. package/network/network-manager.js +1 -1
  111. package/package.json +2 -2
@@ -0,0 +1,39 @@
1
+ import { tl } from '@mtcute/tl';
2
+ import { TextWithEntities } from '../misc/entities.js';
3
+ import { Peer } from '../peers/peer.js';
4
+ import { PeersIndex } from '../peers/peers-index.js';
5
+ import { StarGiftUnique } from './stars-gift-unique.js';
6
+ import { StarGift } from './stars-gift.js';
7
+ export declare class SavedStarGift {
8
+ readonly raw: tl.RawSavedStarGift;
9
+ readonly _peers: PeersIndex;
10
+ constructor(raw: tl.RawSavedStarGift, _peers: PeersIndex);
11
+ /** Whether the sender name is hidden */
12
+ get nameHidden(): boolean;
13
+ /** Whether this gift was not saved yet */
14
+ get unsaved(): boolean;
15
+ /** Whether this gift was refunded */
16
+ get refunded(): boolean;
17
+ /** Whether this gift can be upgraded to a unique gift */
18
+ get canUpgrade(): boolean;
19
+ /** Sender of the gift */
20
+ get sender(): Peer | null;
21
+ /** Date when the gift was sent */
22
+ get date(): Date;
23
+ /** The gift itself */
24
+ get gift(): StarGift | StarGiftUnique;
25
+ /** The attached message */
26
+ get message(): TextWithEntities | null;
27
+ /** ID of the message where the gift was originally sent (if available) */
28
+ get messageId(): number | null;
29
+ /** ID of the saved gift */
30
+ get savedId(): tl.Long | null;
31
+ /** Amount of stars the gift can be converted to by the recipient */
32
+ get convertStars(): tl.Long | null;
33
+ /** Amount of stars needed to upgrade the gift to a unique gift */
34
+ get upgradeStars(): tl.Long | null;
35
+ /** Amount of stars needed to transfer the gift */
36
+ get transferStars(): tl.Long | null;
37
+ /** Date when the gift can be exported to blockchain */
38
+ get canExportAt(): Date | null;
39
+ }
@@ -0,0 +1,75 @@
1
+ import { makeInspectable } from "../../utils/inspectable.js";
2
+ import { memoizeGetters } from "../../utils/memoize.js";
3
+ import { parsePeer } from "../peers/peer.js";
4
+ import { StarGiftUnique as StarGiftUnique$2 } from "./stars-gift-unique.js";
5
+ import { StarGift as StarGift$2 } from "./stars-gift.js";
6
+ class SavedStarGift {
7
+ constructor(raw, _peers) {
8
+ this.raw = raw;
9
+ this._peers = _peers;
10
+ }
11
+ /** Whether the sender name is hidden */
12
+ get nameHidden() {
13
+ return this.raw.nameHidden;
14
+ }
15
+ /** Whether this gift was not saved yet */
16
+ get unsaved() {
17
+ return this.raw.unsaved;
18
+ }
19
+ /** Whether this gift was refunded */
20
+ get refunded() {
21
+ return this.raw.refunded;
22
+ }
23
+ /** Whether this gift can be upgraded to a unique gift */
24
+ get canUpgrade() {
25
+ return this.raw.canUpgrade;
26
+ }
27
+ /** Sender of the gift */
28
+ get sender() {
29
+ return this.raw.fromId ? parsePeer(this.raw.fromId, this._peers) : null;
30
+ }
31
+ /** Date when the gift was sent */
32
+ get date() {
33
+ return new Date(this.raw.date * 1e3);
34
+ }
35
+ /** The gift itself */
36
+ get gift() {
37
+ if (this.raw.gift._ === "starGift") {
38
+ return new StarGift$2(this.raw.gift);
39
+ }
40
+ return new StarGiftUnique$2(this.raw.gift, this._peers);
41
+ }
42
+ /** The attached message */
43
+ get message() {
44
+ return this.raw.message ?? null;
45
+ }
46
+ /** ID of the message where the gift was originally sent (if available) */
47
+ get messageId() {
48
+ return this.raw.msgId ?? null;
49
+ }
50
+ /** ID of the saved gift */
51
+ get savedId() {
52
+ return this.raw.savedId ?? null;
53
+ }
54
+ /** Amount of stars the gift can be converted to by the recipient */
55
+ get convertStars() {
56
+ return this.raw.convertStars ?? null;
57
+ }
58
+ /** Amount of stars needed to upgrade the gift to a unique gift */
59
+ get upgradeStars() {
60
+ return this.raw.upgradeStars ?? null;
61
+ }
62
+ /** Amount of stars needed to transfer the gift */
63
+ get transferStars() {
64
+ return this.raw.transferStars ?? null;
65
+ }
66
+ /** Date when the gift can be exported to blockchain */
67
+ get canExportAt() {
68
+ return this.raw.canExportAt ? new Date(this.raw.canExportAt * 1e3) : null;
69
+ }
70
+ }
71
+ const SavedStarGift$1 = /* @__PURE__ */ makeInspectable(SavedStarGift);
72
+ const SavedStarGift$2 = /* @__PURE__ */ memoizeGetters(SavedStarGift$1, ["sender", "gift"]);
73
+ export {
74
+ SavedStarGift$2 as SavedStarGift
75
+ };
@@ -9,7 +9,7 @@ const utils = require("@fuman/utils");
9
9
  const inspectable = require("../../utils/inspectable.cjs");
10
10
  const memoize = require("../../utils/memoize.cjs");
11
11
  const documentUtils = require("../media/document-utils.cjs");
12
- const user = require("../peers/user.cjs");
12
+ const peer = require("../peers/peer.cjs");
13
13
  class StarGiftUniqueAttribute {
14
14
  constructor(raw) {
15
15
  this.raw = raw;
@@ -64,11 +64,11 @@ class StarGiftUniqueOriginalDetails {
64
64
  }
65
65
  /** ID of the user who sent the original star gift */
66
66
  get sender() {
67
- return this.raw.senderId ? new user.User(this._peers.user(this.raw.senderId)) : null;
67
+ return this.raw.senderId ? peer.parsePeer(this.raw.senderId, this._peers) : null;
68
68
  }
69
69
  /** ID of the user who received the original star gift */
70
70
  get recipient() {
71
- return new user.User(this._peers.user(this.raw.recipientId));
71
+ return peer.parsePeer(this.raw.recipientId, this._peers);
72
72
  }
73
73
  /** Date when the original star gift was sent */
74
74
  get date() {
@@ -112,9 +112,18 @@ class StarGiftUnique {
112
112
  get title() {
113
113
  return this.raw.title;
114
114
  }
115
- /** ID of the user who owns this gift */
115
+ /** Slug of the gift */
116
+ get slug() {
117
+ return this.raw.slug;
118
+ }
119
+ /** ID of the peer who owns this gift, if available */
116
120
  get owner() {
117
- return new user.User(this._peers.user(this.raw.ownerId));
121
+ if (!this.raw.ownerId) return null;
122
+ return peer.parsePeer(this.raw.ownerId, this._peers);
123
+ }
124
+ /** Name of the user who owns this gift, if available */
125
+ get ownerName() {
126
+ return this.raw.ownerName ?? null;
118
127
  }
119
128
  get availabilityIssued() {
120
129
  return this.raw.availabilityIssued;
@@ -139,6 +148,10 @@ class StarGiftUnique {
139
148
  if (!this._originalDetails) return null;
140
149
  return new StarGiftUniqueOriginalDetails(this._originalDetails, this._peers);
141
150
  }
151
+ /** TON address of the owner of the unique star gift */
152
+ get ownerAddress() {
153
+ return this.raw.ownerAddress ?? null;
154
+ }
142
155
  }
143
156
  const StarGiftUnique$1 = /* @__PURE__ */ inspectable.makeInspectable(StarGiftUnique);
144
157
  const StarGiftUnique$2 = /* @__PURE__ */ memoize.memoizeGetters(StarGiftUnique$1, ["model", "pattern", "backdrop", "originalDetails"]);
@@ -1,8 +1,8 @@
1
1
  import { tl } from '@mtcute/tl';
2
2
  import { Sticker } from '../media/sticker.js';
3
3
  import { TextWithEntities } from '../misc/entities.js';
4
+ import { Peer } from '../peers/peer.js';
4
5
  import { PeersIndex } from '../peers/peers-index.js';
5
- import { User } from '../peers/user.js';
6
6
  /** An attribute of a unique star gift containing a sticker */
7
7
  export declare class StarGiftUniqueAttribute {
8
8
  readonly raw: tl.RawStarGiftAttributeModel | tl.RawStarGiftAttributePattern;
@@ -32,9 +32,9 @@ export declare class StarGiftUniqueOriginalDetails {
32
32
  readonly _peers: PeersIndex;
33
33
  constructor(raw: tl.RawStarGiftAttributeOriginalDetails, _peers: PeersIndex);
34
34
  /** ID of the user who sent the original star gift */
35
- get sender(): User | null;
35
+ get sender(): Peer | null;
36
36
  /** ID of the user who received the original star gift */
37
- get recipient(): User;
37
+ get recipient(): Peer;
38
38
  /** Date when the original star gift was sent */
39
39
  get date(): Date;
40
40
  /** Message attached to the original star gift */
@@ -55,8 +55,12 @@ export declare class StarGiftUnique {
55
55
  get num(): number;
56
56
  /** Title of the NFT */
57
57
  get title(): string;
58
- /** ID of the user who owns this gift */
59
- get owner(): User;
58
+ /** Slug of the gift */
59
+ get slug(): string;
60
+ /** ID of the peer who owns this gift, if available */
61
+ get owner(): Peer | null;
62
+ /** Name of the user who owns this gift, if available */
63
+ get ownerName(): string | null;
60
64
  get availabilityIssued(): number;
61
65
  get availabilityTotal(): number;
62
66
  /** Model (i.e. the gift itself) of the unique star gift */
@@ -67,4 +71,6 @@ export declare class StarGiftUnique {
67
71
  get backdrop(): StarGiftUniqueBackdrop;
68
72
  /** Details about the original star gift (if they were retained when minting) */
69
73
  get originalDetails(): StarGiftUniqueOriginalDetails | null;
74
+ /** TON address of the owner of the unique star gift */
75
+ get ownerAddress(): string | null;
70
76
  }
@@ -1,8 +1,8 @@
1
1
  import { tl } from '@mtcute/tl';
2
2
  import { Sticker } from '../media/sticker.js';
3
3
  import { TextWithEntities } from '../misc/entities.js';
4
+ import { Peer } from '../peers/peer.js';
4
5
  import { PeersIndex } from '../peers/peers-index.js';
5
- import { User } from '../peers/user.js';
6
6
  /** An attribute of a unique star gift containing a sticker */
7
7
  export declare class StarGiftUniqueAttribute {
8
8
  readonly raw: tl.RawStarGiftAttributeModel | tl.RawStarGiftAttributePattern;
@@ -32,9 +32,9 @@ export declare class StarGiftUniqueOriginalDetails {
32
32
  readonly _peers: PeersIndex;
33
33
  constructor(raw: tl.RawStarGiftAttributeOriginalDetails, _peers: PeersIndex);
34
34
  /** ID of the user who sent the original star gift */
35
- get sender(): User | null;
35
+ get sender(): Peer | null;
36
36
  /** ID of the user who received the original star gift */
37
- get recipient(): User;
37
+ get recipient(): Peer;
38
38
  /** Date when the original star gift was sent */
39
39
  get date(): Date;
40
40
  /** Message attached to the original star gift */
@@ -55,8 +55,12 @@ export declare class StarGiftUnique {
55
55
  get num(): number;
56
56
  /** Title of the NFT */
57
57
  get title(): string;
58
- /** ID of the user who owns this gift */
59
- get owner(): User;
58
+ /** Slug of the gift */
59
+ get slug(): string;
60
+ /** ID of the peer who owns this gift, if available */
61
+ get owner(): Peer | null;
62
+ /** Name of the user who owns this gift, if available */
63
+ get ownerName(): string | null;
60
64
  get availabilityIssued(): number;
61
65
  get availabilityTotal(): number;
62
66
  /** Model (i.e. the gift itself) of the unique star gift */
@@ -67,4 +71,6 @@ export declare class StarGiftUnique {
67
71
  get backdrop(): StarGiftUniqueBackdrop;
68
72
  /** Details about the original star gift (if they were retained when minting) */
69
73
  get originalDetails(): StarGiftUniqueOriginalDetails | null;
74
+ /** TON address of the owner of the unique star gift */
75
+ get ownerAddress(): string | null;
70
76
  }
@@ -2,7 +2,7 @@ import { assert } from "@fuman/utils";
2
2
  import { makeInspectable } from "../../utils/inspectable.js";
3
3
  import { memoizeGetters } from "../../utils/memoize.js";
4
4
  import { parseDocument } from "../media/document-utils.js";
5
- import { User as User$2 } from "../peers/user.js";
5
+ import { parsePeer } from "../peers/peer.js";
6
6
  class StarGiftUniqueAttribute {
7
7
  constructor(raw) {
8
8
  this.raw = raw;
@@ -57,11 +57,11 @@ class StarGiftUniqueOriginalDetails {
57
57
  }
58
58
  /** ID of the user who sent the original star gift */
59
59
  get sender() {
60
- return this.raw.senderId ? new User$2(this._peers.user(this.raw.senderId)) : null;
60
+ return this.raw.senderId ? parsePeer(this.raw.senderId, this._peers) : null;
61
61
  }
62
62
  /** ID of the user who received the original star gift */
63
63
  get recipient() {
64
- return new User$2(this._peers.user(this.raw.recipientId));
64
+ return parsePeer(this.raw.recipientId, this._peers);
65
65
  }
66
66
  /** Date when the original star gift was sent */
67
67
  get date() {
@@ -105,9 +105,18 @@ class StarGiftUnique {
105
105
  get title() {
106
106
  return this.raw.title;
107
107
  }
108
- /** ID of the user who owns this gift */
108
+ /** Slug of the gift */
109
+ get slug() {
110
+ return this.raw.slug;
111
+ }
112
+ /** ID of the peer who owns this gift, if available */
109
113
  get owner() {
110
- return new User$2(this._peers.user(this.raw.ownerId));
114
+ if (!this.raw.ownerId) return null;
115
+ return parsePeer(this.raw.ownerId, this._peers);
116
+ }
117
+ /** Name of the user who owns this gift, if available */
118
+ get ownerName() {
119
+ return this.raw.ownerName ?? null;
111
120
  }
112
121
  get availabilityIssued() {
113
122
  return this.raw.availabilityIssued;
@@ -132,6 +141,10 @@ class StarGiftUnique {
132
141
  if (!this._originalDetails) return null;
133
142
  return new StarGiftUniqueOriginalDetails(this._originalDetails, this._peers);
134
143
  }
144
+ /** TON address of the owner of the unique star gift */
145
+ get ownerAddress() {
146
+ return this.raw.ownerAddress ?? null;
147
+ }
135
148
  }
136
149
  const StarGiftUnique$1 = /* @__PURE__ */ makeInspectable(StarGiftUnique);
137
150
  const StarGiftUnique$2 = /* @__PURE__ */ memoizeGetters(StarGiftUnique$1, ["model", "pattern", "backdrop", "originalDetails"]);
@@ -1,11 +1,22 @@
1
1
  import { tl } from '@mtcute/tl';
2
2
  import { Sticker } from '../media/sticker.js';
3
+ import { Message } from '../messages/message.js';
3
4
  import { TextWithEntities } from '../misc/entities.js';
5
+ import { InputPeerLike } from '../peers/peer.js';
4
6
  import { PeersIndex } from '../peers/peers-index.js';
5
7
  import { User } from '../peers/user.js';
6
8
  import { StarGiftUnique } from './stars-gift-unique.js';
9
+ export type InputStarGift = {
10
+ /** ID of the message containing the gift */
11
+ message: number | Message;
12
+ } | {
13
+ /** Owner of the gift */
14
+ owner: InputPeerLike;
15
+ /** ID of the gift */
16
+ savedId: tl.Long;
17
+ };
7
18
  /**
8
- * A gift with stars attached to it.
19
+ * A gift bought with stars
9
20
  */
10
21
  export declare class StarGift {
11
22
  readonly raw: tl.RawStarGift;
@@ -1,11 +1,22 @@
1
1
  import { tl } from '@mtcute/tl';
2
2
  import { Sticker } from '../media/sticker.js';
3
+ import { Message } from '../messages/message.js';
3
4
  import { TextWithEntities } from '../misc/entities.js';
5
+ import { InputPeerLike } from '../peers/peer.js';
4
6
  import { PeersIndex } from '../peers/peers-index.js';
5
7
  import { User } from '../peers/user.js';
6
8
  import { StarGiftUnique } from './stars-gift-unique.js';
9
+ export type InputStarGift = {
10
+ /** ID of the message containing the gift */
11
+ message: number | Message;
12
+ } | {
13
+ /** Owner of the gift */
14
+ owner: InputPeerLike;
15
+ /** ID of the gift */
16
+ savedId: tl.Long;
17
+ };
7
18
  /**
8
- * A gift with stars attached to it.
19
+ * A gift bought with stars
9
20
  */
10
21
  export declare class StarGift {
11
22
  readonly raw: tl.RawStarGift;
@@ -6,6 +6,37 @@ 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 inspectable = require("../../utils/inspectable.cjs");
9
+ class EmojiStatusCollectible {
10
+ constructor(raw) {
11
+ this.raw = raw;
12
+ }
13
+ /** ID of the collectible */
14
+ get id() {
15
+ return this.raw.collectibleId;
16
+ }
17
+ /** Title of the collectible */
18
+ get title() {
19
+ return this.raw.title;
20
+ }
21
+ /** Slug of the collectible */
22
+ get slug() {
23
+ return this.raw.slug;
24
+ }
25
+ /** Pattern emoji ID of the collectible */
26
+ get patternEmojiId() {
27
+ return this.raw.patternDocumentId;
28
+ }
29
+ /** Colors of the collectible */
30
+ get colors() {
31
+ return {
32
+ center: this.raw.centerColor,
33
+ edge: this.raw.edgeColor,
34
+ pattern: this.raw.patternColor,
35
+ text: this.raw.textColor
36
+ };
37
+ }
38
+ }
39
+ const EmojiStatusCollectible$1 = /* @__PURE__ */ inspectable.makeInspectable(EmojiStatusCollectible);
9
40
  class EmojiStatus {
10
41
  constructor(raw) {
11
42
  this.raw = raw;
@@ -16,9 +47,15 @@ class EmojiStatus {
16
47
  }
17
48
  /** This status is valid at most until this date */
18
49
  get expireDate() {
19
- if (this.raw._ === "emojiStatus") return null;
50
+ if (!this.raw.until) return null;
20
51
  return new Date(this.raw.until * 1e3);
21
52
  }
53
+ /** If this is a collectible emoji status, information about it */
54
+ get collectible() {
55
+ if (this.raw._ !== "emojiStatusCollectible") return null;
56
+ return new EmojiStatusCollectible(this.raw);
57
+ }
22
58
  }
23
59
  const EmojiStatus$1 = /* @__PURE__ */ inspectable.makeInspectable(EmojiStatus);
24
60
  exports.EmojiStatus = EmojiStatus$1;
61
+ exports.EmojiStatusCollectible = EmojiStatusCollectible$1;
@@ -1,12 +1,33 @@
1
1
  import { tl } from '@mtcute/tl';
2
+ export declare class EmojiStatusCollectible {
3
+ readonly raw: tl.RawEmojiStatusCollectible;
4
+ constructor(raw: tl.RawEmojiStatusCollectible);
5
+ /** ID of the collectible */
6
+ get id(): tl.Long;
7
+ /** Title of the collectible */
8
+ get title(): string;
9
+ /** Slug of the collectible */
10
+ get slug(): string;
11
+ /** Pattern emoji ID of the collectible */
12
+ get patternEmojiId(): tl.Long;
13
+ /** Colors of the collectible */
14
+ get colors(): {
15
+ center: number;
16
+ edge: number;
17
+ pattern: number;
18
+ text: number;
19
+ };
20
+ }
2
21
  /**
3
22
  * Information about user's emoji status
4
23
  */
5
24
  export declare class EmojiStatus {
6
- readonly raw: Exclude<tl.TypeEmojiStatus, tl.RawEmojiStatusEmpty>;
7
- constructor(raw: Exclude<tl.TypeEmojiStatus, tl.RawEmojiStatusEmpty>);
25
+ readonly raw: Exclude<tl.TypeEmojiStatus, tl.RawEmojiStatusEmpty | tl.RawInputEmojiStatusCollectible>;
26
+ constructor(raw: Exclude<tl.TypeEmojiStatus, tl.RawEmojiStatusEmpty | tl.RawInputEmojiStatusCollectible>);
8
27
  /** ID of the custom emoji */
9
28
  get emoji(): tl.Long;
10
29
  /** This status is valid at most until this date */
11
30
  get expireDate(): Date | null;
31
+ /** If this is a collectible emoji status, information about it */
32
+ get collectible(): EmojiStatusCollectible | null;
12
33
  }
@@ -1,12 +1,33 @@
1
1
  import { tl } from '@mtcute/tl';
2
+ export declare class EmojiStatusCollectible {
3
+ readonly raw: tl.RawEmojiStatusCollectible;
4
+ constructor(raw: tl.RawEmojiStatusCollectible);
5
+ /** ID of the collectible */
6
+ get id(): tl.Long;
7
+ /** Title of the collectible */
8
+ get title(): string;
9
+ /** Slug of the collectible */
10
+ get slug(): string;
11
+ /** Pattern emoji ID of the collectible */
12
+ get patternEmojiId(): tl.Long;
13
+ /** Colors of the collectible */
14
+ get colors(): {
15
+ center: number;
16
+ edge: number;
17
+ pattern: number;
18
+ text: number;
19
+ };
20
+ }
2
21
  /**
3
22
  * Information about user's emoji status
4
23
  */
5
24
  export declare class EmojiStatus {
6
- readonly raw: Exclude<tl.TypeEmojiStatus, tl.RawEmojiStatusEmpty>;
7
- constructor(raw: Exclude<tl.TypeEmojiStatus, tl.RawEmojiStatusEmpty>);
25
+ readonly raw: Exclude<tl.TypeEmojiStatus, tl.RawEmojiStatusEmpty | tl.RawInputEmojiStatusCollectible>;
26
+ constructor(raw: Exclude<tl.TypeEmojiStatus, tl.RawEmojiStatusEmpty | tl.RawInputEmojiStatusCollectible>);
8
27
  /** ID of the custom emoji */
9
28
  get emoji(): tl.Long;
10
29
  /** This status is valid at most until this date */
11
30
  get expireDate(): Date | null;
31
+ /** If this is a collectible emoji status, information about it */
32
+ get collectible(): EmojiStatusCollectible | null;
12
33
  }
@@ -1,4 +1,35 @@
1
1
  import { makeInspectable } from "../../utils/inspectable.js";
2
+ class EmojiStatusCollectible {
3
+ constructor(raw) {
4
+ this.raw = raw;
5
+ }
6
+ /** ID of the collectible */
7
+ get id() {
8
+ return this.raw.collectibleId;
9
+ }
10
+ /** Title of the collectible */
11
+ get title() {
12
+ return this.raw.title;
13
+ }
14
+ /** Slug of the collectible */
15
+ get slug() {
16
+ return this.raw.slug;
17
+ }
18
+ /** Pattern emoji ID of the collectible */
19
+ get patternEmojiId() {
20
+ return this.raw.patternDocumentId;
21
+ }
22
+ /** Colors of the collectible */
23
+ get colors() {
24
+ return {
25
+ center: this.raw.centerColor,
26
+ edge: this.raw.edgeColor,
27
+ pattern: this.raw.patternColor,
28
+ text: this.raw.textColor
29
+ };
30
+ }
31
+ }
32
+ const EmojiStatusCollectible$1 = /* @__PURE__ */ makeInspectable(EmojiStatusCollectible);
2
33
  class EmojiStatus {
3
34
  constructor(raw) {
4
35
  this.raw = raw;
@@ -9,11 +40,17 @@ class EmojiStatus {
9
40
  }
10
41
  /** This status is valid at most until this date */
11
42
  get expireDate() {
12
- if (this.raw._ === "emojiStatus") return null;
43
+ if (!this.raw.until) return null;
13
44
  return new Date(this.raw.until * 1e3);
14
45
  }
46
+ /** If this is a collectible emoji status, information about it */
47
+ get collectible() {
48
+ if (this.raw._ !== "emojiStatusCollectible") return null;
49
+ return new EmojiStatusCollectible(this.raw);
50
+ }
15
51
  }
16
52
  const EmojiStatus$1 = /* @__PURE__ */ makeInspectable(EmojiStatus);
17
53
  export {
18
- EmojiStatus$1 as EmojiStatus
54
+ EmojiStatus$1 as EmojiStatus,
55
+ EmojiStatusCollectible$1 as EmojiStatusCollectible
19
56
  };
@@ -9,6 +9,7 @@ const errors = require("../../../../types/errors.cjs");
9
9
  const channelPost = require("./channel-post.cjs");
10
10
  const location = require("./location.cjs");
11
11
  const reaction = require("./reaction.cjs");
12
+ const starGift = require("./star-gift.cjs");
12
13
  const url = require("./url.cjs");
13
14
  const venue = require("./venue.cjs");
14
15
  const weather = require("./weather.cjs");
@@ -26,6 +27,8 @@ function _storyInteractiveElementFromTl(raw, peers) {
26
27
  return new url.StoryInteractiveUrl(raw);
27
28
  case "mediaAreaWeather":
28
29
  return new weather.StoryInteractiveWeather(raw);
30
+ case "mediaAreaStarGift":
31
+ return new starGift.StoryInteractiveStarGift(raw);
29
32
  case "inputMediaAreaVenue":
30
33
  case "inputMediaAreaChannelPost":
31
34
  throw new errors.MtTypeAssertionError("StoryInteractiveElement", "!input*", raw._);
@@ -34,6 +37,7 @@ function _storyInteractiveElementFromTl(raw, peers) {
34
37
  exports.StoryInteractiveChannelPost = channelPost.StoryInteractiveChannelPost;
35
38
  exports.StoryInteractiveLocation = location.StoryInteractiveLocation;
36
39
  exports.StoryInteractiveReaction = reaction.StoryInteractiveReaction;
40
+ exports.StoryInteractiveStarGift = starGift.StoryInteractiveStarGift;
37
41
  exports.StoryInteractiveUrl = url.StoryInteractiveUrl;
38
42
  exports.StoryInteractiveVenue = venue.StoryInteractiveVenue;
39
43
  exports.StoryInteractiveWeather = weather.StoryInteractiveWeather;
@@ -3,10 +3,11 @@ import { PeersIndex } from '../../peers/index.js';
3
3
  import { StoryInteractiveChannelPost } from './channel-post.js';
4
4
  import { StoryInteractiveLocation } from './location.js';
5
5
  import { StoryInteractiveReaction } from './reaction.js';
6
+ import { StoryInteractiveStarGift } from './star-gift.js';
6
7
  import { StoryInteractiveUrl } from './url.js';
7
8
  import { StoryInteractiveVenue } from './venue.js';
8
9
  import { StoryInteractiveWeather } from './weather.js';
9
10
  export * from './input.js';
10
- export { StoryInteractiveChannelPost, StoryInteractiveLocation, StoryInteractiveReaction, StoryInteractiveUrl, StoryInteractiveVenue, StoryInteractiveWeather, };
11
- export type StoryInteractiveElement = StoryInteractiveReaction | StoryInteractiveLocation | StoryInteractiveVenue | StoryInteractiveChannelPost | StoryInteractiveUrl | StoryInteractiveWeather;
11
+ export { StoryInteractiveChannelPost, StoryInteractiveLocation, StoryInteractiveReaction, StoryInteractiveStarGift, StoryInteractiveUrl, StoryInteractiveVenue, StoryInteractiveWeather, };
12
+ export type StoryInteractiveElement = StoryInteractiveReaction | StoryInteractiveLocation | StoryInteractiveVenue | StoryInteractiveChannelPost | StoryInteractiveUrl | StoryInteractiveWeather | StoryInteractiveStarGift;
12
13
  export declare function _storyInteractiveElementFromTl(raw: tl.TypeMediaArea, peers: PeersIndex): StoryInteractiveElement;
@@ -3,10 +3,11 @@ import { PeersIndex } from '../../peers/index.js';
3
3
  import { StoryInteractiveChannelPost } from './channel-post.js';
4
4
  import { StoryInteractiveLocation } from './location.js';
5
5
  import { StoryInteractiveReaction } from './reaction.js';
6
+ import { StoryInteractiveStarGift } from './star-gift.js';
6
7
  import { StoryInteractiveUrl } from './url.js';
7
8
  import { StoryInteractiveVenue } from './venue.js';
8
9
  import { StoryInteractiveWeather } from './weather.js';
9
10
  export * from './input.js';
10
- export { StoryInteractiveChannelPost, StoryInteractiveLocation, StoryInteractiveReaction, StoryInteractiveUrl, StoryInteractiveVenue, StoryInteractiveWeather, };
11
- export type StoryInteractiveElement = StoryInteractiveReaction | StoryInteractiveLocation | StoryInteractiveVenue | StoryInteractiveChannelPost | StoryInteractiveUrl | StoryInteractiveWeather;
11
+ export { StoryInteractiveChannelPost, StoryInteractiveLocation, StoryInteractiveReaction, StoryInteractiveStarGift, StoryInteractiveUrl, StoryInteractiveVenue, StoryInteractiveWeather, };
12
+ export type StoryInteractiveElement = StoryInteractiveReaction | StoryInteractiveLocation | StoryInteractiveVenue | StoryInteractiveChannelPost | StoryInteractiveUrl | StoryInteractiveWeather | StoryInteractiveStarGift;
12
13
  export declare function _storyInteractiveElementFromTl(raw: tl.TypeMediaArea, peers: PeersIndex): StoryInteractiveElement;
@@ -2,6 +2,7 @@ import { MtTypeAssertionError } from "../../../../types/errors.js";
2
2
  import { StoryInteractiveChannelPost as StoryInteractiveChannelPost$2 } from "./channel-post.js";
3
3
  import { StoryInteractiveLocation as StoryInteractiveLocation$2 } from "./location.js";
4
4
  import { StoryInteractiveReaction as StoryInteractiveReaction$1 } from "./reaction.js";
5
+ import { StoryInteractiveStarGift as StoryInteractiveStarGift$1 } from "./star-gift.js";
5
6
  import { StoryInteractiveUrl } from "./url.js";
6
7
  import { StoryInteractiveVenue as StoryInteractiveVenue$2 } from "./venue.js";
7
8
  import { StoryInteractiveWeather as StoryInteractiveWeather$1 } from "./weather.js";
@@ -19,6 +20,8 @@ function _storyInteractiveElementFromTl(raw, peers) {
19
20
  return new StoryInteractiveUrl(raw);
20
21
  case "mediaAreaWeather":
21
22
  return new StoryInteractiveWeather$1(raw);
23
+ case "mediaAreaStarGift":
24
+ return new StoryInteractiveStarGift$1(raw);
22
25
  case "inputMediaAreaVenue":
23
26
  case "inputMediaAreaChannelPost":
24
27
  throw new MtTypeAssertionError("StoryInteractiveElement", "!input*", raw._);
@@ -28,6 +31,7 @@ export {
28
31
  StoryInteractiveChannelPost$2 as StoryInteractiveChannelPost,
29
32
  StoryInteractiveLocation$2 as StoryInteractiveLocation,
30
33
  StoryInteractiveReaction$1 as StoryInteractiveReaction,
34
+ StoryInteractiveStarGift$1 as StoryInteractiveStarGift,
31
35
  StoryInteractiveUrl,
32
36
  StoryInteractiveVenue$2 as StoryInteractiveVenue,
33
37
  StoryInteractiveWeather$1 as StoryInteractiveWeather,
@@ -0,0 +1,22 @@
1
+ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
2
+ globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
3
+ console.warn("[@mtcute/core] CommonJS support is deprecated and will be removed in 0.25.0. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
4
+ console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
5
+ }
6
+ "use strict";
7
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
+ const base = require("./base.cjs");
9
+ const inspectable = require("../../../utils/inspectable.cjs");
10
+ class StoryInteractiveStarGift extends base.StoryInteractiveArea {
11
+ constructor(raw) {
12
+ super(raw);
13
+ this.raw = raw;
14
+ }
15
+ type = "star_gift";
16
+ /** Star gift slug */
17
+ get slug() {
18
+ return this.raw.slug;
19
+ }
20
+ }
21
+ const StoryInteractiveStarGift$1 = /* @__PURE__ */ inspectable.makeInspectable(StoryInteractiveStarGift);
22
+ exports.StoryInteractiveStarGift = StoryInteractiveStarGift$1;
@@ -0,0 +1,12 @@
1
+ import { tl } from '@mtcute/tl';
2
+ import { StoryInteractiveArea } from './base.js';
3
+ /**
4
+ * Interactive element containing a star gift
5
+ */
6
+ export declare class StoryInteractiveStarGift extends StoryInteractiveArea {
7
+ readonly raw: tl.RawMediaAreaStarGift;
8
+ readonly type: "star_gift";
9
+ constructor(raw: tl.RawMediaAreaStarGift);
10
+ /** Star gift slug */
11
+ get slug(): string;
12
+ }