@mtcute/core 0.25.8 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/client.cjs +18 -12
  2. package/client.js +21 -15
  3. package/highlevel/client.d.cts +78 -72
  4. package/highlevel/client.d.ts +78 -72
  5. package/highlevel/methods/forums/toggle-forum.cjs +0 -10
  6. package/highlevel/methods/forums/toggle-forum.d.cts +0 -10
  7. package/highlevel/methods/forums/toggle-forum.d.ts +0 -10
  8. package/highlevel/methods/forums/toggle-forum.js +0 -10
  9. package/highlevel/methods/premium/get-resale-star-gifts.cjs +0 -4
  10. package/highlevel/methods/premium/get-resale-star-gifts.d.cts +0 -6
  11. package/highlevel/methods/premium/get-resale-star-gifts.d.ts +0 -6
  12. package/highlevel/methods/premium/get-resale-star-gifts.js +0 -4
  13. package/highlevel/methods/premium/get-saved-star-gifts.cjs +2 -1
  14. package/highlevel/methods/premium/get-saved-star-gifts.d.cts +4 -2
  15. package/highlevel/methods/premium/get-saved-star-gifts.d.ts +4 -2
  16. package/highlevel/methods/premium/get-saved-star-gifts.js +2 -1
  17. package/highlevel/methods/{auth/run.cjs → premium/get-star-gift-value.cjs} +8 -5
  18. package/highlevel/methods/premium/get-star-gift-value.d.cts +9 -0
  19. package/highlevel/methods/premium/get-star-gift-value.d.ts +9 -0
  20. package/highlevel/methods/premium/get-star-gift-value.js +11 -0
  21. package/highlevel/methods/premium/get-stars-transactions.cjs +3 -2
  22. package/highlevel/methods/premium/get-stars-transactions.d.cts +2 -0
  23. package/highlevel/methods/premium/get-stars-transactions.d.ts +2 -0
  24. package/highlevel/methods/premium/get-stars-transactions.js +3 -2
  25. package/highlevel/methods/premium/iter-saved-star-gifts.cjs +15 -10
  26. package/highlevel/methods/premium/iter-saved-star-gifts.d.cts +13 -19
  27. package/highlevel/methods/premium/iter-saved-star-gifts.d.ts +13 -19
  28. package/highlevel/methods/premium/iter-saved-star-gifts.js +15 -10
  29. package/highlevel/methods/premium/prepay-star-gift-upgrade.cjs +30 -0
  30. package/highlevel/methods/premium/prepay-star-gift-upgrade.d.cts +23 -0
  31. package/highlevel/methods/premium/prepay-star-gift-upgrade.d.ts +23 -0
  32. package/highlevel/methods/premium/prepay-star-gift-upgrade.js +25 -0
  33. package/highlevel/methods/stickers/delete-sticker-from-set.d.cts +2 -4
  34. package/highlevel/methods/stickers/delete-sticker-from-set.d.ts +2 -4
  35. package/highlevel/methods/stickers/move-sticker-in-set.d.cts +2 -4
  36. package/highlevel/methods/stickers/move-sticker-in-set.d.ts +2 -4
  37. package/highlevel/methods/stickers/replace-sticker-in-set.d.cts +2 -4
  38. package/highlevel/methods/stickers/replace-sticker-in-set.d.ts +2 -4
  39. package/highlevel/methods/users/get-saved-music.cjs +38 -0
  40. package/highlevel/methods/users/get-saved-music.d.cts +13 -0
  41. package/highlevel/methods/users/get-saved-music.d.ts +13 -0
  42. package/highlevel/methods/users/get-saved-music.js +33 -0
  43. package/highlevel/methods/users/save-music-to-profile.cjs +57 -0
  44. package/highlevel/methods/users/save-music-to-profile.d.cts +19 -0
  45. package/highlevel/methods/users/save-music-to-profile.d.ts +19 -0
  46. package/highlevel/methods/users/save-music-to-profile.js +52 -0
  47. package/highlevel/methods/users/set-emoji-status.cjs +0 -8
  48. package/highlevel/methods/users/set-emoji-status.d.cts +0 -11
  49. package/highlevel/methods/users/set-emoji-status.d.ts +0 -11
  50. package/highlevel/methods/users/set-emoji-status.js +1 -9
  51. package/highlevel/methods.d.cts +5 -4
  52. package/highlevel/methods.d.ts +5 -4
  53. package/highlevel/types/files/utils.d.cts +7 -0
  54. package/highlevel/types/files/utils.d.ts +7 -0
  55. package/highlevel/types/media/document.d.cts +1 -1
  56. package/highlevel/types/media/document.d.ts +1 -1
  57. package/highlevel/types/messages/message-action.cjs +43 -21
  58. package/highlevel/types/messages/message-action.d.cts +58 -17
  59. package/highlevel/types/messages/message-action.d.ts +58 -17
  60. package/highlevel/types/messages/message-action.js +43 -21
  61. package/highlevel/types/peers/full-user.cjs +10 -1
  62. package/highlevel/types/peers/full-user.d.cts +3 -0
  63. package/highlevel/types/peers/full-user.d.ts +3 -0
  64. package/highlevel/types/peers/full-user.js +10 -1
  65. package/highlevel/types/premium/index.d.cts +1 -0
  66. package/highlevel/types/premium/index.d.ts +1 -0
  67. package/highlevel/types/premium/saved-star-gift.cjs +6 -0
  68. package/highlevel/types/premium/saved-star-gift.d.cts +4 -0
  69. package/highlevel/types/premium/saved-star-gift.d.ts +4 -0
  70. package/highlevel/types/premium/saved-star-gift.js +6 -0
  71. package/highlevel/types/premium/star-gift-value.cjs +65 -0
  72. package/highlevel/types/premium/star-gift-value.d.cts +41 -0
  73. package/highlevel/types/premium/star-gift-value.d.ts +41 -0
  74. package/highlevel/types/premium/star-gift-value.js +60 -0
  75. package/highlevel/types/premium/stars-gift-unique.cjs +10 -3
  76. package/highlevel/types/premium/stars-gift-unique.d.cts +1 -1
  77. package/highlevel/types/premium/stars-gift-unique.d.ts +1 -1
  78. package/highlevel/types/premium/stars-gift-unique.js +10 -3
  79. package/highlevel/types/premium/stars-transaction.cjs +9 -0
  80. package/highlevel/types/premium/stars-transaction.d.cts +10 -0
  81. package/highlevel/types/premium/stars-transaction.d.ts +10 -0
  82. package/highlevel/types/premium/stars-transaction.js +9 -0
  83. package/index.cjs +2 -0
  84. package/index.js +2 -0
  85. package/methods.cjs +9 -5
  86. package/methods.js +12 -8
  87. package/network/network-manager.cjs +1 -1
  88. package/network/network-manager.js +1 -1
  89. package/package.json +2 -2
  90. package/utils/binary/compat.cjs +35 -4
  91. package/utils/binary/compat.js +35 -4
  92. package/highlevel/methods/auth/run.d.cts +0 -16
  93. package/highlevel/methods/auth/run.d.ts +0 -16
  94. package/highlevel/methods/auth/run.js +0 -8
