@mtcute/core 0.27.9 → 0.28.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 (45) hide show
  1. package/client.cjs +4 -0
  2. package/client.js +4 -0
  3. package/highlevel/client.d.cts +8 -0
  4. package/highlevel/client.d.ts +8 -0
  5. package/highlevel/methods/chats/get-creator-after-leave.cjs +18 -0
  6. package/highlevel/methods/chats/get-creator-after-leave.d.cts +9 -0
  7. package/highlevel/methods/chats/get-creator-after-leave.d.ts +9 -0
  8. package/highlevel/methods/chats/get-creator-after-leave.js +13 -0
  9. package/highlevel/methods/files/download-iterable.cjs +17 -6
  10. package/highlevel/methods/files/download-iterable.js +17 -6
  11. package/highlevel/methods/gifts/get-resale-star-gifts.cjs +2 -1
  12. package/highlevel/methods/gifts/get-resale-star-gifts.d.cts +2 -0
  13. package/highlevel/methods/gifts/get-resale-star-gifts.d.ts +2 -0
  14. package/highlevel/methods/gifts/get-resale-star-gifts.js +2 -1
  15. package/highlevel/methods.d.cts +1 -0
  16. package/highlevel/methods.d.ts +1 -0
  17. package/highlevel/types/bots/keyboards/factories.cjs +26 -18
  18. package/highlevel/types/bots/keyboards/factories.d.cts +34 -10
  19. package/highlevel/types/bots/keyboards/factories.d.ts +34 -10
  20. package/highlevel/types/bots/keyboards/factories.js +26 -18
  21. package/highlevel/types/messages/message-action.cjs +18 -0
  22. package/highlevel/types/messages/message-action.d.cts +20 -1
  23. package/highlevel/types/messages/message-action.d.ts +20 -1
  24. package/highlevel/types/messages/message-action.js +18 -0
  25. package/highlevel/types/peers/chat.cjs +1 -1
  26. package/highlevel/types/peers/chat.js +1 -1
  27. package/highlevel/types/peers/user.cjs +3 -0
  28. package/highlevel/types/peers/user.d.cts +1 -0
  29. package/highlevel/types/peers/user.d.ts +1 -0
  30. package/highlevel/types/peers/user.js +3 -0
  31. package/highlevel/types/premium/saved-star-gift.cjs +4 -0
  32. package/highlevel/types/premium/saved-star-gift.d.cts +2 -0
  33. package/highlevel/types/premium/saved-star-gift.d.ts +2 -0
  34. package/highlevel/types/premium/saved-star-gift.js +4 -0
  35. package/highlevel/types/premium/star-gift-unique.cjs +43 -4
  36. package/highlevel/types/premium/star-gift-unique.d.cts +18 -4
  37. package/highlevel/types/premium/star-gift-unique.d.ts +18 -4
  38. package/highlevel/types/premium/star-gift-unique.js +43 -4
  39. package/methods.cjs +2 -0
  40. package/methods.js +2 -0
  41. package/network/network-manager.cjs +1 -1
  42. package/network/network-manager.js +1 -1
  43. package/package.json +2 -2
  44. package/utils/binary/compat.cjs +105 -4
  45. package/utils/binary/compat.js +105 -4
@@ -54,34 +54,37 @@ function requestPoll(text2, quiz) {
54
54
  quiz
55
55
  };
56
56
  }
