@mtcute/core 0.23.2 → 0.24.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 (131) hide show
  1. package/client.cjs +21 -2
  2. package/client.js +21 -2
  3. package/highlevel/base.cjs +15 -3
  4. package/highlevel/base.d.cts +4 -1
  5. package/highlevel/base.d.ts +4 -1
  6. package/highlevel/base.js +15 -3
  7. package/highlevel/client.d.cts +56 -7
  8. package/highlevel/client.d.ts +56 -7
  9. package/highlevel/client.types.d.cts +2 -1
  10. package/highlevel/client.types.d.ts +2 -1
  11. package/highlevel/methods/chats/get-chat-event-log.cjs +5 -3
  12. package/highlevel/methods/chats/get-chat-event-log.js +3 -1
  13. package/highlevel/methods/files/download-iterable.cjs +1 -1
  14. package/highlevel/methods/files/download-iterable.js +1 -1
  15. package/highlevel/methods/premium/_normalize-input-star-gift.cjs +6 -0
  16. package/highlevel/methods/premium/_normalize-input-star-gift.js +6 -0
  17. package/highlevel/methods/premium/buy-resale-gift.cjs +30 -0
  18. package/highlevel/methods/premium/buy-resale-gift.d.cts +13 -0
  19. package/highlevel/methods/premium/buy-resale-gift.d.ts +13 -0
  20. package/highlevel/methods/premium/buy-resale-gift.js +25 -0
  21. package/highlevel/methods/premium/get-resale-star-gifts.cjs +107 -0
  22. package/highlevel/methods/premium/get-resale-star-gifts.d.cts +45 -0
  23. package/highlevel/methods/premium/get-resale-star-gifts.d.ts +45 -0
  24. package/highlevel/methods/premium/get-resale-star-gifts.js +102 -0
  25. package/highlevel/methods/premium/get-unique-star-gift.cjs +1 -1
  26. package/highlevel/methods/premium/get-unique-star-gift.js +1 -1
  27. package/highlevel/methods/premium/set-gift-resale-price.cjs +19 -0
  28. package/highlevel/methods/premium/set-gift-resale-price.d.cts +9 -0
  29. package/highlevel/methods/premium/set-gift-resale-price.d.ts +9 -0
  30. package/highlevel/methods/premium/set-gift-resale-price.js +14 -0
  31. package/highlevel/methods/premium/transfer-star-gift.cjs +28 -13
  32. package/highlevel/methods/premium/transfer-star-gift.d.cts +1 -1
  33. package/highlevel/methods/premium/transfer-star-gift.d.ts +1 -1
  34. package/highlevel/methods/premium/transfer-star-gift.js +28 -13
  35. package/highlevel/methods/premium/upgrade-star-gift.cjs +26 -11
  36. package/highlevel/methods/premium/upgrade-star-gift.js +26 -11
  37. package/highlevel/methods/users/resolve-peer.cjs +63 -70
  38. package/highlevel/methods/users/resolve-peer.d.cts +2 -1
  39. package/highlevel/methods/users/resolve-peer.d.ts +2 -1
  40. package/highlevel/methods/users/resolve-peer.js +61 -68
  41. package/highlevel/methods/users/resolve-phone-number.cjs +36 -0
  42. package/highlevel/methods/users/resolve-phone-number.d.cts +10 -0
  43. package/highlevel/methods/users/resolve-phone-number.d.ts +10 -0
  44. package/highlevel/methods/users/resolve-phone-number.js +31 -0
  45. package/highlevel/methods.d.cts +10 -4
  46. package/highlevel/methods.d.ts +10 -4
  47. package/highlevel/types/messages/message-action.cjs +8 -2
  48. package/highlevel/types/messages/message-action.d.cts +6 -0
  49. package/highlevel/types/messages/message-action.d.ts +6 -0
  50. package/highlevel/types/messages/message-action.js +8 -2
  51. package/highlevel/types/peers/chat-event/actions.cjs +49 -1
  52. package/highlevel/types/peers/chat-event/actions.d.cts +60 -2
  53. package/highlevel/types/peers/chat-event/actions.d.ts +60 -2
  54. package/highlevel/types/peers/chat-event/actions.js +49 -1
  55. package/highlevel/types/peers/chat-event/filters.cjs +9 -0
  56. package/highlevel/types/peers/chat-event/filters.js +9 -0
  57. package/highlevel/types/peers/chat-event/index.cjs +3 -2
  58. package/highlevel/types/peers/chat-event/index.d.cts +2 -1
  59. package/highlevel/types/peers/chat-event/index.d.ts +2 -1
  60. package/highlevel/types/peers/chat-event/index.js +3 -2
  61. package/highlevel/types/peers/chat.cjs +5 -4
  62. package/highlevel/types/peers/chat.d.cts +2 -0
  63. package/highlevel/types/peers/chat.d.ts +2 -0
  64. package/highlevel/types/peers/chat.js +5 -4
  65. package/highlevel/types/peers/peer.d.cts +2 -3
  66. package/highlevel/types/peers/peer.d.ts +2 -3
  67. package/highlevel/types/peers/user.cjs +1 -4
  68. package/highlevel/types/peers/user.js +1 -4
  69. package/highlevel/types/premium/saved-star-gift.cjs +8 -0
  70. package/highlevel/types/premium/saved-star-gift.d.cts +4 -0
  71. package/highlevel/types/premium/saved-star-gift.d.ts +4 -0
  72. package/highlevel/types/premium/saved-star-gift.js +8 -0
  73. package/highlevel/types/premium/stars-gift-unique.cjs +13 -2
  74. package/highlevel/types/premium/stars-gift-unique.d.cts +6 -2
  75. package/highlevel/types/premium/stars-gift-unique.d.ts +6 -2
  76. package/highlevel/types/premium/stars-gift-unique.js +13 -2
  77. package/highlevel/types/premium/stars-gift.cjs +11 -1
  78. package/highlevel/types/premium/stars-gift.d.cts +8 -1
  79. package/highlevel/types/premium/stars-gift.d.ts +8 -1
  80. package/highlevel/types/premium/stars-gift.js +11 -1
  81. package/highlevel/types/premium/stars-transaction.cjs +7 -1
  82. package/highlevel/types/premium/stars-transaction.d.cts +9 -2
  83. package/highlevel/types/premium/stars-transaction.d.ts +9 -2
  84. package/highlevel/types/premium/stars-transaction.js +7 -1
  85. package/highlevel/types/reactions/emoji-status.cjs +6 -0
  86. package/highlevel/types/reactions/emoji-status.d.cts +1 -0
  87. package/highlevel/types/reactions/emoji-status.d.ts +1 -0
  88. package/highlevel/types/reactions/emoji-status.js +6 -0
  89. package/highlevel/types/utils.d.cts +4 -0
  90. package/highlevel/types/utils.d.ts +4 -0
  91. package/highlevel/updates/manager.cjs +35 -26
  92. package/highlevel/updates/manager.d.cts +6 -6
  93. package/highlevel/updates/manager.d.ts +6 -6
  94. package/highlevel/updates/manager.js +35 -26
  95. package/highlevel/updates/types.d.cts +6 -6
  96. package/highlevel/updates/types.d.ts +6 -6
  97. package/highlevel/utils/misc-utils.cjs +8 -0
  98. package/highlevel/utils/misc-utils.d.cts +2 -1
  99. package/highlevel/utils/misc-utils.d.ts +2 -1
  100. package/highlevel/utils/misc-utils.js +8 -0
  101. package/highlevel/worker/port.cjs +7 -5
  102. package/highlevel/worker/port.d.cts +3 -2
  103. package/highlevel/worker/port.d.ts +3 -2
  104. package/highlevel/worker/port.js +7 -5
  105. package/methods.cjs +8 -0
  106. package/methods.js +8 -0
  107. package/network/client.cjs +12 -8
  108. package/network/client.d.cts +4 -1
  109. package/network/client.d.ts +4 -1
  110. package/network/client.js +12 -8
  111. package/network/network-manager.cjs +1 -1
  112. package/network/network-manager.js +1 -1
  113. package/network/session-connection.cjs +1 -0
  114. package/network/session-connection.js +1 -0
  115. package/package.json +2 -2
  116. package/utils/binary/compat.cjs +9 -0
  117. package/utils/binary/compat.js +9 -0
  118. package/utils/index.d.cts +0 -1
  119. package/utils/index.d.ts +0 -1
  120. package/utils/sorted-array.cjs +6 -0
  121. package/utils/sorted-array.d.cts +2 -0
  122. package/utils/sorted-array.d.ts +2 -0
  123. package/utils/sorted-array.js +6 -0
  124. package/utils.cjs +1 -2
  125. package/utils.js +2 -3
  126. package/utils/linked-list.cjs +0 -65
  127. package/utils/linked-list.d.cts +0 -21
  128. package/utils/linked-list.d.ts +0 -21
  129. package/utils/linked-list.js +0 -60
  130. package/utils/linked-list.test.d.cts +0 -1
  131. package/utils/linked-list.test.d.ts +0 -1
