@mtcute/core 0.19.10 → 0.20.1

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 (107) hide show
  1. package/client.cjs +20 -0
  2. package/client.js +20 -0
  3. package/highlevel/client.d.cts +64 -9
  4. package/highlevel/client.d.ts +64 -9
  5. package/highlevel/methods/files/normalize-input-media.cjs +12 -2
  6. package/highlevel/methods/files/normalize-input-media.js +12 -2
  7. package/highlevel/methods/messages/forward-messages.cjs +4 -2
  8. package/highlevel/methods/messages/forward-messages.d.cts +2 -0
  9. package/highlevel/methods/messages/forward-messages.d.ts +2 -0
  10. package/highlevel/methods/messages/forward-messages.js +4 -2
  11. package/highlevel/methods/premium/_normalize-input-star-gift.cjs +23 -0
  12. package/highlevel/methods/premium/_normalize-input-star-gift.d.cts +4 -0
  13. package/highlevel/methods/premium/_normalize-input-star-gift.d.ts +4 -0
  14. package/highlevel/methods/premium/_normalize-input-star-gift.js +18 -0
  15. package/highlevel/methods/premium/accept-star-gift.cjs +4 -3
  16. package/highlevel/methods/premium/accept-star-gift.d.cts +3 -3
  17. package/highlevel/methods/premium/accept-star-gift.d.ts +3 -3
  18. package/highlevel/methods/premium/accept-star-gift.js +4 -3
  19. package/highlevel/methods/premium/get-saved-star-gifts-by-id.cjs +21 -0
  20. package/highlevel/methods/premium/get-saved-star-gifts-by-id.d.cts +6 -0
  21. package/highlevel/methods/premium/get-saved-star-gifts-by-id.d.ts +6 -0
  22. package/highlevel/methods/premium/get-saved-star-gifts-by-id.js +16 -0
  23. package/highlevel/methods/premium/get-saved-star-gifts.cjs +32 -0
  24. package/highlevel/methods/premium/get-saved-star-gifts.d.cts +28 -0
  25. package/highlevel/methods/premium/get-saved-star-gifts.d.ts +28 -0
  26. package/highlevel/methods/premium/get-saved-star-gifts.js +27 -0
  27. package/highlevel/methods/premium/get-star-gift-withdrawal-url.cjs +23 -0
  28. package/highlevel/methods/premium/get-star-gift-withdrawal-url.d.cts +8 -0
  29. package/highlevel/methods/premium/get-star-gift-withdrawal-url.d.ts +8 -0
  30. package/highlevel/methods/premium/get-star-gift-withdrawal-url.js +18 -0
  31. package/highlevel/methods/premium/get-star-gifts.cjs +4 -13
  32. package/highlevel/methods/premium/get-star-gifts.d.cts +3 -2
  33. package/highlevel/methods/premium/get-star-gifts.d.ts +3 -2
  34. package/highlevel/methods/premium/get-star-gifts.js +4 -13
  35. package/highlevel/methods/premium/iter-saved-star-gifts.cjs +33 -0
  36. package/highlevel/methods/premium/iter-saved-star-gifts.d.cts +27 -0
  37. package/highlevel/methods/premium/iter-saved-star-gifts.d.ts +27 -0
  38. package/highlevel/methods/premium/iter-saved-star-gifts.js +28 -0
  39. package/highlevel/methods/premium/send-star-gift.cjs +2 -2
  40. package/highlevel/methods/premium/send-star-gift.d.cts +2 -2
  41. package/highlevel/methods/premium/send-star-gift.d.ts +2 -2
  42. package/highlevel/methods/premium/send-star-gift.js +3 -3
  43. package/highlevel/methods/premium/transfer-star-gift.cjs +4 -4
  44. package/highlevel/methods/premium/transfer-star-gift.d.cts +3 -3
  45. package/highlevel/methods/premium/transfer-star-gift.d.ts +3 -3
  46. package/highlevel/methods/premium/transfer-star-gift.js +5 -5
  47. package/highlevel/methods/premium/upgrade-star-gift.cjs +3 -3
  48. package/highlevel/methods/premium/upgrade-star-gift.d.cts +2 -2
  49. package/highlevel/methods/premium/upgrade-star-gift.d.ts +2 -2
  50. package/highlevel/methods/premium/upgrade-star-gift.js +3 -3
  51. package/highlevel/methods/users/set-emoji-status.cjs +8 -1
  52. package/highlevel/methods/users/set-emoji-status.d.cts +2 -0
  53. package/highlevel/methods/users/set-emoji-status.d.ts +2 -0
  54. package/highlevel/methods/users/set-emoji-status.js +8 -1
  55. package/highlevel/methods.d.cts +5 -0
  56. package/highlevel/methods.d.ts +5 -0
  57. package/highlevel/types/media/input-media/types.d.cts +4 -0
  58. package/highlevel/types/media/input-media/types.d.ts +4 -0
  59. package/highlevel/types/media/video.cjs +8 -0
  60. package/highlevel/types/media/video.d.cts +3 -0
  61. package/highlevel/types/media/video.d.ts +3 -0
  62. package/highlevel/types/media/video.js +8 -0
  63. package/highlevel/types/messages/message-action.cjs +22 -1
  64. package/highlevel/types/messages/message-action.d.cts +4 -0
  65. package/highlevel/types/messages/message-action.d.ts +4 -0
  66. package/highlevel/types/messages/message-action.js +22 -1
  67. package/highlevel/types/peers/chat.cjs +3 -1
  68. package/highlevel/types/peers/chat.js +3 -1
  69. package/highlevel/types/peers/full-chat.cjs +8 -0
  70. package/highlevel/types/peers/full-chat.d.cts +4 -0
  71. package/highlevel/types/peers/full-chat.d.ts +4 -0
  72. package/highlevel/types/peers/full-chat.js +8 -0
  73. package/highlevel/types/peers/user.cjs +3 -1
  74. package/highlevel/types/peers/user.js +3 -1
  75. package/highlevel/types/premium/index.d.cts +1 -0
  76. package/highlevel/types/premium/index.d.ts +1 -0
  77. package/highlevel/types/premium/saved-star-gift.cjs +81 -0
  78. package/highlevel/types/premium/saved-star-gift.d.cts +42 -0
  79. package/highlevel/types/premium/saved-star-gift.d.ts +42 -0
  80. package/highlevel/types/premium/saved-star-gift.js +76 -0
  81. package/highlevel/types/premium/stars-gift-unique.cjs +9 -5
  82. package/highlevel/types/premium/stars-gift-unique.d.cts +7 -5
  83. package/highlevel/types/premium/stars-gift-unique.d.ts +7 -5
  84. package/highlevel/types/premium/stars-gift-unique.js +9 -5
  85. package/highlevel/types/premium/stars-gift.cjs +0 -66
  86. package/highlevel/types/premium/stars-gift.d.cts +12 -40
  87. package/highlevel/types/premium/stars-gift.d.ts +12 -40
  88. package/highlevel/types/premium/stars-gift.js +1 -67
  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/index.cjs +4 -1
  94. package/index.js +5 -2
  95. package/methods.cjs +10 -0
  96. package/methods.js +10 -0
  97. package/network/middlewares/bundle.cjs +4 -0
  98. package/network/middlewares/bundle.d.cts +2 -0
  99. package/network/middlewares/bundle.d.ts +2 -0
  100. package/network/middlewares/bundle.js +4 -0
  101. package/network/middlewares/internal-errors.cjs +3 -1
  102. package/network/middlewares/internal-errors.d.cts +4 -0
  103. package/network/middlewares/internal-errors.d.ts +4 -0
  104. package/network/middlewares/internal-errors.js +3 -1
  105. package/network/network-manager.cjs +1 -1
  106. package/network/network-manager.js +1 -1
  107. package/package.json +2 -2