57
- function url(text2, url2) {
57
+ function url(text2, url2, options) {
58
58
  return {
59
59
  _: "keyboardButtonUrl",
60
60
  text: text2,
61
- url: url2
61
+ url: url2,
62
+ style: options?.style
62
63
  };
63
64
  }
64
- function callback(text2, data, requiresPassword) {
65
+ function callback(text2, data, options) {
65
66
  return {
66
67
  _: "keyboardButtonCallback",
67
68
  text: text2,
68
- requiresPassword,
69
+ requiresPassword: options?.requiresPassword,
70
+ style: options?.style,
69
71
  data: typeof data === "string" ? utf8.encoder.encode(data) : data
70
72
  };
71
73
  }
72
- function switchInline(text2, query = "", currentChat) {
74
+ function switchInline(text2, options) {
73
75
  return {
74
76
  _: "keyboardButtonSwitchInline",
75
- samePeer: currentChat,
77
+ samePeer: options?.currentChat,
78
+ style: options?.style,
76
79
  text: text2,
77
- query
80
+ query: options?.query ?? ""
78
81
  };
79
82
  }
80
- function game(text2) {
81
- return { _: "keyboardButtonGame", text: text2 };
83
+ function game(text2, options) {
84
+ return { _: "keyboardButtonGame", text: text2, style: options?.style };
82
85
  }
83
- function pay(text2) {
84
- return { _: "keyboardButtonBuy", text: text2 };
86
+ function pay(text2, options) {
87
+ return { _: "keyboardButtonBuy", text: text2, style: options?.style };
85
88
  }
86
89
  function urlAuth(text2, url2, params = {}) {
87
90
  return {
@@ -92,21 +95,24 @@ function urlAuth(text2, url2, params = {}) {
92
95
  _: "inputUserSelf"
93
96
  },
94
97
  fwdText: params.fwdText,
95
- requestWriteAccess: params.requestWriteAccess
98
+ requestWriteAccess: params.requestWriteAccess,
99
+ style: params.style
96
100
  };
97
101
  }
98
- function webView(text2, url2) {
102
+ function webView(text2, url2, options) {
99
103
  return {
100
104
  _: "keyboardButtonWebView",
101
105
  text: text2,
102
- url: url2
106
+ url: url2,
107
+ style: options?.style
103
108
  };
104
109
  }
105
- function userProfile(text2, user) {
110
+ function userProfile(text2, user, options) {
106
111
  return {
107
112
  _: "inputKeyboardButtonUserProfile",
108
113
  text: text2,
109
- userId: toInputUser(user)
114
+ userId: toInputUser(user),
115
+ style: options?.style
110
116
  };
111
117
  }
112
118
  function requestPeer(text2, buttonId, params) {
@@ -115,14 +121,16 @@ function requestPeer(text2, buttonId, params) {
115
121
  text: text2,
116
122
  buttonId,
117
123
  peerType: params.peerType,
118
- maxQuantity: params.count ?? 1
124
+ maxQuantity: params.count ?? 1,
125
+ style: params.style
119
126
  };
120
127
  }
121
128
  function copy(params) {
122
129
  return {
123
130
  _: "keyboardButtonCopy",
124
131
  text: params.text,
125
- copyText: params?.copyText ?? params.text
132
+ copyText: params?.copyText ?? params.text,
133
+ style: params.style
126
134
  };
127
135
  }
128
136
  function findButton(buttons, predicate) {
@@ -9,6 +9,7 @@ const Long = require("long");
9
9
  const peerUtils = require("../../../utils/peer-utils.cjs");
10
10
  const photo = require("../media/photo.cjs");
11
11
  const peer = require("../peers/peer.cjs");
12
+ const user = require("../peers/user.cjs");
12
13
  const starGiftUnique = require("../premium/star-gift-unique.cjs");
13
14
  const starGift = require("../premium/star-gift.cjs");
14
15
  function _messageActionFromTl(act) {
@@ -332,6 +333,7 @@ function _messageActionFromTl(act) {
332
333
  canTransferAt: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
333
334
  canResellAt: act.canResellAt ? new Date(act.canResellAt * 1e3) : void 0,
334
335
  canExportAt: act.canExportAt ? new Date(act.canExportAt * 1e3) : void 0,
336
+ canCraftAt: act.canCraftAt ? new Date(act.canCraftAt * 1e3) : void 0,
335
337
  savedId: act.savedId,
336
338
  dropDetailsStars: act.dropOriginalDetailsStars
337
339
  };
@@ -341,6 +343,12 @@ function _messageActionFromTl(act) {
341
343
  ...common
342
344
  };
343
345
  }
346
+ if (act.craft) {
347
+ return {
348
+ type: "star_gift_crafted",
349
+ ...common
350
+ };
351
+ }
344
352
  if (act.fromOffer) {
345
353
  return {
346
354
  type: "star_gift_bought_offer",
@@ -418,6 +426,16 @@ function _messageActionFromTl(act) {
418
426
  gift: new starGiftUnique.StarGiftUnique(act.gift, this._peers),
419
427
  price: act.price
420
428
  };
429
+ case "messageActionNewCreatorPending":
430
+ return {
431
+ type: "new_creator_pending",
432
+ newCreator: new user.User(this._peers.user(act.newCreatorId))
433
+ };
434
+ case "messageActionChangeCreator":
435
+ return {
436
+ type: "change_creator",
437
+ newCreator: new user.User(this._peers.user(act.newCreatorId))
438
+ };
421
439
  default:
422
440
  return null;
423
441
  }
@@ -3,6 +3,7 @@ import { TextWithEntities } from '../misc/entities.js';
3
3
  import { Peer } from '../peers/peer.js';
4
4
  import { Message } from './message.js';
5
5
  import { Photo } from '../media/photo.js';
6
+ import { User } from '../peers/user.js';
6
7
  import { StarGiftUnique } from '../premium/star-gift-unique.js';
7
8
  import { StarGift } from '../premium/star-gift.js';
8
9
  /** Group was created */
@@ -469,6 +470,8 @@ interface StarGiftUniqueCommon {
469
470
  canResellAt?: Date;
470
471
  /** If the gift can be exported to blockchain, date when it will become available */
471
472
  canExportAt?: Date;
473
+ /** If the gift can be crafted, date when it will become available */
474
+ canCraftAt?: Date;
472
475
  /** Amount of stars needed to drop the original details */
473
476
  dropDetailsStars?: tl.Long;
474
477
  /** ID of the related saved profile gift */
@@ -478,6 +481,10 @@ interface StarGiftUniqueCommon {
478
481
  export interface ActionStarGiftUpgraded extends StarGiftUniqueCommon {
479
482
  readonly type: 'star_gift_upgraded';
480
483
  }
484
+ /** A star gift was crafted */
485
+ export interface ActionStarGiftCrafted extends StarGiftUniqueCommon {
486
+ readonly type: 'star_gift_crafted';
487
+ }
481
488
  /** A star gift was bought from a resale listing */
482
489
  export interface ActionStarGiftBoughtResale extends StarGiftUniqueCommon {
483
490
  readonly type: 'star_gift_bought_resale';
@@ -566,7 +573,19 @@ export interface ActionSuggestBirthday {
566
573
  /** Birthday */
567
574
  birthday: tl.RawBirthday;
568
575
  }
569
- 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 | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | null;
576
+ /** Group creator has left the group, and a new creator has been assigned but not yet made one */
577
+ export interface ActionNewCreatorPending {
578
+ readonly type: 'new_creator_pending';
579
+ /** New creator */
580
+ newCreator: User;
581
+ }
582
+ /** Group creator has left the group, and a new creator has been assigned */
583
+ export interface ActionChangeCreator {
584
+ readonly type: 'change_creator';
585
+ /** New creator */
586
+ newCreator: User;
587
+ }
588
+ 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 | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | ActionStarGiftCrafted | ActionNewCreatorPending | ActionChangeCreator | null;
570
589
  /** @internal */
571
590
  export declare function _messageActionFromTl(this: Message, act: tl.TypeMessageAction): MessageAction;
572
591
  export {};
@@ -3,6 +3,7 @@ import { TextWithEntities } from '../misc/entities.js';
3
3
  import { Peer } from '../peers/peer.js';
4
4
  import { Message } from './message.js';
5
5
  import { Photo } from '../media/photo.js';
6
+ import { User } from '../peers/user.js';
6
7
  import { StarGiftUnique } from '../premium/star-gift-unique.js';
7
8
  import { StarGift } from '../premium/star-gift.js';
8
9
  /** Group was created */
@@ -469,6 +470,8 @@ interface StarGiftUniqueCommon {
469
470
  canResellAt?: Date;
470
471
  /** If the gift can be exported to blockchain, date when it will become available */
471
472
  canExportAt?: Date;
473
+ /** If the gift can be crafted, date when it will become available */
474
+ canCraftAt?: Date;
472
475
  /** Amount of stars needed to drop the original details */
473
476
  dropDetailsStars?: tl.Long;
474
477
  /** ID of the related saved profile gift */
@@ -478,6 +481,10 @@ interface StarGiftUniqueCommon {
478
481
  export interface ActionStarGiftUpgraded extends StarGiftUniqueCommon {
479
482
  readonly type: 'star_gift_upgraded';
480
483
  }
484
+ /** A star gift was crafted */
485
+ export interface ActionStarGiftCrafted extends StarGiftUniqueCommon {
486
+ readonly type: 'star_gift_crafted';
487
+ }
481
488
  /** A star gift was bought from a resale listing */
482
489
  export interface ActionStarGiftBoughtResale extends StarGiftUniqueCommon {
483
490
  readonly type: 'star_gift_bought_resale';
@@ -566,7 +573,19 @@ export interface ActionSuggestBirthday {
566
573
  /** Birthday */
567
574
  birthday: tl.RawBirthday;
568
575
  }
569
- 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 | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | null;
576
+ /** Group creator has left the group, and a new creator has been assigned but not yet made one */
577
+ export interface ActionNewCreatorPending {
578
+ readonly type: 'new_creator_pending';
579
+ /** New creator */
580
+ newCreator: User;
581
+ }
582
+ /** Group creator has left the group, and a new creator has been assigned */
583
+ export interface ActionChangeCreator {
584
+ readonly type: 'change_creator';
585
+ /** New creator */
586
+ newCreator: User;
587
+ }
588
+ 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 | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | ActionStarGiftCrafted | ActionNewCreatorPending | ActionChangeCreator | null;
570
589
  /** @internal */
571
590
  export declare function _messageActionFromTl(this: Message, act: tl.TypeMessageAction): MessageAction;
572
591
  export {};
@@ -2,6 +2,7 @@ import Long from "long";
2
2
  import { getMarkedPeerId } from "../../../utils/peer-utils.js";
3
3
  import { Photo as Photo$2 } from "../media/photo.js";
4
4
  import { parsePeer } from "../peers/peer.js";
5
+ import { User as User$2 } from "../peers/user.js";
5
6
  import { StarGiftUnique as StarGiftUnique$2 } from "../premium/star-gift-unique.js";
6
7
  import { StarGift as StarGift$2 } from "../premium/star-gift.js";
7
8
  function _messageActionFromTl(act) {
@@ -325,6 +326,7 @@ function _messageActionFromTl(act) {
325
326
  canTransferAt: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
326
327
  canResellAt: act.canResellAt ? new Date(act.canResellAt * 1e3) : void 0,
327
328
  canExportAt: act.canExportAt ? new Date(act.canExportAt * 1e3) : void 0,
329
+ canCraftAt: act.canCraftAt ? new Date(act.canCraftAt * 1e3) : void 0,
328
330
  savedId: act.savedId,
329
331
  dropDetailsStars: act.dropOriginalDetailsStars
330
332
  };
@@ -334,6 +336,12 @@ function _messageActionFromTl(act) {
334
336
  ...common
335
337
  };
336
338
  }
339
+ if (act.craft) {
340
+ return {
341
+ type: "star_gift_crafted",
342
+ ...common
343
+ };
344
+ }
337
345
  if (act.fromOffer) {
338
346
  return {
339
347
  type: "star_gift_bought_offer",
@@ -411,6 +419,16 @@ function _messageActionFromTl(act) {
411
419
  gift: new StarGiftUnique$2(act.gift, this._peers),
412
420
  price: act.price
413
421
  };
422
+ case "messageActionNewCreatorPending":
423
+ return {
424
+ type: "new_creator_pending",
425
+ newCreator: new User$2(this._peers.user(act.newCreatorId))
426
+ };
427
+ case "messageActionChangeCreator":
428
+ return {
429
+ type: "change_creator",
430
+ newCreator: new User$2(this._peers.user(act.newCreatorId))
431
+ };
414
432
  default:
415
433
  return null;
416
434
  }
@@ -108,7 +108,7 @@ class Chat {
108
108
  case "channelForbidden":
109
109
  if (this.raw._ === "channel" && this.raw.gigagroup) {
110
110
  return "gigagroup";
111
- } else if (this.raw._ === "channel" && this.raw.monoforum) {
111
+ } else if (this.raw.monoforum) {
112
112
  return "monoforum";
113
113
  } else if (this.raw.broadcast) {
114
114
  return "channel";
@@ -101,7 +101,7 @@ class Chat {
101
101
  case "channelForbidden":
102
102
  if (this.raw._ === "channel" && this.raw.gigagroup) {
103
103
  return "gigagroup";
104
- } else if (this.raw._ === "channel" && this.raw.monoforum) {
104
+ } else if (this.raw.monoforum) {
105
105
  return "monoforum";
106
106
  } else if (this.raw.broadcast) {
107
107
  return "channel";
@@ -111,6 +111,9 @@ class User {
111
111
  get isBotWithForumView() {
112
112
  return this.raw.botForumView;
113
113
  }
114
+ get canBotManageForumTopics() {
115
+ return this.raw.botForumCanManageTopics;
116
+ }
114
117
  /** Whether this user has been verified by Telegram */
115
118
  get isVerified() {
116
119
  return this.raw.verified;
@@ -84,6 +84,7 @@ export declare class User {
84
84
  get isBotEditable(): boolean;
85
85
  /** Whether this bot is forum-like (i.e. supports threads) */
86
86
  get isBotWithForumView(): boolean;
87
+ get canBotManageForumTopics(): boolean;
87
88
  /** Whether this user has been verified by Telegram */
88
89
  get isVerified(): boolean;
89
90
  /**
@@ -84,6 +84,7 @@ export declare class User {
84
84
  get isBotEditable(): boolean;
85
85
  /** Whether this bot is forum-like (i.e. supports threads) */
86
86
  get isBotWithForumView(): boolean;
87
+ get canBotManageForumTopics(): boolean;
87
88
  /** Whether this user has been verified by Telegram */
88
89
  get isVerified(): boolean;
89
90
  /**
@@ -104,6 +104,9 @@ class User {
104
104
  get isBotWithForumView() {
105
105
  return this.raw.botForumView;
106
106
  }
107
+ get canBotManageForumTopics() {
108
+ return this.raw.botForumCanManageTopics;
109
+ }
107
110
  /** Whether this user has been verified by Telegram */
108
111
  get isVerified() {
109
112
  return this.raw.verified;
@@ -90,6 +90,10 @@ class SavedStarGift {
90
90
  get canResellAt() {
91
91
  return this.raw.canResellAt ? new Date(this.raw.canResellAt * 1e3) : null;
92
92
  }
93
+ /** Date when the gift can be crafted */
94
+ get canCraftAt() {
95
+ return this.raw.canCraftAt ? new Date(this.raw.canCraftAt * 1e3) : null;
96
+ }
93
97
  /** IDs of the collections this gift belongs to */
94
98
  get collectionIds() {
95
99
  return this.raw.collectionId ?? [];
@@ -44,6 +44,8 @@ export declare class SavedStarGift {
44
44
  get canTransferAt(): Date | null;
45
45
  /** Date when the gift can be resold */
46
46
  get canResellAt(): Date | null;
47
+ /** Date when the gift can be crafted */
48
+ get canCraftAt(): Date | null;
47
49
  /** IDs of the collections this gift belongs to */
48
50
  get collectionIds(): number[];
49
51
  /**
@@ -44,6 +44,8 @@ export declare class SavedStarGift {
44
44
  get canTransferAt(): Date | null;
45
45
  /** Date when the gift can be resold */
46
46
  get canResellAt(): Date | null;
47
+ /** Date when the gift can be crafted */
48
+ get canCraftAt(): Date | null;
47
49
  /** IDs of the collections this gift belongs to */
48
50
  get collectionIds(): number[];
49
51
  /**
@@ -83,6 +83,10 @@ class SavedStarGift {
83
83
  get canResellAt() {
84
84
  return this.raw.canResellAt ? new Date(this.raw.canResellAt * 1e3) : null;
85
85
  }
86
+ /** Date when the gift can be crafted */
87
+ get canCraftAt() {
88
+ return this.raw.canCraftAt ? new Date(this.raw.canCraftAt * 1e3) : null;
89
+ }
86
90
  /** IDs of the collections this gift belongs to */
87
91
  get collectionIds() {
88
92
  return this.raw.collectionId ?? [];
@@ -11,18 +11,41 @@ const inspectable = require("../../utils/inspectable.cjs");
11
11
  const memoize = require("../../utils/memoize.cjs");
12
12
  const documentUtils = require("../media/document-utils.cjs");
13
13
  const peer = require("../peers/peer.cjs");
14
+ function mapRarity(rarity) {
15
+ switch (rarity._) {
16
+ case "starGiftAttributeRarityUncommon":
17
+ return "uncommon";
18
+ case "starGiftAttributeRarityRare":
19
+ return "rare";
20
+ case "starGiftAttributeRarityEpic":
21
+ return "epic";
22
+ case "starGiftAttributeRarityLegendary":
23
+ return "legendary";
24
+ default:
25
+ return null;
26
+ }
27
+ }
14
28
  class StarGiftUniqueAttribute {
15
29
  constructor(raw) {
16
30
  this.raw = raw;
17
31
  }
18
- /** Rarity permille of the attribute */
32
+ /** Whether this attribute is specific to this craft */
33
+ get crafted() {
34
+ return this.raw._ === "starGiftAttributeModel" && this.raw.crafted;
35
+ }
36
+ /** Rarity permille of the attribute, if available */
19
37
  get permille() {
20
- return this.raw.rarityPermille;
38
+ return this.raw.rarity._ === "starGiftAttributeRarity" ? this.raw.rarity.permille : null;
39
+ }
40
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
41
+ get rarity() {
42
+ return mapRarity(this.raw.rarity);
21
43
  }
22
44
  /** Display name of the attribute */
23
45
  get name() {
24
46
  return this.raw.name;
25
47
  }
48
+ /** Sticker of the attribute */
26
49
  get sticker() {
27
50
  utils.assert(this.raw.document._ === "document");
28
51
  const parsed = documentUtils.parseDocument(this.raw.document);
@@ -40,9 +63,13 @@ class StarGiftUniqueBackdrop {
40
63
  get id() {
41
64
  return this.raw.backdropId;
42
65
  }
43
- /** Rarity permille of the attribute */
66
+ /** Rarity permille of the attribute, if available */
44
67
  get permille() {
45
- return this.raw.rarityPermille;
68
+ return this.raw.rarity._ === "starGiftAttributeRarity" ? this.raw.rarity.permille : null;
69
+ }
70
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
71
+ get rarity() {
72
+ return mapRarity(this.raw.rarity);
46
73
  }
47
74
  /** Display name of the attribute */
48
75
  get name() {
@@ -135,6 +162,18 @@ class StarGiftUnique {
135
162
  get isPremiumOnly() {
136
163
  return this.raw.requirePremium;
137
164
  }
165
+ /** Whether this gift was burned to craft a new one */
166
+ get isBurned() {
167
+ return this.raw.burned;
168
+ }
169
+ /** Whether this gift was crafted */
170
+ get isCrafted() {
171
+ return this.raw.crafted;
172
+ }
173
+ /** If this gift can be used in a craft, the chance of success, in permille */
174
+ get craftChancePermille() {
175
+ return this.raw.craftChancePermille ?? null;
176
+ }
138
177
  /** Number of the NFT */
139
178
  get num() {
140
179
  return this.raw.num;
@@ -3,14 +3,20 @@ import { Sticker } from '../media/sticker.js';
3
3
  import { TextWithEntities } from '../misc/entities.js';
4
4
  import { Peer } from '../peers/peer.js';
5
5
  import { PeersIndex } from '../peers/peers-index.js';
6
+ export type StarGiftUniqueAttributeRarity = 'uncommon' | 'rare' | 'epic' | 'legendary';
6
7
  /** An attribute of a unique star gift containing a sticker */
7
8
  export declare class StarGiftUniqueAttribute {
8
9
  readonly raw: tl.RawStarGiftAttributeModel | tl.RawStarGiftAttributePattern;
9
10
  constructor(raw: tl.RawStarGiftAttributeModel | tl.RawStarGiftAttributePattern);
10
- /** Rarity permille of the attribute */
11
- get permille(): number;
11
+ /** Whether this attribute is specific to this craft */
12
+ get crafted(): boolean;
13
+ /** Rarity permille of the attribute, if available */
14
+ get permille(): number | null;
15
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
16
+ get rarity(): StarGiftUniqueAttributeRarity | null;
12
17
  /** Display name of the attribute */
13
18
  get name(): string;
19
+ /** Sticker of the attribute */
14
20
  get sticker(): Sticker;
15
21
  }
16
22
  /** Information about a unique star gift's backdrop */
@@ -19,8 +25,10 @@ export declare class StarGiftUniqueBackdrop {
19
25
  constructor(raw: tl.RawStarGiftAttributeBackdrop);
20
26
  /** ID of the backdrop */
21
27
  get id(): number;
22
- /** Rarity permille of the attribute */
23
- get permille(): number;
28
+ /** Rarity permille of the attribute, if available */
29
+ get permille(): number | null;
30
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
31
+ get rarity(): StarGiftUniqueAttributeRarity | null;
24
32
  /** Display name of the attribute */
25
33
  get name(): string;
26
34
  get centerColor(): number;
@@ -69,6 +77,12 @@ export declare class StarGiftUnique {
69
77
  constructor(raw: tl.RawStarGiftUnique, _peers: PeersIndex);
70
78
  /** Whether this gift is available only to premium users */
71
79
  get isPremiumOnly(): boolean;
80
+ /** Whether this gift was burned to craft a new one */
81
+ get isBurned(): boolean;
82
+ /** Whether this gift was crafted */
83
+ get isCrafted(): boolean;
84
+ /** If this gift can be used in a craft, the chance of success, in permille */
85
+ get craftChancePermille(): number | null;
72
86
  /** Number of the NFT */
73
87
  get num(): number;
74
88
  /** Title of the NFT */
@@ -3,14 +3,20 @@ import { Sticker } from '../media/sticker.js';
3
3
  import { TextWithEntities } from '../misc/entities.js';
4
4
  import { Peer } from '../peers/peer.js';
5
5
  import { PeersIndex } from '../peers/peers-index.js';
6
+ export type StarGiftUniqueAttributeRarity = 'uncommon' | 'rare' | 'epic' | 'legendary';
6
7
  /** An attribute of a unique star gift containing a sticker */
7
8
  export declare class StarGiftUniqueAttribute {
8
9
  readonly raw: tl.RawStarGiftAttributeModel | tl.RawStarGiftAttributePattern;
9
10
  constructor(raw: tl.RawStarGiftAttributeModel | tl.RawStarGiftAttributePattern);
10
- /** Rarity permille of the attribute */
11
- get permille(): number;
11
+ /** Whether this attribute is specific to this craft */
12
+ get crafted(): boolean;
13
+ /** Rarity permille of the attribute, if available */
14
+ get permille(): number | null;
15
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
16
+ get rarity(): StarGiftUniqueAttributeRarity | null;
12
17
  /** Display name of the attribute */
13
18
  get name(): string;
19
+ /** Sticker of the attribute */
14
20
  get sticker(): Sticker;
15
21
  }
16
22
  /** Information about a unique star gift's backdrop */
@@ -19,8 +25,10 @@ export declare class StarGiftUniqueBackdrop {
19
25
  constructor(raw: tl.RawStarGiftAttributeBackdrop);
20
26
  /** ID of the backdrop */
21
27
  get id(): number;
22
- /** Rarity permille of the attribute */
23
- get permille(): number;
28
+ /** Rarity permille of the attribute, if available */
29
+ get permille(): number | null;
30
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
31
+ get rarity(): StarGiftUniqueAttributeRarity | null;
24
32
  /** Display name of the attribute */
25
33
  get name(): string;
26
34
  get centerColor(): number;
@@ -69,6 +77,12 @@ export declare class StarGiftUnique {
69
77
  constructor(raw: tl.RawStarGiftUnique, _peers: PeersIndex);
70
78
  /** Whether this gift is available only to premium users */
71
79
  get isPremiumOnly(): boolean;
80
+ /** Whether this gift was burned to craft a new one */
81
+ get isBurned(): boolean;
82
+ /** Whether this gift was crafted */
83
+ get isCrafted(): boolean;
84
+ /** If this gift can be used in a craft, the chance of success, in permille */
85
+ get craftChancePermille(): number | null;
72
86
  /** Number of the NFT */
73
87
  get num(): number;
74
88
  /** Title of the NFT */
@@ -4,18 +4,41 @@ import { makeInspectable } from "../../utils/inspectable.js";
4
4
  import { memoizeGetters } from "../../utils/memoize.js";
5
5
  import { parseDocument } from "../media/document-utils.js";
6
6
  import { parsePeer } from "../peers/peer.js";
7
+ function mapRarity(rarity) {
8
+ switch (rarity._) {
9
+ case "starGiftAttributeRarityUncommon":
10
+ return "uncommon";
11
+ case "starGiftAttributeRarityRare":
12
+ return "rare";
13
+ case "starGiftAttributeRarityEpic":
14
+ return "epic";
15
+ case "starGiftAttributeRarityLegendary":
16
+ return "legendary";
17
+ default:
18
+ return null;
19
+ }
20
+ }
7
21
  class StarGiftUniqueAttribute {
8
22
  constructor(raw) {
9
23
  this.raw = raw;
10
24
  }
11
- /** Rarity permille of the attribute */
25
+ /** Whether this attribute is specific to this craft */
26
+ get crafted() {
27
+ return this.raw._ === "starGiftAttributeModel" && this.raw.crafted;
28
+ }
29
+ /** Rarity permille of the attribute, if available */
12
30
  get permille() {
13
- return this.raw.rarityPermille;
31
+ return this.raw.rarity._ === "starGiftAttributeRarity" ? this.raw.rarity.permille : null;
32
+ }
33
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
34
+ get rarity() {
35
+ return mapRarity(this.raw.rarity);
14
36
  }
15
37
  /** Display name of the attribute */
16
38
  get name() {
17
39
  return this.raw.name;
18
40
  }
41
+ /** Sticker of the attribute */
19
42
  get sticker() {
20
43
  assert(this.raw.document._ === "document");
21
44
  const parsed = parseDocument(this.raw.document);
@@ -33,9 +56,13 @@ class StarGiftUniqueBackdrop {
33
56
  get id() {
34
57
  return this.raw.backdropId;
35
58
  }
36
- /** Rarity permille of the attribute */
59
+ /** Rarity permille of the attribute, if available */
37
60
  get permille() {
38
- return this.raw.rarityPermille;
61
+ return this.raw.rarity._ === "starGiftAttributeRarity" ? this.raw.rarity.permille : null;
62
+ }
63
+ /** Rarity type of the attribute, if available. Mutually exclusive with {@link permille} */
64
+ get rarity() {
65
+ return mapRarity(this.raw.rarity);
39
66
  }
40
67
  /** Display name of the attribute */
41
68
  get name() {
@@ -128,6 +155,18 @@ class StarGiftUnique {
128
155
  get isPremiumOnly() {
129
156
  return this.raw.requirePremium;
130
157
  }
158
+ /** Whether this gift was burned to craft a new one */
159
+ get isBurned() {
160
+ return this.raw.burned;
161
+ }
162
+ /** Whether this gift was crafted */
163
+ get isCrafted() {
164
+ return this.raw.crafted;
165
+ }
166
+ /** If this gift can be used in a craft, the chance of success, in permille */
167
+ get craftChancePermille() {
168
+ return this.raw.craftChancePermille ?? null;
169
+ }
131
170
  /** Number of the NFT */
132
171
  get num() {
133
172
  return this.raw.num;