@@ -131,14 +131,14 @@ export { iterInviteLinks } from './methods/invite-links/iter-invite-links.js';
131
131
  export { revokeInviteLink } from './methods/invite-links/revoke-invite-link.js';
132
132
  export { closePoll } from './methods/messages/close-poll.js';
133
133
  export { deleteMessagesById } from './methods/messages/delete-messages.js';
134
- export type { DeleteMessagesParams } from './methods/messages/delete-messages.js';
135
134
  export { deleteMessages } from './methods/messages/delete-messages.js';
135
+ export type { DeleteMessagesParams } from './methods/messages/delete-messages.js';
136
136
  export { deleteScheduledMessages } from './methods/messages/delete-scheduled-messages.js';
137
137
  export { editInlineMessage } from './methods/messages/edit-inline-message.js';
138
138
  export { editMessage } from './methods/messages/edit-message.js';
139
139
  export { forwardMessagesById } from './methods/messages/forward-messages.js';
140
- export type { ForwardMessageOptions } from './methods/messages/forward-messages.js';
141
140
  export { forwardMessages } from './methods/messages/forward-messages.js';
141
+ export type { ForwardMessageOptions } from './methods/messages/forward-messages.js';
142
142
  export { getAllScheduledMessages } from './methods/messages/get-all-scheduled-messages.js';
143
143
  export { getAvailableMessageEffects } from './methods/messages/get-available-effects.js';
144
144
  export { getCallbackQueryMessage } from './methods/messages/get-callback-query-message.js';
@@ -167,8 +167,8 @@ export { readReactions } from './methods/messages/read-reactions.js';
167
167
  export { searchGlobal } from './methods/messages/search-global.js';
168
168
  export type { SearchGlobalOffset } from './methods/messages/search-global.js';
169
169
  export { searchHashtag } from './methods/messages/search-hashtag.js';
170
- export type { SearchHashtagOffset } from './methods/messages/search-hashtag.js';
171
170
  export { iterSearchHashtag } from './methods/messages/search-hashtag.js';
171
+ export type { SearchHashtagOffset } from './methods/messages/search-hashtag.js';
172
172
  export { searchMessages } from './methods/messages/search-messages.js';
173
173
  export type { SearchMessagesOffset } from './methods/messages/search-messages.js';
174
174
  export { answerText } from './methods/messages/send-answer.js';
@@ -177,6 +177,7 @@ export { answerMediaGroup } from './methods/messages/send-answer.js';
177
177
  export { commentText } from './methods/messages/send-comment.js';
178
178
  export { commentMedia } from './methods/messages/send-comment.js';
179
179
  export { commentMediaGroup } from './methods/messages/send-comment.js';
180
+ export type { CommonSendParams } from './methods/messages/send-common.js';
180
181
  export { sendCopyGroup } from './methods/messages/send-copy-group.js';
181
182
  export type { SendCopyGroupParams } from './methods/messages/send-copy-group.js';
182
183
  export { sendCopy } from './methods/messages/send-copy.js';