@@ -0,0 +1,42 @@
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
+ }
40
+ export {
41
+ /** @deprecated alias for {@link SavedStarGift} */
42
+ SavedStarGift as UserStarGift, };
@@ -0,0 +1,76 @@
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
+ SavedStarGift as UserStarGift
76
+ };
@@ -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() {
@@ -116,10 +116,10 @@ class StarGiftUnique {
116
116
  get slug() {
117
117
  return this.raw.slug;
118
118
  }
119
- /** ID of the user who owns this gift, if available */
119
+ /** ID of the peer who owns this gift, if available */
120
120
  get owner() {
121
121
  if (!this.raw.ownerId) return null;
122
- return new user.User(this._peers.user(this.raw.ownerId));
122
+ return peer.parsePeer(this.raw.ownerId, this._peers);
123
123
  }
124
124
  /** Name of the user who owns this gift, if available */
125
125
  get ownerName() {
@@ -148,6 +148,10 @@ class StarGiftUnique {
148
148
  if (!this._originalDetails) return null;
149
149
  return new StarGiftUniqueOriginalDetails(this._originalDetails, this._peers);
150
150
  }
151
+ /** TON address of the owner of the unique star gift */
152
+ get ownerAddress() {
153
+ return this.raw.ownerAddress ?? null;
154
+ }
151
155
  }
152
156
  const StarGiftUnique$1 = /* @__PURE__ */ inspectable.makeInspectable(StarGiftUnique);
153
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 */
@@ -57,8 +57,8 @@ export declare class StarGiftUnique {
57
57
  get title(): string;
58
58
  /** Slug of the gift */
59
59
  get slug(): string;
60
- /** ID of the user who owns this gift, if available */
61
- get owner(): User | null;
60
+ /** ID of the peer who owns this gift, if available */
61
+ get owner(): Peer | null;
62
62
  /** Name of the user who owns this gift, if available */
63
63
  get ownerName(): string | null;
64
64
  get availabilityIssued(): number;
@@ -71,4 +71,6 @@ export declare class StarGiftUnique {
71
71
  get backdrop(): StarGiftUniqueBackdrop;
72
72
  /** Details about the original star gift (if they were retained when minting) */
73
73
  get originalDetails(): StarGiftUniqueOriginalDetails | null;
74
+ /** TON address of the owner of the unique star gift */
75
+ get ownerAddress(): string | null;
74
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 */
@@ -57,8 +57,8 @@ export declare class StarGiftUnique {
57
57
  get title(): string;
58
58
  /** Slug of the gift */
59
59
  get slug(): string;
60
- /** ID of the user who owns this gift, if available */
61
- get owner(): User | null;
60
+ /** ID of the peer who owns this gift, if available */
61
+ get owner(): Peer | null;
62
62
  /** Name of the user who owns this gift, if available */
63
63
  get ownerName(): string | null;
64
64
  get availabilityIssued(): number;
@@ -71,4 +71,6 @@ export declare class StarGiftUnique {
71
71
  get backdrop(): StarGiftUniqueBackdrop;
72
72
  /** Details about the original star gift (if they were retained when minting) */
73
73
  get originalDetails(): StarGiftUniqueOriginalDetails | null;
74
+ /** TON address of the owner of the unique star gift */
75
+ get ownerAddress(): string | null;
74
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() {
@@ -109,10 +109,10 @@ class StarGiftUnique {
109
109
  get slug() {
110
110
  return this.raw.slug;
111
111
  }
112
- /** ID of the user who owns this gift, if available */
112
+ /** ID of the peer who owns this gift, if available */
113
113
  get owner() {
114
114
  if (!this.raw.ownerId) return null;
115
- return new User$2(this._peers.user(this.raw.ownerId));
115
+ return parsePeer(this.raw.ownerId, this._peers);
116
116
  }
117
117
  /** Name of the user who owns this gift, if available */
118
118
  get ownerName() {
@@ -141,6 +141,10 @@ class StarGiftUnique {
141
141
  if (!this._originalDetails) return null;
142
142
  return new StarGiftUniqueOriginalDetails(this._originalDetails, this._peers);
143
143
  }
144
+ /** TON address of the owner of the unique star gift */
145
+ get ownerAddress() {
146
+ return this.raw.ownerAddress ?? null;
147
+ }
144
148
  }
145
149
  const StarGiftUnique$1 = /* @__PURE__ */ makeInspectable(StarGiftUnique);
146
150
  const StarGiftUnique$2 = /* @__PURE__ */ memoizeGetters(StarGiftUnique$1, ["model", "pattern", "backdrop", "originalDetails"]);
@@ -5,14 +5,11 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
5
5
  }
6
6
  "use strict";
7
7
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
- const Long = require("long");
9
8
  const errors = require("../../../types/errors.cjs");
10
9
  const typeAssertions = require("../../../utils/type-assertions.cjs");
11
10
  const inspectable = require("../../utils/inspectable.cjs");
12
11
  const memoize = require("../../utils/memoize.cjs");
13
12
  const documentUtils = require("../media/document-utils.cjs");
14
- const user = require("../peers/user.cjs");
15
- const starsGiftUnique = require("./stars-gift-unique.cjs");
16
13
  class StarGift {
17
14
  constructor(raw) {
18
15
  this.raw = raw;
@@ -82,67 +79,4 @@ class StarGift {
82
79
  }
83
80
  const StarGift$1 = /* @__PURE__ */ inspectable.makeInspectable(StarGift);
84
81
  const StarGift$2 = /* @__PURE__ */ memoize.memoizeGetters(StarGift$1, ["sticker"]);
85
- class UserStarGift {
86
- constructor(raw, peers) {
87
- this.raw = raw;
88
- this.peers = peers;
89
- }
90
- /** Whether the sender chose to appear anonymously */
91
- get nameHidden() {
92
- return this.raw.nameHidden;
93
- }
94
- /** Whether this gift is not visible on the recipient's profile */
95
- get hidden() {
96
- return this.raw.unsaved;
97
- }
98
- get isRefunded() {
99
- return this.raw.refunded;
100
- }
101
- /** Sender of the gift, if available */
102
- get sender() {
103
- return this.raw.fromId ? new user.User(this.peers.user(this.raw.fromId)) : null;
104
- }
105
- /** Message ID where the gift was sent, if available */
106
- get messageId() {
107
- return this.raw.msgId ?? null;
108
- }
109
- /** Date the gift was sent or minted */
110
- get date() {
111
- return new Date(this.raw.date * 1e3);
112
- }
113
- /** Whether the gift can be upgraded to a unique gift */
114
- get canUpgrade() {
115
- return this.raw.canUpgrade;
116
- }
117
- /** Number of stars to upgrade the gift to a unique gift (may be 0) */
118
- get upgradeStars() {
119
- if (!this.raw.canUpgrade) return null;
120
- return this.raw.upgradeStars ?? Long.ZERO;
121
- }
122
- /** The gift itself */
123
- get gift() {
124
- return this.raw.gift._ === "starGift" ? new StarGift(this.raw.gift) : new starsGiftUnique.StarGiftUnique(this.raw.gift, this.peers);
125
- }
126
- /** Text attached to the gift */
127
- get text() {
128
- return this.raw.message ?? null;
129
- }
130
- /**
131
- * If the gift was converted to stars, the amount of stars
132
- * it was converted to
133
- */
134
- get convertStars() {
135
- return this.raw.convertStars ?? null;
136
- }
137
- get canExportAt() {
138
- return this.raw.canExportAt ? new Date(this.raw.canExportAt * 1e3) : null;
139
- }
140
- /** Number of stars this gift can be transferred for */
141
- get transferStars() {
142
- return this.raw.transferStars ?? null;
143
- }
144
- }
145
- const UserStarGift$1 = /* @__PURE__ */ inspectable.makeInspectable(UserStarGift);
146
- const UserStarGift$2 = /* @__PURE__ */ memoize.memoizeGetters(UserStarGift$1, ["sender", "gift"]);
147
82
  exports.StarGift = StarGift$2;
148
- exports.UserStarGift = UserStarGift$2;
@@ -1,11 +1,18 @@
1
1
  import { tl } from '@mtcute/tl';
2
2
  import { Sticker } from '../media/sticker.js';
3
- import { TextWithEntities } from '../misc/entities.js';
4
- import { PeersIndex } from '../peers/peers-index.js';
5
- import { User } from '../peers/user.js';
6
- import { StarGiftUnique } from './stars-gift-unique.js';
3
+ import { Message } from '../messages/message.js';
4
+ import { InputPeerLike } from '../peers/peer.js';
5
+ export type InputStarGift = {
6
+ /** ID of the message containing the gift */
7
+ message: number | Message;
8
+ } | {
9
+ /** Owner of the gift */
10
+ owner: InputPeerLike;
11
+ /** ID of the gift */
12
+ savedId: tl.Long;
13
+ };
7
14
  /**
8
- * A gift with stars attached to it.
15
+ * A gift bought with stars
9
16
  */
10
17
  export declare class StarGift {
11
18
  readonly raw: tl.RawStarGift;
@@ -46,38 +53,3 @@ export declare class StarGift {
46
53
  total: number;
47
54
  } | null;
48
55
  }
49
- /**
50
- * Information about a certain user's {@link StarGift}.
51
- */
52
- export declare class UserStarGift {
53
- readonly raw: tl.RawUserStarGift;
54
- readonly peers: PeersIndex;
55
- constructor(raw: tl.RawUserStarGift, peers: PeersIndex);
56
- /** Whether the sender chose to appear anonymously */
57
- get nameHidden(): boolean;
58
- /** Whether this gift is not visible on the recipient's profile */
59
- get hidden(): boolean;
60
- get isRefunded(): boolean;
61
- /** Sender of the gift, if available */
62
- get sender(): User | null;
63
- /** Message ID where the gift was sent, if available */
64
- get messageId(): number | null;
65
- /** Date the gift was sent or minted */
66
- get date(): Date;
67
- /** Whether the gift can be upgraded to a unique gift */
68
- get canUpgrade(): boolean;
69
- /** Number of stars to upgrade the gift to a unique gift (may be 0) */
70
- get upgradeStars(): tl.Long | null;
71
- /** The gift itself */
72
- get gift(): StarGift | StarGiftUnique;
73
- /** Text attached to the gift */
74
- get text(): TextWithEntities | null;
75
- /**
76
- * If the gift was converted to stars, the amount of stars
77
- * it was converted to
78
- */
79
- get convertStars(): tl.Long | null;
80
- get canExportAt(): Date | null;
81
- /** Number of stars this gift can be transferred for */
82
- get transferStars(): tl.Long | null;
83
- }
@@ -1,11 +1,18 @@
1
1
  import { tl } from '@mtcute/tl';
2
2
  import { Sticker } from '../media/sticker.js';
3
- import { TextWithEntities } from '../misc/entities.js';
4
- import { PeersIndex } from '../peers/peers-index.js';
5
- import { User } from '../peers/user.js';
6
- import { StarGiftUnique } from './stars-gift-unique.js';
3
+ import { Message } from '../messages/message.js';
4
+ import { InputPeerLike } from '../peers/peer.js';
5
+ export type InputStarGift = {
6
+ /** ID of the message containing the gift */
7
+ message: number | Message;
8
+ } | {
9
+ /** Owner of the gift */
10
+ owner: InputPeerLike;
11
+ /** ID of the gift */
12
+ savedId: tl.Long;
13
+ };
7
14
  /**
8
- * A gift with stars attached to it.
15
+ * A gift bought with stars
9
16
  */
10
17
  export declare class StarGift {
11
18
  readonly raw: tl.RawStarGift;
@@ -46,38 +53,3 @@ export declare class StarGift {
46
53
  total: number;
47
54
  } | null;
48
55
  }
49
- /**
50
- * Information about a certain user's {@link StarGift}.
51
- */
52
- export declare class UserStarGift {
53
- readonly raw: tl.RawUserStarGift;
54
- readonly peers: PeersIndex;
55
- constructor(raw: tl.RawUserStarGift, peers: PeersIndex);
56
- /** Whether the sender chose to appear anonymously */
57
- get nameHidden(): boolean;
58
- /** Whether this gift is not visible on the recipient's profile */
59
- get hidden(): boolean;
60
- get isRefunded(): boolean;
61
- /** Sender of the gift, if available */
62
- get sender(): User | null;
63
- /** Message ID where the gift was sent, if available */
64
- get messageId(): number | null;
65
- /** Date the gift was sent or minted */
66
- get date(): Date;
67
- /** Whether the gift can be upgraded to a unique gift */
68
- get canUpgrade(): boolean;
69
- /** Number of stars to upgrade the gift to a unique gift (may be 0) */
70
- get upgradeStars(): tl.Long | null;
71
- /** The gift itself */
72
- get gift(): StarGift | StarGiftUnique;
73
- /** Text attached to the gift */
74
- get text(): TextWithEntities | null;
75
- /**
76
- * If the gift was converted to stars, the amount of stars
77
- * it was converted to
78
- */
79
- get convertStars(): tl.Long | null;
80
- get canExportAt(): Date | null;
81
- /** Number of stars this gift can be transferred for */
82
- get transferStars(): tl.Long | null;
83
- }
@@ -1,11 +1,8 @@
1
- import Long from "long";
2
1
  import { MtTypeAssertionError } from "../../../types/errors.js";
3
2
  import { assertTypeIs } from "../../../utils/type-assertions.js";
4
3
  import { makeInspectable } from "../../utils/inspectable.js";
5
4
  import { memoizeGetters } from "../../utils/memoize.js";
6
5
  import { parseDocument } from "../media/document-utils.js";
7
- import { User as User$2 } from "../peers/user.js";
8
- import { StarGiftUnique as StarGiftUnique$2 } from "./stars-gift-unique.js";
9
6
  class StarGift {
10
7
  constructor(raw) {
11
8
  this.raw = raw;
@@ -75,69 +72,6 @@ class StarGift {
75
72
  }
76
73
  const StarGift$1 = /* @__PURE__ */ makeInspectable(StarGift);
77
74
  const StarGift$2 = /* @__PURE__ */ memoizeGetters(StarGift$1, ["sticker"]);
78
- class UserStarGift {
79
- constructor(raw, peers) {
80
- this.raw = raw;
81
- this.peers = peers;
82
- }
83
- /** Whether the sender chose to appear anonymously */
84
- get nameHidden() {
85
- return this.raw.nameHidden;
86
- }
87
- /** Whether this gift is not visible on the recipient's profile */
88
- get hidden() {
89
- return this.raw.unsaved;
90
- }
91
- get isRefunded() {
92
- return this.raw.refunded;
93
- }
94
- /** Sender of the gift, if available */
95
- get sender() {
96
- return this.raw.fromId ? new User$2(this.peers.user(this.raw.fromId)) : null;
97
- }
98
- /** Message ID where the gift was sent, if available */
99
- get messageId() {
100
- return this.raw.msgId ?? null;
101
- }
102
- /** Date the gift was sent or minted */
103
- get date() {
104
- return new Date(this.raw.date * 1e3);
105
- }
106
- /** Whether the gift can be upgraded to a unique gift */
107
- get canUpgrade() {
108
- return this.raw.canUpgrade;
109
- }
110
- /** Number of stars to upgrade the gift to a unique gift (may be 0) */
111
- get upgradeStars() {
112
- if (!this.raw.canUpgrade) return null;
113
- return this.raw.upgradeStars ?? Long.ZERO;
114
- }
115
- /** The gift itself */
116
- get gift() {
117
- return this.raw.gift._ === "starGift" ? new StarGift(this.raw.gift) : new StarGiftUnique$2(this.raw.gift, this.peers);
118
- }
119
- /** Text attached to the gift */
120
- get text() {
121
- return this.raw.message ?? null;
122
- }
123
- /**
124
- * If the gift was converted to stars, the amount of stars
125
- * it was converted to
126
- */
127
- get convertStars() {
128
- return this.raw.convertStars ?? null;
129
- }
130
- get canExportAt() {
131
- return this.raw.canExportAt ? new Date(this.raw.canExportAt * 1e3) : null;
132
- }
133
- /** Number of stars this gift can be transferred for */
134
- get transferStars() {
135
- return this.raw.transferStars ?? null;
136
- }
137
- }
138
- const UserStarGift$1 = /* @__PURE__ */ makeInspectable(UserStarGift);
139
- const UserStarGift$2 = /* @__PURE__ */ memoizeGetters(UserStarGift$1, ["sender", "gift"]);
140
75
  export {
141
- StarGift$2 as StarGift,
142
- UserStarGift$2 as UserStarGift
76
+ StarGift$2 as StarGift
143
77
  };
@@ -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
  }