@@ -4,7 +4,6 @@ export { logOut } from './methods/auth/log-out.js';
4
4
  export type { LogOutResult } from './methods/auth/log-out.js';
5
5
  export { recoverPassword } from './methods/auth/recover-password.js';
6
6
  export { resendCode } from './methods/auth/resend-code.js';
7
- export { run } from './methods/auth/run.js';
8
7
  export { sendCode } from './methods/auth/send-code.js';
9
8
  export { sendRecoveryCode } from './methods/auth/send-recovery-code.js';
10
9
  export { signInBot } from './methods/auth/sign-in-bot.js';
@@ -115,7 +114,6 @@ export { iterForumTopics } from './methods/forums/iter-forum-topics.js';
115
114
  export { reorderPinnedForumTopics } from './methods/forums/reorder-pinned-forum-topics.js';
116
115
  export { toggleForumTopicClosed } from './methods/forums/toggle-forum-topic-closed.js';
117
116
  export { toggleForumTopicPinned } from './methods/forums/toggle-forum-topic-pinned.js';
118
- export { toggleForum } from './methods/forums/toggle-forum.js';
119
117
  export { updateForumSettings } from './methods/forums/toggle-forum.js';
120
118
  export { toggleGeneralTopicHidden } from './methods/forums/toggle-general-topic-hidden.js';
121
119
  export { createInviteLink } from './methods/invite-links/create-invite-link.js';
@@ -232,11 +230,11 @@ export { getBusinessChatLinks } from './methods/premium/get-business-chat-links.
232
230
  export { getBusinessConnection } from './methods/premium/get-business-connection.js';
233
231
  export { getMyBoostSlots } from './methods/premium/get-my-boost-slots.js';
234
232
  export { getStarGiftResaleOptions } from './methods/premium/get-resale-star-gifts.js';