@@ -185,9 +186,9 @@ export { sendMediaGroup } from './methods/messages/send-media-group.js';
185
186
  export { sendMedia } from './methods/messages/send-media.js';
186
187
  export { sendPaidReaction } from './methods/messages/send-paid-reaction.js';
187
188
  export { quoteWithText } from './methods/messages/send-quote.js';
188
- export type { QuoteParamsFrom } from './methods/messages/send-quote.js';
189
189
  export { quoteWithMedia } from './methods/messages/send-quote.js';
190
190
  export { quoteWithMediaGroup } from './methods/messages/send-quote.js';
191
+ export type { QuoteParamsFrom } from './methods/messages/send-quote.js';
191
192
  export { sendReaction } from './methods/messages/send-reaction.js';
192
193
  export { replyText } from './methods/messages/send-reply.js';
193
194
  export { replyMedia } from './methods/messages/send-reply.js';
@@ -213,6 +214,7 @@ export { removeCloudPassword } from './methods/password/remove-cloud-password.js
213
214
  export { _normalizeInputStarGift } from './methods/premium/_normalize-input-star-gift.js';
214
215
  export { acceptStarGift } from './methods/premium/accept-star-gift.js';
215
216
  export { applyBoost } from './methods/premium/apply-boost.js';
217
+ export { buyResaleGift } from './methods/premium/buy-resale-gift.js';
216
218
  export { canApplyBoost } from './methods/premium/can-apply-boost.js';
217
219
  export type { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
218
220
  export { createBusinessChatLink } from './methods/premium/create-business-chat-link.js';
@@ -223,6 +225,8 @@ export { getBoosts } from './methods/premium/get-boosts.js';
223
225
  export { getBusinessChatLinks } from './methods/premium/get-business-chat-links.js';
224
226
  export { getBusinessConnection } from './methods/premium/get-business-connection.js';
225
227
  export { getMyBoostSlots } from './methods/premium/get-my-boost-slots.js';
228
+ export { getResaleOptions } from './methods/premium/get-resale-star-gifts.js';
229
+ export type { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/premium/get-resale-star-gifts.js';
226
230
  export { getSavedStarGiftsById } from './methods/premium/get-saved-star-gifts-by-id.js';
227
231
  export { getSavedStarGifts } from './methods/premium/get-saved-star-gifts.js';
228
232
  export { getStarGiftOptions } from './methods/premium/get-star-gift-options.js';
@@ -236,6 +240,7 @@ export { togglePinnedStarGifts } from './methods/premium/pin-star-gift.js';
236
240
  export { sendStarGift } from './methods/premium/send-star-gift.js';
237
241
  export { setBusinessIntro } from './methods/premium/set-business-intro.js';
238
242
  export { setBusinessWorkHours } from './methods/premium/set-business-work-hours.js';
243
+ export { setResaleStarGiftPrice } from './methods/premium/set-gift-resale-price.js';
239
244
  export { transferStarGift } from './methods/premium/transfer-star-gift.js';
240
245
  export { upgradeStarGift } from './methods/premium/upgrade-star-gift.js';
241
246
  export { addStickerToSet } from './methods/stickers/add-sticker-to-set.js';
@@ -289,6 +294,7 @@ export { resolvePeerMany } from './methods/users/resolve-peer-many.js';
289
294
  export { resolvePeer } from './methods/users/resolve-peer.js';
290
295
  export { resolveUser } from './methods/users/resolve-peer.js';
291
296
  export { resolveChannel } from './methods/users/resolve-peer.js';
297
+ export { resolvePhoneNumber } from './methods/users/resolve-phone-number.js';
292
298
  export { setMyEmojiStatus } from './methods/users/set-emoji-status.js';
293
299
  export { setEmojiStatus } from './methods/users/set-emoji-status.js';
294
300
  export { setGlobalTtl } from './methods/users/set-global-ttl.js';
@@ -5,6 +5,7 @@ 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 utils = require("@fuman/utils");
8
9
  const Long = require("long");
9
10
  const peerUtils = require("../../../utils/peer-utils.cjs");
10
11
  const photo = require("../media/photo.cjs");
@@ -286,6 +287,7 @@ function _messageActionFromTl(act) {
286
287
  giveawayMessageId: act.giveawayMsgId
287
288
  };
288
289
  case "messageActionStarGift":
290
+ utils.assert(act.gift._ === "starGift");
289
291
  return {
290
292
  type: "stars_gift",
291
293
  nameHidden: act.nameHidden,
@@ -293,7 +295,7 @@ function _messageActionFromTl(act) {
293
295
  converted: act.converted,
294
296
  convertStars: act.convertStars ?? Long.ZERO,
295
297
  refunded: act.refunded,
296
- gift: act.gift._ === "starGift" ? new starsGift.StarGift(act.gift) : new starsGiftUnique.StarGiftUnique(act.gift, this._peers),
298
+ gift: new starsGift.StarGift(act.gift),
297
299
  message: act.message ?? null,
298
300
  canUpgrade: act.canUpgrade,
299
301
  upgraded: act.upgraded,
@@ -304,6 +306,7 @@ function _messageActionFromTl(act) {
304
306
  savedId: act.savedId
305
307
  };
306
308
  case "messageActionStarGiftUnique":
309
+ utils.assert(act.gift._ === "starGiftUnique");
307
310
  return {
308
311
  type: "stars_gift",
309
312
  nameHidden: false,
@@ -311,12 +314,15 @@ function _messageActionFromTl(act) {
311
314
  converted: false,
312
315
  convertStars: Long.ZERO,
313
316
  refunded: act.refunded,
314
- gift: act.gift._ === "starGift" ? new starsGift.StarGift(act.gift) : new starsGiftUnique.StarGiftUnique(act.gift, this._peers),
317
+ gift: new starsGiftUnique.StarGiftUnique(act.gift, this._peers),
315
318
  message: null,
316
319
  canUpgrade: false,
317
320
  upgraded: true,
318
321
  upgradeStars: Long.ZERO,
319
322
  upgradeMsgId: null,
323
+ canTransferSince: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
324
+ resaleStars: act.resaleStars,
325
+ canResellAt: act.canResellAt ? new Date(act.canResellAt * 1e3) : void 0,
320
326
  fromId: act.fromId ? peerUtils.getMarkedPeerId(act.fromId) : void 0,
321
327
  toId: act.peer ? peerUtils.getMarkedPeerId(act.peer) : void 0,
322
328
  savedId: act.savedId
@@ -422,6 +422,12 @@ export interface ActionStarGift {
422
422
  upgradeStars: tl.Long;
423
423
  /** If the gift was upgraded, ID of the message where this happened */
424
424
  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
+ /** If the gift can be re-sold, date when it will become available */
430
+ canResellAt?: Date;
425
431
  /** The gift itself */
426
432
  gift: StarGift | StarGiftUnique;
427
433
  /** Message attached to the gift */
@@ -422,6 +422,12 @@ export interface ActionStarGift {
422
422
  upgradeStars: tl.Long;
423
423
  /** If the gift was upgraded, ID of the message where this happened */
424
424
  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
+ /** If the gift can be re-sold, date when it will become available */
430
+ canResellAt?: Date;
425
431
  /** The gift itself */
426
432
  gift: StarGift | StarGiftUnique;
427
433
  /** Message attached to the gift */
@@ -1,3 +1,4 @@
1
+ import { assert } from "@fuman/utils";
1
2
  import Long from "long";
2
3
  import { getMarkedPeerId } from "../../../utils/peer-utils.js";
3
4
  import { Photo as Photo$2 } from "../media/photo.js";
@@ -279,6 +280,7 @@ function _messageActionFromTl(act) {
279
280
  giveawayMessageId: act.giveawayMsgId
280
281
  };
281
282
  case "messageActionStarGift":
283
+ assert(act.gift._ === "starGift");
282
284
  return {
283
285
  type: "stars_gift",
284
286
  nameHidden: act.nameHidden,
@@ -286,7 +288,7 @@ function _messageActionFromTl(act) {
286
288
  converted: act.converted,
287
289
  convertStars: act.convertStars ?? Long.ZERO,
288
290
  refunded: act.refunded,
289
- gift: act.gift._ === "starGift" ? new StarGift$2(act.gift) : new StarGiftUnique$2(act.gift, this._peers),
291
+ gift: new StarGift$2(act.gift),
290
292
  message: act.message ?? null,
291
293
  canUpgrade: act.canUpgrade,
292
294
  upgraded: act.upgraded,
@@ -297,6 +299,7 @@ function _messageActionFromTl(act) {
297
299
  savedId: act.savedId
298
300
  };
299
301
  case "messageActionStarGiftUnique":
302
+ assert(act.gift._ === "starGiftUnique");
300
303
  return {
301
304
  type: "stars_gift",
302
305
  nameHidden: false,
@@ -304,12 +307,15 @@ function _messageActionFromTl(act) {
304
307
  converted: false,
305
308
  convertStars: Long.ZERO,
306
309
  refunded: act.refunded,
307
- gift: act.gift._ === "starGift" ? new StarGift$2(act.gift) : new StarGiftUnique$2(act.gift, this._peers),
310
+ gift: new StarGiftUnique$2(act.gift, this._peers),
308
311
  message: null,
309
312
  canUpgrade: false,
310
313
  upgraded: true,
311
314
  upgradeStars: Long.ZERO,
312
315
  upgradeMsgId: null,
316
+ canTransferSince: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
317
+ resaleStars: act.resaleStars,
318
+ canResellAt: act.canResellAt ? new Date(act.canResellAt * 1e3) : void 0,
313
319
  fromId: act.fromId ? getMarkedPeerId(act.fromId) : void 0,
314
320
  toId: act.peer ? getMarkedPeerId(act.peer) : void 0,
315
321
  savedId: act.savedId
@@ -9,13 +9,15 @@ const peerUtils = require("../../../../utils/peer-utils.cjs");
9
9
  const typeAssertions = require("../../../../utils/type-assertions.cjs");
10
10
  const photo = require("../../media/photo.cjs");
11
11
  const message = require("../../messages/message.cjs");
12
+ const emojiStatus = require("../../reactions/emoji-status.cjs");
13
+ const chatColors = require("../chat-colors.cjs");
12
14
  const chatInviteLink = require("../chat-invite-link.cjs");
13
15
  const chatLocation = require("../chat-location.cjs");
14
16
  const chatMember = require("../chat-member.cjs");
15
17
  const chatPermissions = require("../chat-permissions.cjs");
16
18
  const forumTopic = require("../forum-topic.cjs");
17
19
  const user = require("../user.cjs");
18
- function _actionFromTl(e, peers) {
20
+ function _actionFromTl(e, peers, peerId) {
19
21
  switch (e._) {
20
22
  case "channelAdminLogEventActionParticipantJoin":
21
23
  return { type: "user_joined" };
@@ -235,6 +237,52 @@ function _actionFromTl(e, peers) {
235
237
  prev: new chatMember.ChatMember(e.prevParticipant, peers),
236
238
  new: new chatMember.ChatMember(e.newParticipant, peers)
237
239
  };
240
+ case "channelAdminLogEventActionChangeAvailableReactions":
241
+ return {
242
+ type: "available_reactions_changed",
243
+ prev: e.prevValue,
244
+ new: e.newValue
245
+ };
246
+ case "channelAdminLogEventActionChangeEmojiStatus":
247
+ return {
248
+ type: "emoji_status_changed",
249
+ prev: emojiStatus.EmojiStatus.fromTl(e.prevValue),
250
+ new: emojiStatus.EmojiStatus.fromTl(e.newValue)
251
+ };
252
+ case "channelAdminLogEventActionChangeEmojiStickerSet":
253
+ return {
254
+ type: "emoji_stickerset_changed",
255
+ old: e.prevStickerset,
256
+ new: e.newStickerset
257
+ };
258
+ case "channelAdminLogEventActionChangePeerColor":
259
+ case "channelAdminLogEventActionChangeProfilePeerColor":
260
+ return {
261
+ type: e._ === "channelAdminLogEventActionChangePeerColor" ? "peer_color_changed" : "profile_peer_color_changed",
262
+ prev: new chatColors.ChatColors(peerId, e.prevValue),
263
+ new: new chatColors.ChatColors(peerId, e.newValue)
264
+ };
265
+ case "channelAdminLogEventActionChangeWallpaper":
266
+ return {
267
+ type: "wallpaper_changed",
268
+ old: e.prevValue,
269
+ new: e.newValue
270
+ };
271
+ case "channelAdminLogEventActionSendMessage":
272
+ return {
273
+ type: "msg_sent",
274
+ message: new message.Message(e.message, peers)
275
+ };
276
+ case "channelAdminLogEventActionToggleAntiSpam":
277
+ return {
278
+ type: "toggle_anti_spam",
279
+ enabled: e.newValue
280
+ };
281
+ case "channelAdminLogEventActionToggleAutotranslation":
282
+ return {
283
+ type: "toggle_autotranslation",
284
+ enabled: e.newValue
285
+ };
238
286
  default:
239
287
  return null;
240
288
  }
@@ -2,6 +2,8 @@ import { tl } from '@mtcute/tl';
2
2
  import { PeersIndex } from '../peers-index.js';
3
3
  import { Photo } from '../../media/photo.js';
4
4
  import { Message } from '../../messages/message.js';
5
+ import { EmojiStatus } from '../../reactions/emoji-status.js';
6
+ import { ChatColors } from '../chat-colors.js';
5
7
  import { ChatInviteLink } from '../chat-invite-link.js';
6
8
  import { ChatLocation } from '../chat-location.js';
7
9
  import { ChatMember } from '../chat-member.js';
@@ -273,7 +275,63 @@ export interface ChatActionSubscriptionExtended {
273
275
  /** New participant information */
274
276
  new: ChatMember;
275
277
  }
278
+ export interface ChatActionAvailableReactionsChanged {
279
+ type: 'available_reactions_changed';
280
+ /** Previous available reactions */
281
+ prev: tl.TypeChatReactions;
282
+ /** New available reactions */
283
+ new: tl.TypeChatReactions;
284
+ }
285
+ export interface ChatActionEmojiStatusChanged {
286
+ type: 'emoji_status_changed';
287
+ /** Previous emoji status */
288
+ prev: EmojiStatus | null;
289
+ /** New emoji status */
290
+ new: EmojiStatus | null;
291
+ }
292
+ /** Group emoji stickerset has been changed */
293
+ export interface ChatActionEmojiStickersetChanged {
294
+ type: 'emoji_stickerset_changed';
295
+ /** Old emoji stickerset */
296
+ old: tl.TypeInputStickerSet;
297
+ /** New emoji stickerset */
298
+ new: tl.TypeInputStickerSet;
299
+ }
300
+ /** Group peer color has been changed */
301
+ export interface ChatActionPeerColorChanged {
302
+ type: 'peer_color_changed' | 'profile_peer_color_changed';
303
+ /** Previous colors */
304
+ prev: ChatColors;
305
+ /** New colors */
306
+ new: ChatColors;
307
+ }
308
+ /** Group wallpaper has been changed */
309
+ export interface ChatActionWallpaperChanged {
310
+ type: 'wallpaper_changed';
311
+ /** Old wallpaper */
312
+ old: tl.TypeWallPaper;
313
+ /** New wallpaper */
314
+ new: tl.TypeWallPaper;
315
+ }
316
+ /** A message has been sent */
317
+ export interface ChatActionMessageSent {
318
+ type: 'msg_sent';
319
+ /** Message that was sent */
320
+ message: Message;
321
+ }
322
+ /** Aggressive anti-spam has been toggled */
323
+ export interface ChatActionToggleAntiSpam {
324
+ type: 'toggle_anti_spam';
325
+ /** Whether the chat now has aggressive anti-spam enabled */
326
+ enabled: boolean;
327
+ }
328
+ /** Auto-translation has been toggled */
329
+ export interface ChatActionToggleAutotranslation {
330
+ type: 'toggle_autotranslation';
331
+ /** Whether the chat is now in autotranslation mode */
332
+ enabled: boolean;
333
+ }
276
334
  /** Chat event action (`null` if unsupported) */
277
- export type ChatAction = ChatActionUserJoined | ChatActionUserLeft | ChatActionUserInvited | ChatActionTitleChanged | ChatActionDescriptionChanged | ChatActionUsernameChanged | ChatActionUsernamesChanged | ChatActionPhotoChanged | ChatActionInvitesToggled | ChatActionSignaturesToggled | ChatActionMessagePinned | ChatActionMessageEdited | ChatActionMessageDeleted | ChatActionUserPermissionsChanged | ChatActionUserAdminPermissionsChanged | ChatActionStickersetChanged | ChatActionHistoryToggled | ChatActionDefaultPermissionsChanged | ChatActionPollStopped | ChatActionLinkedChatChanged | ChatActionLocationChanged | ChatActionSlowModeChanged | ChatActionCallStarted | ChatActionCallEnded | ChatActionCallSettingChanged | ChatActionUserJoinedInvite | ChatActionInviteLinkDeleted | ChatActionInviteLinkEdited | ChatActionInviteLinkRevoked | ChatActionUserJoinedApproved | ChatActionTtlChanged | ChatActionNoForwardsToggled | ChatActionForumToggled | ChatActionTopicCreated | ChatActionTopicEdited | ChatActionTopicDeleted | ChatActionSignatureProfilesToggled | ChatActionSubscriptionExtended | null;
335
+ export type ChatAction = ChatActionUserJoined | ChatActionUserLeft | ChatActionUserInvited | ChatActionTitleChanged | ChatActionDescriptionChanged | ChatActionUsernameChanged | ChatActionUsernamesChanged | ChatActionPhotoChanged | ChatActionInvitesToggled | ChatActionSignaturesToggled | ChatActionMessagePinned | ChatActionMessageEdited | ChatActionMessageDeleted | ChatActionUserPermissionsChanged | ChatActionUserAdminPermissionsChanged | ChatActionStickersetChanged | ChatActionHistoryToggled | ChatActionDefaultPermissionsChanged | ChatActionPollStopped | ChatActionLinkedChatChanged | ChatActionLocationChanged | ChatActionSlowModeChanged | ChatActionCallStarted | ChatActionCallEnded | ChatActionCallSettingChanged | ChatActionUserJoinedInvite | ChatActionInviteLinkDeleted | ChatActionInviteLinkEdited | ChatActionInviteLinkRevoked | ChatActionUserJoinedApproved | ChatActionTtlChanged | ChatActionNoForwardsToggled | ChatActionForumToggled | ChatActionTopicCreated | ChatActionTopicEdited | ChatActionTopicDeleted | ChatActionSignatureProfilesToggled | ChatActionSubscriptionExtended | ChatActionAvailableReactionsChanged | ChatActionEmojiStatusChanged | ChatActionEmojiStickersetChanged | ChatActionPeerColorChanged | ChatActionWallpaperChanged | ChatActionMessageSent | ChatActionToggleAntiSpam | ChatActionToggleAutotranslation | null;
278
336
  /** @internal */
279
- export declare function _actionFromTl(e: tl.TypeChannelAdminLogEventAction, peers: PeersIndex): ChatAction;
337
+ export declare function _actionFromTl(e: tl.TypeChannelAdminLogEventAction, peers: PeersIndex, peerId: number): ChatAction;
@@ -2,6 +2,8 @@ import { tl } from '@mtcute/tl';
2
2
  import { PeersIndex } from '../peers-index.js';
3
3
  import { Photo } from '../../media/photo.js';
4
4
  import { Message } from '../../messages/message.js';
5
+ import { EmojiStatus } from '../../reactions/emoji-status.js';
6
+ import { ChatColors } from '../chat-colors.js';
5
7
  import { ChatInviteLink } from '../chat-invite-link.js';
6
8
  import { ChatLocation } from '../chat-location.js';
7
9
  import { ChatMember } from '../chat-member.js';
@@ -273,7 +275,63 @@ export interface ChatActionSubscriptionExtended {
273
275
  /** New participant information */
274
276
  new: ChatMember;
275
277
  }
278
+ export interface ChatActionAvailableReactionsChanged {
279
+ type: 'available_reactions_changed';
280
+ /** Previous available reactions */
281
+ prev: tl.TypeChatReactions;
282
+ /** New available reactions */
283
+ new: tl.TypeChatReactions;
284
+ }
285
+ export interface ChatActionEmojiStatusChanged {
286
+ type: 'emoji_status_changed';
287
+ /** Previous emoji status */
288
+ prev: EmojiStatus | null;
289
+ /** New emoji status */
290
+ new: EmojiStatus | null;
291
+ }
292
+ /** Group emoji stickerset has been changed */
293
+ export interface ChatActionEmojiStickersetChanged {
294
+ type: 'emoji_stickerset_changed';
295
+ /** Old emoji stickerset */
296
+ old: tl.TypeInputStickerSet;
297
+ /** New emoji stickerset */
298
+ new: tl.TypeInputStickerSet;
299
+ }
300
+ /** Group peer color has been changed */
301
+ export interface ChatActionPeerColorChanged {
302
+ type: 'peer_color_changed' | 'profile_peer_color_changed';
303
+ /** Previous colors */
304
+ prev: ChatColors;
305
+ /** New colors */
306
+ new: ChatColors;
307
+ }
308
+ /** Group wallpaper has been changed */
309
+ export interface ChatActionWallpaperChanged {
310
+ type: 'wallpaper_changed';
311
+ /** Old wallpaper */
312
+ old: tl.TypeWallPaper;
313
+ /** New wallpaper */
314
+ new: tl.TypeWallPaper;
315
+ }
316
+ /** A message has been sent */
317
+ export interface ChatActionMessageSent {
318
+ type: 'msg_sent';
319
+ /** Message that was sent */
320
+ message: Message;
321
+ }
322
+ /** Aggressive anti-spam has been toggled */
323
+ export interface ChatActionToggleAntiSpam {
324
+ type: 'toggle_anti_spam';
325
+ /** Whether the chat now has aggressive anti-spam enabled */
326
+ enabled: boolean;
327
+ }
328
+ /** Auto-translation has been toggled */
329
+ export interface ChatActionToggleAutotranslation {
330
+ type: 'toggle_autotranslation';
331
+ /** Whether the chat is now in autotranslation mode */
332
+ enabled: boolean;
333
+ }
276
334
  /** Chat event action (`null` if unsupported) */
277
- export type ChatAction = ChatActionUserJoined | ChatActionUserLeft | ChatActionUserInvited | ChatActionTitleChanged | ChatActionDescriptionChanged | ChatActionUsernameChanged | ChatActionUsernamesChanged | ChatActionPhotoChanged | ChatActionInvitesToggled | ChatActionSignaturesToggled | ChatActionMessagePinned | ChatActionMessageEdited | ChatActionMessageDeleted | ChatActionUserPermissionsChanged | ChatActionUserAdminPermissionsChanged | ChatActionStickersetChanged | ChatActionHistoryToggled | ChatActionDefaultPermissionsChanged | ChatActionPollStopped | ChatActionLinkedChatChanged | ChatActionLocationChanged | ChatActionSlowModeChanged | ChatActionCallStarted | ChatActionCallEnded | ChatActionCallSettingChanged | ChatActionUserJoinedInvite | ChatActionInviteLinkDeleted | ChatActionInviteLinkEdited | ChatActionInviteLinkRevoked | ChatActionUserJoinedApproved | ChatActionTtlChanged | ChatActionNoForwardsToggled | ChatActionForumToggled | ChatActionTopicCreated | ChatActionTopicEdited | ChatActionTopicDeleted | ChatActionSignatureProfilesToggled | ChatActionSubscriptionExtended | null;
335
+ export type ChatAction = ChatActionUserJoined | ChatActionUserLeft | ChatActionUserInvited | ChatActionTitleChanged | ChatActionDescriptionChanged | ChatActionUsernameChanged | ChatActionUsernamesChanged | ChatActionPhotoChanged | ChatActionInvitesToggled | ChatActionSignaturesToggled | ChatActionMessagePinned | ChatActionMessageEdited | ChatActionMessageDeleted | ChatActionUserPermissionsChanged | ChatActionUserAdminPermissionsChanged | ChatActionStickersetChanged | ChatActionHistoryToggled | ChatActionDefaultPermissionsChanged | ChatActionPollStopped | ChatActionLinkedChatChanged | ChatActionLocationChanged | ChatActionSlowModeChanged | ChatActionCallStarted | ChatActionCallEnded | ChatActionCallSettingChanged | ChatActionUserJoinedInvite | ChatActionInviteLinkDeleted | ChatActionInviteLinkEdited | ChatActionInviteLinkRevoked | ChatActionUserJoinedApproved | ChatActionTtlChanged | ChatActionNoForwardsToggled | ChatActionForumToggled | ChatActionTopicCreated | ChatActionTopicEdited | ChatActionTopicDeleted | ChatActionSignatureProfilesToggled | ChatActionSubscriptionExtended | ChatActionAvailableReactionsChanged | ChatActionEmojiStatusChanged | ChatActionEmojiStickersetChanged | ChatActionPeerColorChanged | ChatActionWallpaperChanged | ChatActionMessageSent | ChatActionToggleAntiSpam | ChatActionToggleAutotranslation | null;
278
336
  /** @internal */
279
- export declare function _actionFromTl(e: tl.TypeChannelAdminLogEventAction, peers: PeersIndex): ChatAction;
337
+ export declare function _actionFromTl(e: tl.TypeChannelAdminLogEventAction, peers: PeersIndex, peerId: number): ChatAction;
@@ -2,13 +2,15 @@ import { toggleChannelIdMark } from "../../../../utils/peer-utils.js";
2
2
  import { assertTypeIs } from "../../../../utils/type-assertions.js";
3
3
  import { Photo as Photo$2 } from "../../media/photo.js";
4
4
  import { Message as Message$2 } from "../../messages/message.js";
5
+ import { EmojiStatus as EmojiStatus$1 } from "../../reactions/emoji-status.js";
6
+ import { ChatColors as ChatColors$1 } from "../chat-colors.js";
5
7
  import { ChatInviteLink as ChatInviteLink$2 } from "../chat-invite-link.js";
6
8
  import { ChatLocation as ChatLocation$2 } from "../chat-location.js";
7
9
  import { ChatMember as ChatMember$2 } from "../chat-member.js";
8
10
  import { ChatPermissions as ChatPermissions$1 } from "../chat-permissions.js";
9
11
  import { ForumTopic as ForumTopic$2 } from "../forum-topic.js";
10
12
  import { User as User$2 } from "../user.js";
11
- function _actionFromTl(e, peers) {
13
+ function _actionFromTl(e, peers, peerId) {
12
14
  switch (e._) {
13
15
  case "channelAdminLogEventActionParticipantJoin":
14
16
  return { type: "user_joined" };
@@ -228,6 +230,52 @@ function _actionFromTl(e, peers) {
228
230
  prev: new ChatMember$2(e.prevParticipant, peers),
229
231
  new: new ChatMember$2(e.newParticipant, peers)
230
232
  };
233
+ case "channelAdminLogEventActionChangeAvailableReactions":
234
+ return {
235
+ type: "available_reactions_changed",
236
+ prev: e.prevValue,
237
+ new: e.newValue
238
+ };
239
+ case "channelAdminLogEventActionChangeEmojiStatus":
240
+ return {
241
+ type: "emoji_status_changed",
242
+ prev: EmojiStatus$1.fromTl(e.prevValue),
243
+ new: EmojiStatus$1.fromTl(e.newValue)
244
+ };
245
+ case "channelAdminLogEventActionChangeEmojiStickerSet":
246
+ return {
247
+ type: "emoji_stickerset_changed",
248
+ old: e.prevStickerset,
249
+ new: e.newStickerset
250
+ };
251
+ case "channelAdminLogEventActionChangePeerColor":
252
+ case "channelAdminLogEventActionChangeProfilePeerColor":
253
+ return {
254
+ type: e._ === "channelAdminLogEventActionChangePeerColor" ? "peer_color_changed" : "profile_peer_color_changed",
255
+ prev: new ChatColors$1(peerId, e.prevValue),
256
+ new: new ChatColors$1(peerId, e.newValue)
257
+ };
258
+ case "channelAdminLogEventActionChangeWallpaper":
259
+ return {
260
+ type: "wallpaper_changed",
261
+ old: e.prevValue,
262
+ new: e.newValue
263
+ };
264
+ case "channelAdminLogEventActionSendMessage":
265
+ return {
266
+ type: "msg_sent",
267
+ message: new Message$2(e.message, peers)
268
+ };
269
+ case "channelAdminLogEventActionToggleAntiSpam":
270
+ return {
271
+ type: "toggle_anti_spam",
272
+ enabled: e.newValue
273
+ };
274
+ case "channelAdminLogEventActionToggleAutotranslation":
275
+ return {
276
+ type: "toggle_autotranslation",
277
+ enabled: e.newValue
278
+ };
231
279
  default:
232
280
  return null;
233
281
  }
@@ -91,6 +91,15 @@ function normalizeChatEventFilters(input) {
91
91
  serverFilter.forums = true;
92
92
  break;
93
93
  case "sub_extend":
94
+ case "available_reactions_changed":
95
+ case "emoji_status_changed":
96
+ case "emoji_stickerset_changed":
97
+ case "msg_sent":
98
+ case "peer_color_changed":
99
+ case "profile_peer_color_changed":
100
+ case "wallpaper_changed":
101
+ case "toggle_anti_spam":
102
+ case "toggle_autotranslation":
94
103
  serverFilter.invite = true;
95
104
  serverFilter.invites = true;
96
105
  serverFilter.join = true;
@@ -84,6 +84,15 @@ function normalizeChatEventFilters(input) {
84
84
  serverFilter.forums = true;
85
85
  break;
86
86
  case "sub_extend":
87
+ case "available_reactions_changed":
88
+ case "emoji_status_changed":
89
+ case "emoji_stickerset_changed":
90
+ case "msg_sent":
91
+ case "peer_color_changed":
92
+ case "profile_peer_color_changed":
93
+ case "wallpaper_changed":
94
+ case "toggle_anti_spam":
95
+ case "toggle_autotranslation":
87
96
  serverFilter.invite = true;
88
97
  serverFilter.invites = true;
89
98
  serverFilter.join = true;
@@ -10,9 +10,10 @@ const user = require("../user.cjs");
10
10
  const actions = require("./actions.cjs");
11
11
  const inspectable = require("../../../utils/inspectable.cjs");
12
12
  class ChatEvent {
13
- constructor(raw, _peers) {
13
+ constructor(raw, _peers, _chatId) {
14
14
  this.raw = raw;
15
15
  this._peers = _peers;
16
+ this._chatId = _chatId;
16
17
  }
17
18
  /**
18
19
  * Event ID.
@@ -36,7 +37,7 @@ class ChatEvent {
36
37
  return new user.User(this._peers.user(this.raw.userId));
37
38
  }
38
39
  get action() {
39
- return actions._actionFromTl(this.raw.action, this._peers);
40
+ return actions._actionFromTl(this.raw.action, this._peers, this._chatId);
40
41
  }
41
42
  }
42
43
  const ChatEvent$1 = /* @__PURE__ */ memoize.memoizeGetters(ChatEvent, ["actor", "action"]);
@@ -7,7 +7,8 @@ export type { ChatEventFilters, InputChatEventFilters } from './filters.js';
7
7
  export declare class ChatEvent {
8
8
  readonly raw: tl.TypeChannelAdminLogEvent;
9
9
  readonly _peers: PeersIndex;
10
- constructor(raw: tl.TypeChannelAdminLogEvent, _peers: PeersIndex);
10
+ readonly _chatId: number;
11
+ constructor(raw: tl.TypeChannelAdminLogEvent, _peers: PeersIndex, _chatId: number);
11
12
  /**
12
13
  * Event ID.
13
14
  *
@@ -7,7 +7,8 @@ export type { ChatEventFilters, InputChatEventFilters } from './filters.js';
7
7
  export declare class ChatEvent {
8
8
  readonly raw: tl.TypeChannelAdminLogEvent;
9
9
  readonly _peers: PeersIndex;
10
- constructor(raw: tl.TypeChannelAdminLogEvent, _peers: PeersIndex);
10
+ readonly _chatId: number;
11
+ constructor(raw: tl.TypeChannelAdminLogEvent, _peers: PeersIndex, _chatId: number);
11
12
  /**
12
13
  * Event ID.
13
14
  *
@@ -3,9 +3,10 @@ import { User as User$2 } from "../user.js";
3
3
  import { _actionFromTl } from "./actions.js";
4
4
  import { makeInspectable } from "../../../utils/inspectable.js";
5
5
  class ChatEvent {
6
- constructor(raw, _peers) {
6
+ constructor(raw, _peers, _chatId) {
7
7
  this.raw = raw;
8
8
  this._peers = _peers;
9
+ this._chatId = _chatId;
9
10
  }
10
11
  /**
11
12
  * Event ID.
@@ -29,7 +30,7 @@ class ChatEvent {
29
30
  return new User$2(this._peers.user(this.raw.userId));
30
31
  }
31
32
  get action() {
32
- return _actionFromTl(this.raw.action, this._peers);
33
+ return _actionFromTl(this.raw.action, this._peers, this._chatId);
33
34
  }
34
35
  }
35
36
  const ChatEvent$1 = /* @__PURE__ */ memoizeGetters(ChatEvent, ["actor", "action"]);
@@ -238,6 +238,10 @@ class Chat {
238
238
  get hasSignatures() {
239
239
  return this.raw._ === "channel" && this.raw.signatures;
240
240
  }
241
+ /** Whether this chat/channel has auto-translation enabled */
242
+ get hasAutoTranslation() {
243
+ return this.raw._ === "channel" && this.raw.autotranslation;
244
+ }
241
245
  /** Chat title */
242
246
  get title() {
243
247
  return this.raw.title;
@@ -329,10 +333,7 @@ class Chat {
329
333
  */
330
334
  get emojiStatus() {
331
335
  if (this.raw._ !== "channel") return null;
332
- if (!this.raw.emojiStatus || this.raw.emojiStatus._ === "emojiStatusEmpty" || this.raw.emojiStatus._ === "inputEmojiStatusCollectible") {
333
- return null;
334
- }
335
- return new emojiStatus.EmojiStatus(this.raw.emojiStatus);
336
+ return emojiStatus.EmojiStatus.fromTl(this.raw.emojiStatus);
336
337
  }
337
338
  /**
338
339
  * If non-null, this user was verified by a bot, and this field contains
@@ -129,6 +129,8 @@ export declare class Chat {
129
129
  get hasProfileSignatures(): boolean;
130
130
  /** Whether this channel has author signatures enabled under posts */
131
131
  get hasSignatures(): boolean;
132
+ /** Whether this chat/channel has auto-translation enabled */
133
+ get hasAutoTranslation(): boolean;
132
134
  /** Chat title */
133
135
  get title(): string;
134
136
  /** Chat username (if available) */
@@ -129,6 +129,8 @@ export declare class Chat {
129
129
  get hasProfileSignatures(): boolean;
130
130
  /** Whether this channel has author signatures enabled under posts */
131
131
  get hasSignatures(): boolean;
132
+ /** Whether this chat/channel has auto-translation enabled */
133
+ get hasAutoTranslation(): boolean;
132
134
  /** Chat title */
133
135
  get title(): string;
134
136
  /** Chat username (if available) */