235
- export { getResaleOptions } from './methods/premium/get-resale-star-gifts.js';
236
233
  export type { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/premium/get-resale-star-gifts.js';
237
234
  export { getSavedStarGiftsById } from './methods/premium/get-saved-star-gifts-by-id.js';
238
235
  export { getSavedStarGifts } from './methods/premium/get-saved-star-gifts.js';
239
236
  export { getStarGiftOptions } from './methods/premium/get-star-gift-options.js';
237
+ export { getStarGiftValue } from './methods/premium/get-star-gift-value.js';
240
238
  export { getStarGiftWithdrawalUrl } from './methods/premium/get-star-gift-withdrawal-url.js';
241
239
  export { getStarsTransactions } from './methods/premium/get-stars-transactions.js';
242
240
  export { getUniqueStarGift } from './methods/premium/get-unique-star-gift.js';
@@ -244,6 +242,7 @@ export { iterBoosters } from './methods/premium/iter-boosters.js';
244
242
  export { iterSavedStarGifts } from './methods/premium/iter-saved-star-gifts.js';
245
243
  export { iterStarsTransactions } from './methods/premium/iter-stars-transactions.js';
246
244
  export { togglePinnedStarGifts } from './methods/premium/pin-star-gift.js';
245
+ export { prepayStarGiftUpgrade } from './methods/premium/prepay-star-gift-upgrade.js';
247
246
  export { sendStarGift } from './methods/premium/send-star-gift.js';
248
247
  export { setBusinessIntro } from './methods/premium/set-business-intro.js';
249
248
  export { setBusinessWorkHours } from './methods/premium/set-business-work-hours.js';
@@ -294,6 +293,7 @@ export { getMyUsername } from './methods/users/get-my-username.js';
294
293
  export { getPeerSettings } from './methods/users/get-peer-settings.js';
295
294
  export { getProfilePhoto } from './methods/users/get-profile-photo.js';
296
295
  export { getProfilePhotos } from './methods/users/get-profile-photos.js';
296
+ export { getSavedMusic } from './methods/users/get-saved-music.js';
297
297
  export { getUsers } from './methods/users/get-users.js';
298
298
  export { isPeerAvailable } from './methods/users/is-peer-available.js';
299
299
  export { iterProfilePhotos } from './methods/users/iter-profile-photos.js';
@@ -302,7 +302,8 @@ export { resolvePeer } from './methods/users/resolve-peer.js';
302
302
  export { resolveUser } from './methods/users/resolve-peer.js';
303
303
  export { resolveChannel } from './methods/users/resolve-peer.js';
304
304
  export { resolvePhoneNumber } from './methods/users/resolve-phone-number.js';
305
- export { setMyEmojiStatus } from './methods/users/set-emoji-status.js';
305
+ export { saveMusicToProfile } from './methods/users/save-music-to-profile.js';
306
+ export { unsaveMusicFromProfile } from './methods/users/save-music-to-profile.js';
306
307
  export { setEmojiStatus } from './methods/users/set-emoji-status.js';
307
308
  export { setGlobalTtl } from './methods/users/set-global-ttl.js';
308
309
  export { setMyBirthday } from './methods/users/set-my-birthday.js';
@@ -4,7 +4,6 @@ export { logOut } from './methods/auth/log-out.js';
4
4
  export type { LogOutResult } from './methods/auth/log-out.js';
5
5
  export { recoverPassword } from './methods/auth/recover-password.js';
6
6
  export { resendCode } from './methods/auth/resend-code.js';
7
- export { run } from './methods/auth/run.js';
8
7
  export { sendCode } from './methods/auth/send-code.js';
9
8
  export { sendRecoveryCode } from './methods/auth/send-recovery-code.js';
10
9
  export { signInBot } from './methods/auth/sign-in-bot.js';
@@ -115,7 +114,6 @@ export { iterForumTopics } from './methods/forums/iter-forum-topics.js';
115
114
  export { reorderPinnedForumTopics } from './methods/forums/reorder-pinned-forum-topics.js';
116
115
  export { toggleForumTopicClosed } from './methods/forums/toggle-forum-topic-closed.js';
117
116
  export { toggleForumTopicPinned } from './methods/forums/toggle-forum-topic-pinned.js';
118
- export { toggleForum } from './methods/forums/toggle-forum.js';
119
117
  export { updateForumSettings } from './methods/forums/toggle-forum.js';
120
118
  export { toggleGeneralTopicHidden } from './methods/forums/toggle-general-topic-hidden.js';
121
119
  export { createInviteLink } from './methods/invite-links/create-invite-link.js';
@@ -232,11 +230,11 @@ export { getBusinessChatLinks } from './methods/premium/get-business-chat-links.
232
230
  export { getBusinessConnection } from './methods/premium/get-business-connection.js';
233
231
  export { getMyBoostSlots } from './methods/premium/get-my-boost-slots.js';
234
232
  export { getStarGiftResaleOptions } from './methods/premium/get-resale-star-gifts.js';
235
- export { getResaleOptions } from './methods/premium/get-resale-star-gifts.js';
236
233
  export type { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/premium/get-resale-star-gifts.js';
237
234
  export { getSavedStarGiftsById } from './methods/premium/get-saved-star-gifts-by-id.js';
238
235
  export { getSavedStarGifts } from './methods/premium/get-saved-star-gifts.js';
239
236
  export { getStarGiftOptions } from './methods/premium/get-star-gift-options.js';
237
+ export { getStarGiftValue } from './methods/premium/get-star-gift-value.js';
240
238
  export { getStarGiftWithdrawalUrl } from './methods/premium/get-star-gift-withdrawal-url.js';
241
239
  export { getStarsTransactions } from './methods/premium/get-stars-transactions.js';
242
240
  export { getUniqueStarGift } from './methods/premium/get-unique-star-gift.js';
@@ -244,6 +242,7 @@ export { iterBoosters } from './methods/premium/iter-boosters.js';
244
242
  export { iterSavedStarGifts } from './methods/premium/iter-saved-star-gifts.js';
245
243
  export { iterStarsTransactions } from './methods/premium/iter-stars-transactions.js';
246
244
  export { togglePinnedStarGifts } from './methods/premium/pin-star-gift.js';
245
+ export { prepayStarGiftUpgrade } from './methods/premium/prepay-star-gift-upgrade.js';
247
246
  export { sendStarGift } from './methods/premium/send-star-gift.js';
248
247
  export { setBusinessIntro } from './methods/premium/set-business-intro.js';
249
248
  export { setBusinessWorkHours } from './methods/premium/set-business-work-hours.js';
@@ -294,6 +293,7 @@ export { getMyUsername } from './methods/users/get-my-username.js';
294
293
  export { getPeerSettings } from './methods/users/get-peer-settings.js';
295
294
  export { getProfilePhoto } from './methods/users/get-profile-photo.js';
296
295
  export { getProfilePhotos } from './methods/users/get-profile-photos.js';
296
+ export { getSavedMusic } from './methods/users/get-saved-music.js';
297
297
  export { getUsers } from './methods/users/get-users.js';
298
298
  export { isPeerAvailable } from './methods/users/is-peer-available.js';
299
299
  export { iterProfilePhotos } from './methods/users/iter-profile-photos.js';
@@ -302,7 +302,8 @@ export { resolvePeer } from './methods/users/resolve-peer.js';
302
302
  export { resolveUser } from './methods/users/resolve-peer.js';
303
303
  export { resolveChannel } from './methods/users/resolve-peer.js';
304
304
  export { resolvePhoneNumber } from './methods/users/resolve-phone-number.js';
305
- export { setMyEmojiStatus } from './methods/users/set-emoji-status.js';
305
+ export { saveMusicToProfile } from './methods/users/save-music-to-profile.js';
306
+ export { unsaveMusicFromProfile } from './methods/users/save-music-to-profile.js';
306
307
  export { setEmojiStatus } from './methods/users/set-emoji-status.js';
307
308
  export { setGlobalTtl } from './methods/users/set-global-ttl.js';
308
309
  export { setMyBirthday } from './methods/users/set-my-birthday.js';
@@ -40,6 +40,13 @@ export type UploadFileLike = URL | Uint8Array | File | Blob | string | IReadable
40
40
  * - `td.RawFullRemoteFileLocation` (parsed File ID)
41
41
  */
42
42
  export type InputFileLike = UploadFileLike | UploadedFile | tl.TypeInputFile | tl.TypeInputMedia | tdFileId.RawFullRemoteFileLocation;
43
+ /**
44
+ * ID of an already uploaded document. Can be a:
45
+ * - `string` with a TDLib and Bot API compatible File ID
46
+ * - `td.RawFullRemoteFileLocation` (parsed File ID)
47
+ * - `tl.TypeInputDocument` (raw TL object)
48
+ */
49
+ export type InputDocumentId = string | tdFileId.RawFullRemoteFileLocation | tl.RawInputDocument;
43
50
  /**
44
51
  * File location which should be downloaded.
45
52
  * You can also provide TDLib and Bot API compatible File ID
@@ -40,6 +40,13 @@ export type UploadFileLike = URL | Uint8Array | File | Blob | string | IReadable
40
40
  * - `td.RawFullRemoteFileLocation` (parsed File ID)
41
41
  */
42
42
  export type InputFileLike = UploadFileLike | UploadedFile | tl.TypeInputFile | tl.TypeInputMedia | tdFileId.RawFullRemoteFileLocation;
43
+ /**
44
+ * ID of an already uploaded document. Can be a:
45
+ * - `string` with a TDLib and Bot API compatible File ID
46
+ * - `td.RawFullRemoteFileLocation` (parsed File ID)
47
+ * - `tl.TypeInputDocument` (raw TL object)
48
+ */
49
+ export type InputDocumentId = string | tdFileId.RawFullRemoteFileLocation | tl.RawInputDocument;
43
50
  /**
44
51
  * File location which should be downloaded.
45
52
  * You can also provide TDLib and Bot API compatible File ID
@@ -45,7 +45,7 @@ export declare abstract class RawDocument extends FileLocation {
45
45
  * Input document TL object generated from this object,
46
46
  * to be used with methods that use it
47
47
  */
48
- get inputDocument(): tl.TypeInputDocument;
48
+ get inputDocument(): tl.RawInputDocument;
49
49
  /**
50
50
  * Input media TL object generated from this object,
51
51
  * to be used inside {@link InputMediaLike} and
@@ -45,7 +45,7 @@ export declare abstract class RawDocument extends FileLocation {
45
45
  * Input document TL object generated from this object,
46
46
  * to be used with methods that use it
47
47
  */
48
- get inputDocument(): tl.TypeInputDocument;
48
+ get inputDocument(): tl.RawInputDocument;
49
49
  /**
50
50
  * Input media TL object generated from this object,
51
51
  * to be used inside {@link InputMediaLike} and
@@ -183,9 +183,17 @@ function _messageActionFromTl(act) {
183
183
  action: act.message
184
184
  };
185
185
  case "messageActionSetChatTheme":
186
+ if (act.theme._ === "chatThemeUniqueGift") {
187
+ utils.assert(act.theme.gift._ === "starGiftUnique");
188
+ return {
189
+ type: "theme_changed_unique",
190
+ gift: new starsGiftUnique.StarGiftUnique(act.theme.gift, this._peers),
191
+ themeSettings: act.theme.themeSettings
192
+ };
193
+ }
186
194
  return {
187
195
  type: "theme_changed",
188
- emoji: act.emoticon
196
+ emoji: act.theme.emoticon
189
197
  };
190
198
  case "messageActionChatJoinedByRequest":
191
199
  return {
@@ -286,10 +294,19 @@ function _messageActionFromTl(act) {
286
294
  boostPeer: peer.parsePeer(act.boostPeer, this._peers),
287
295
  giveawayMessageId: act.giveawayMsgId
288
296
  };
297
+ // todo: cleanup in the next breaking update
289
298
  case "messageActionStarGift":
290
299
  utils.assert(act.gift._ === "starGift");
300
+ if (act.prepaidUpgrade) {
301
+ return {
302
+ type: "star_gift_upgrade_paid",
303
+ gift: new starsGift.StarGift(act.gift, this._peers),
304
+ giftMsgId: act.giftMsgId ?? void 0,
305
+ upgradeMsgId: act.upgradeMsgId ?? null
306
+ };
307
+ }
291
308
  return {
292
- type: "stars_gift",
309
+ type: "star_gift_sent",
293
310
  nameHidden: act.nameHidden,
294
311
  saved: act.saved,
295
312
  converted: act.converted,
@@ -301,33 +318,38 @@ function _messageActionFromTl(act) {
301
318
  upgraded: act.upgraded,
302
319
  upgradeStars: act.upgradeStars ?? Long.ZERO,
303
320
  upgradeMsgId: act.upgradeMsgId ?? null,
304
- fromId: act.fromId ? peerUtils.getMarkedPeerId(act.fromId) : void 0,
305
- toId: act.peer ? peerUtils.getMarkedPeerId(act.peer) : void 0,
306
- savedId: act.savedId
321
+ savedId: act.savedId,
322
+ prepaidUpgradeHash: act.prepaidUpgradeHash ?? void 0
307
323
  };
308
- case "messageActionStarGiftUnique":
324
+ case "messageActionStarGiftUnique": {
309
325
  utils.assert(act.gift._ === "starGiftUnique");
310
- return {
311
- type: "stars_gift",
312
- nameHidden: false,
326
+ const common = {
313
327
  saved: act.saved,
314
- converted: false,
315
- convertStars: Long.ZERO,
316
328
  refunded: act.refunded,
317
329
  gift: new starsGiftUnique.StarGiftUnique(act.gift, this._peers),
318
- message: null,
319
- canUpgrade: false,
320
- upgraded: true,
321
- upgradeStars: Long.ZERO,
322
- upgradeMsgId: null,
323
- canTransferSince: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
324
- resaleStars: act.resaleAmount?._ === "starsAmount" ? act.resaleAmount.amount : void 0,
325
- resaleTon: act.resaleAmount?._ === "starsTonAmount" ? act.resaleAmount.amount : void 0,
330
+ canTransferAt: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
326
331
  canResellAt: act.canResellAt ? new Date(act.canResellAt * 1e3) : void 0,
327
- fromId: act.fromId ? peerUtils.getMarkedPeerId(act.fromId) : void 0,
328
- toId: act.peer ? peerUtils.getMarkedPeerId(act.peer) : void 0,
332
+ canExportAt: act.canExportAt ? new Date(act.canExportAt * 1e3) : void 0,
329
333
  savedId: act.savedId
330
334
  };
335
+ if (act.resaleAmount) {
336
+ return {
337
+ type: "star_gift_bought_resale",
338
+ ...common,
339
+ amount: act.resaleAmount
340
+ };
341
+ }
342
+ if (act.upgrade) {
343
+ return {
344
+ type: "star_gift_upgraded",
345
+ ...common
346
+ };
347
+ }
348
+ return {
349
+ type: "star_gift_transferred",
350
+ ...common
351
+ };
352
+ }
331
353
  case "messageActionPaidMessagesPrice":
332
354
  return {
333
355
  type: "messages_paid",
@@ -2,7 +2,6 @@ import { tl } from '@mtcute/tl';
2
2
  import { TextWithEntities } from '../misc/entities.js';
3
3
  import { Peer } from '../peers/peer.js';
4
4
  import { Message } from './message.js';
5
- import { default as Long } from 'long';
6
5
  import { Photo } from '../media/photo.js';
7
6
  import { StarGiftUnique } from '../premium/stars-gift-unique.js';
8
7
  import { StarGift } from '../premium/stars-gift.js';
@@ -244,6 +243,14 @@ export interface ActionThemeChanged {
244
243
  /** Emoji representing the new theme */
245
244
  emoji: string;
246
245
  }
246
+ /** Chat theme was changed to a unique star gift based one */
247
+ export interface ActionThemeChangedUnique {
248
+ readonly type: 'theme_changed_unique';
249
+ /** Unique star gift */
250
+ gift: StarGiftUnique;
251
+ /** Theme settings */
252
+ themeSettings: tl.TypeThemeSettings[];
253
+ }
247
254
  /** Data was sent from a WebView (user-side action) */
248
255
  export interface ActionWebviewDataSent {
249
256
  readonly type: 'webview_sent';
@@ -399,8 +406,8 @@ export interface ActionStarsPrize {
399
406
  giveawayMessageId: number;
400
407
  }
401
408
  /** A star gift was sent */
402
- export interface ActionStarGift {
403
- readonly type: 'stars_gift';
409
+ export interface ActionStarGiftSent {
410
+ readonly type: 'star_gift_sent';
404
411
  /** Whether the sender chose to send the gift anonymously */
405
412
  nameHidden: boolean;
406
413
  /** Whether this gift was saved to the recipient's profile */
@@ -414,6 +421,10 @@ export interface ActionStarGift {
414
421
  * (0 if the gift cannot be converted)
415
422
  */
416
423
  convertStars: tl.Long;
424
+ /** The gift itself */
425
+ gift: StarGift;
426
+ /** Message attached to the gift */
427
+ message: TextWithEntities | null;
417
428
  /** Whether this gift can be upgraded to a unique gift */
418
429
  canUpgrade: boolean;
419
430
  /** Whether this gift was upgraded to a unique gift */
@@ -422,21 +433,50 @@ export interface ActionStarGift {
422
433
  upgradeStars: tl.Long;
423
434
  /** If the gift was upgraded, ID of the message where this happened */
424
435
  upgradeMsgId: number | null;
425
- /** If the gift can be transferred, date when it can be re-sold */
426
- canTransferSince?: Date;
427
- /** Number of stars this gift is up for resell for */
428
- resaleStars?: tl.Long;
429
- /** Number of nanoton this gift is up for resell for */
430
- resaleTon?: tl.Long;
436
+ /** ID of the related saved profile gift */
437
+ savedId?: tl.Long;
438
+ /** If available, you can pay for this gift's upgrade by passing this hash to `prepayStarGiftUpgrade` */
439
+ prepaidUpgradeHash?: string;
440
+ }
441
+ /** A star gift upgrade was paid for */
442
+ export interface ActionStarGiftUpgradePaid {
443
+ readonly type: 'star_gift_upgrade_paid';
444
+ /** The gift itself */
445
+ gift: StarGift;
446
+ /** ID of the message where the gift was upgraded */
447
+ upgradeMsgId: number | null;
448
+ /** ID of the message containing the originally sent gift, if available */
449
+ giftMsgId?: number;
450
+ }
451
+ interface StarGiftUniqueCommon {
452
+ /** Whether this gift was saved to the recipient's profile */
453
+ saved: boolean;
454
+ /** Whether this gift was refunded */
455
+ refunded: boolean;
456
+ /** The gift itself */
457
+ gift: StarGiftUnique;
458
+ /** If the gift can be transferred, date when it will become available */
459
+ canTransferAt?: Date;
431
460
  /** If the gift can be re-sold, date when it will become available */
432
461
  canResellAt?: Date;
433
- /** The gift itself */
434
- gift: StarGift | StarGiftUnique;
435
- /** Message attached to the gift */
436
- message: TextWithEntities | null;
437
- fromId?: number;
438
- toId?: number;
439
- savedId?: Long;
462
+ /** If the gift can be exported to blockchain, date when it will become available */
463
+ canExportAt?: Date;
464
+ /** ID of the related saved profile gift */
465
+ savedId?: tl.Long;
466
+ }
467
+ /** A star gift was upgraded to a unique one */
468
+ export interface ActionStarGiftUpgraded extends StarGiftUniqueCommon {
469
+ readonly type: 'star_gift_upgraded';
470
+ }
471
+ /** A star gift was bought from a resale listing */
472
+ export interface ActionStarGiftBoughtResale extends StarGiftUniqueCommon {
473
+ readonly type: 'star_gift_bought_resale';
474
+ /** Number of stars/TON that were paid for the gift */
475
+ amount: tl.TypeStarsAmount;
476
+ }
477
+ /** A star gift was transferred */
478
+ export interface ActionStarGiftTransferred extends StarGiftUniqueCommon {
479
+ readonly type: 'star_gift_transferred';
440
480
  }
441
481
  /** Paid messages were paid for */
442
482
  export interface ActionPaidMessagesPaid {
@@ -482,6 +522,7 @@ export interface ActionTonGift {
482
522
  /** Transaction ID */
483
523
  transactionId?: string;
484
524
  }
485
- export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionUserJoinedApproved | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGift | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | null;
525
+ export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionThemeChangedUnique | ActionUserJoinedApproved | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGiftSent | ActionStarGiftUpgradePaid | ActionStarGiftUpgraded | ActionStarGiftBoughtResale | ActionStarGiftTransferred | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | null;
486
526
  /** @internal */
487
527
  export declare function _messageActionFromTl(this: Message, act: tl.TypeMessageAction): MessageAction;
528
+ export {};
@@ -2,7 +2,6 @@ import { tl } from '@mtcute/tl';
2
2
  import { TextWithEntities } from '../misc/entities.js';
3
3
  import { Peer } from '../peers/peer.js';
4
4
  import { Message } from './message.js';
5
- import { default as Long } from 'long';
6
5
  import { Photo } from '../media/photo.js';
7
6
  import { StarGiftUnique } from '../premium/stars-gift-unique.js';
8
7
  import { StarGift } from '../premium/stars-gift.js';
@@ -244,6 +243,14 @@ export interface ActionThemeChanged {
244
243
  /** Emoji representing the new theme */
245
244
  emoji: string;
246
245
  }
246
+ /** Chat theme was changed to a unique star gift based one */
247
+ export interface ActionThemeChangedUnique {
248
+ readonly type: 'theme_changed_unique';
249
+ /** Unique star gift */
250
+ gift: StarGiftUnique;
251
+ /** Theme settings */
252
+ themeSettings: tl.TypeThemeSettings[];
253
+ }
247
254
  /** Data was sent from a WebView (user-side action) */
248
255
  export interface ActionWebviewDataSent {
249
256
  readonly type: 'webview_sent';
@@ -399,8 +406,8 @@ export interface ActionStarsPrize {
399
406
  giveawayMessageId: number;
400
407
  }
401
408
  /** A star gift was sent */
402
- export interface ActionStarGift {
403
- readonly type: 'stars_gift';
409
+ export interface ActionStarGiftSent {
410
+ readonly type: 'star_gift_sent';
404
411
  /** Whether the sender chose to send the gift anonymously */
405
412
  nameHidden: boolean;
406
413
  /** Whether this gift was saved to the recipient's profile */
@@ -414,6 +421,10 @@ export interface ActionStarGift {
414
421
  * (0 if the gift cannot be converted)
415
422
  */
416
423
  convertStars: tl.Long;
424
+ /** The gift itself */
425
+ gift: StarGift;
426
+ /** Message attached to the gift */
427
+ message: TextWithEntities | null;
417
428
  /** Whether this gift can be upgraded to a unique gift */
418
429
  canUpgrade: boolean;
419
430
  /** Whether this gift was upgraded to a unique gift */
@@ -422,21 +433,50 @@ export interface ActionStarGift {
422
433
  upgradeStars: tl.Long;
423
434
  /** If the gift was upgraded, ID of the message where this happened */
424
435
  upgradeMsgId: number | null;
425
- /** If the gift can be transferred, date when it can be re-sold */
426
- canTransferSince?: Date;
427
- /** Number of stars this gift is up for resell for */
428
- resaleStars?: tl.Long;
429
- /** Number of nanoton this gift is up for resell for */
430
- resaleTon?: tl.Long;
436
+ /** ID of the related saved profile gift */
437
+ savedId?: tl.Long;
438
+ /** If available, you can pay for this gift's upgrade by passing this hash to `prepayStarGiftUpgrade` */
439
+ prepaidUpgradeHash?: string;
440
+ }
441
+ /** A star gift upgrade was paid for */
442
+ export interface ActionStarGiftUpgradePaid {
443
+ readonly type: 'star_gift_upgrade_paid';
444
+ /** The gift itself */
445
+ gift: StarGift;
446
+ /** ID of the message where the gift was upgraded */
447
+ upgradeMsgId: number | null;
448
+ /** ID of the message containing the originally sent gift, if available */
449
+ giftMsgId?: number;
450
+ }
451
+ interface StarGiftUniqueCommon {
452
+ /** Whether this gift was saved to the recipient's profile */
453
+ saved: boolean;
454
+ /** Whether this gift was refunded */
455
+ refunded: boolean;
456
+ /** The gift itself */
457
+ gift: StarGiftUnique;
458
+ /** If the gift can be transferred, date when it will become available */
459
+ canTransferAt?: Date;
431
460
  /** If the gift can be re-sold, date when it will become available */
432
461
  canResellAt?: Date;
433
- /** The gift itself */
434
- gift: StarGift | StarGiftUnique;
435
- /** Message attached to the gift */
436
- message: TextWithEntities | null;
437
- fromId?: number;
438
- toId?: number;
439
- savedId?: Long;
462
+ /** If the gift can be exported to blockchain, date when it will become available */
463
+ canExportAt?: Date;
464
+ /** ID of the related saved profile gift */
465
+ savedId?: tl.Long;
466
+ }
467
+ /** A star gift was upgraded to a unique one */
468
+ export interface ActionStarGiftUpgraded extends StarGiftUniqueCommon {
469
+ readonly type: 'star_gift_upgraded';
470
+ }
471
+ /** A star gift was bought from a resale listing */
472
+ export interface ActionStarGiftBoughtResale extends StarGiftUniqueCommon {
473
+ readonly type: 'star_gift_bought_resale';
474
+ /** Number of stars/TON that were paid for the gift */
475
+ amount: tl.TypeStarsAmount;
476
+ }
477
+ /** A star gift was transferred */
478
+ export interface ActionStarGiftTransferred extends StarGiftUniqueCommon {
479
+ readonly type: 'star_gift_transferred';
440
480
  }
441
481
  /** Paid messages were paid for */
442
482
  export interface ActionPaidMessagesPaid {
@@ -482,6 +522,7 @@ export interface ActionTonGift {
482
522
  /** Transaction ID */
483
523
  transactionId?: string;
484
524
  }
485
- export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionUserJoinedApproved | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGift | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | null;
525
+ export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionThemeChangedUnique | ActionUserJoinedApproved | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGiftSent | ActionStarGiftUpgradePaid | ActionStarGiftUpgraded | ActionStarGiftBoughtResale | ActionStarGiftTransferred | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | null;
486
526
  /** @internal */
487
527
  export declare function _messageActionFromTl(this: Message, act: tl.TypeMessageAction): MessageAction;
528
+ export {};
@@ -176,9 +176,17 @@ function _messageActionFromTl(act) {
176
176
  action: act.message
177
177
  };
178
178
  case "messageActionSetChatTheme":
179
+ if (act.theme._ === "chatThemeUniqueGift") {
180
+ assert(act.theme.gift._ === "starGiftUnique");
181
+ return {
182
+ type: "theme_changed_unique",
183
+ gift: new StarGiftUnique$2(act.theme.gift, this._peers),
184
+ themeSettings: act.theme.themeSettings
185
+ };
186
+ }
179
187
  return {
180
188
  type: "theme_changed",
181
- emoji: act.emoticon
189
+ emoji: act.theme.emoticon
182
190
  };
183
191
  case "messageActionChatJoinedByRequest":
184
192
  return {
@@ -279,10 +287,19 @@ function _messageActionFromTl(act) {
279
287
  boostPeer: parsePeer(act.boostPeer, this._peers),
280
288
  giveawayMessageId: act.giveawayMsgId
281
289
  };
290
+ // todo: cleanup in the next breaking update
282
291
  case "messageActionStarGift":
283
292
  assert(act.gift._ === "starGift");
293
+ if (act.prepaidUpgrade) {
294
+ return {
295
+ type: "star_gift_upgrade_paid",
296
+ gift: new StarGift$2(act.gift, this._peers),
297
+ giftMsgId: act.giftMsgId ?? void 0,
298
+ upgradeMsgId: act.upgradeMsgId ?? null
299
+ };
300
+ }
284
301
  return {
285
- type: "stars_gift",
302
+ type: "star_gift_sent",
286
303
  nameHidden: act.nameHidden,
287
304
  saved: act.saved,
288
305
  converted: act.converted,
@@ -294,33 +311,38 @@ function _messageActionFromTl(act) {
294
311
  upgraded: act.upgraded,
295
312
  upgradeStars: act.upgradeStars ?? Long.ZERO,
296
313
  upgradeMsgId: act.upgradeMsgId ?? null,
297
- fromId: act.fromId ? getMarkedPeerId(act.fromId) : void 0,
298
- toId: act.peer ? getMarkedPeerId(act.peer) : void 0,
299
- savedId: act.savedId
314
+ savedId: act.savedId,
315
+ prepaidUpgradeHash: act.prepaidUpgradeHash ?? void 0
300
316
  };
301
- case "messageActionStarGiftUnique":
317
+ case "messageActionStarGiftUnique": {
302
318
  assert(act.gift._ === "starGiftUnique");
303
- return {
304
- type: "stars_gift",
305
- nameHidden: false,
319
+ const common = {
306
320
  saved: act.saved,
307
- converted: false,
308
- convertStars: Long.ZERO,
309
321
  refunded: act.refunded,
310
322
  gift: new StarGiftUnique$2(act.gift, this._peers),
311
- message: null,
312
- canUpgrade: false,
313
- upgraded: true,
314
- upgradeStars: Long.ZERO,
315
- upgradeMsgId: null,
316
- canTransferSince: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
317
- resaleStars: act.resaleAmount?._ === "starsAmount" ? act.resaleAmount.amount : void 0,
318
- resaleTon: act.resaleAmount?._ === "starsTonAmount" ? act.resaleAmount.amount : void 0,
323
+ canTransferAt: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
319
324
  canResellAt: act.canResellAt ? new Date(act.canResellAt * 1e3) : void 0,
320
- fromId: act.fromId ? getMarkedPeerId(act.fromId) : void 0,
321
- toId: act.peer ? getMarkedPeerId(act.peer) : void 0,
325
+ canExportAt: act.canExportAt ? new Date(act.canExportAt * 1e3) : void 0,
322
326
  savedId: act.savedId
323
327
  };
328
+ if (act.resaleAmount) {
329
+ return {
330
+ type: "star_gift_bought_resale",
331
+ ...common,
332
+ amount: act.resaleAmount
333
+ };
334
+ }
335
+ if (act.upgrade) {
336
+ return {
337
+ type: "star_gift_upgraded",
338
+ ...common
339
+ };
340
+ }
341
+ return {
342
+ type: "star_gift_transferred",
343
+ ...common
344
+ };
345
+ }
324
346
  case "messageActionPaidMessagesPrice":
325
347
  return {
326
348
  type: "messages_paid",
@@ -7,6 +7,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
7
7
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
8
  const inspectable = require("../../utils/inspectable.cjs");
9
9
  const memoize = require("../../utils/memoize.cjs");
10
+ const documentUtils = require("../media/document-utils.cjs");
10
11
  const photo = require("../media/photo.cjs");
11
12
  const businessAccount = require("../premium/business-account.cjs");
12
13
  const botVerification = require("./bot-verification.cjs");
@@ -234,6 +235,13 @@ class FullUser extends user.User {
234
235
  date: new Date(this.full.starsMyPendingRatingDate * 1e3)
235
236
  };
236
237
  }
238
+ /** User's last saved audio file, to be displayed in the profile under their name */
239
+ get lastSavedMusic() {
240
+ if (this.full.savedMusic?._ !== "document") return null;
241
+ const doc = documentUtils.parseDocument(this.full.savedMusic);
242
+ if (doc.type !== "audio") return null;
243
+ return doc;
244
+ }
237
245
  }
238
246
  const FullUser$1 = /* @__PURE__ */ memoize.memoizeGetters(FullUser, [
239
247
  "fullPhoto",
@@ -243,7 +251,8 @@ const FullUser$1 = /* @__PURE__ */ memoize.memoizeGetters(FullUser, [
243
251
  "personalChannel",
244
252
  "business",
245
253
  "botVerification",
246
- "starsRatingPending"
254
+ "starsRatingPending",
255
+ "lastSavedMusic"
247
256
  ]);
248
257
  const FullUser$2 = /* @__PURE__ */ inspectable.makeInspectable(FullUser$1);
249
258
  exports.FullUser = FullUser$2;
@@ -1,4 +1,5 @@
1
1
  import { tl } from '@mtcute/tl';
2
+ import { Audio } from '../media/audio.js';
2
3
  import { Photo } from '../media/photo.js';
3
4
  import { BusinessAccount } from '../premium/business-account.js';
4
5
  import { BotVerification } from './bot-verification.js';
@@ -132,4 +133,6 @@ export declare class FullUser extends User {
132
133
  rating: tl.RawStarsRating;
133
134
  date: Date;
134
135
  } | null;
136
+ /** User's last saved audio file, to be displayed in the profile under their name */
137
+ get lastSavedMusic(): Audio | null;
135
138
  }