@mtkruto/node 0.154.0 → 0.161.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 (171) hide show
  1. package/esm/3_types.d.ts +3 -0
  2. package/esm/3_types.d.ts.map +1 -1
  3. package/esm/3_types.js +3 -0
  4. package/esm/client/0_markdown.js +4 -4
  5. package/esm/client/0_params.d.ts +11 -1
  6. package/esm/client/0_params.d.ts.map +1 -1
  7. package/esm/client/1_client_generic.d.ts +100 -3
  8. package/esm/client/1_client_generic.d.ts.map +1 -1
  9. package/esm/client/2_client_encrypted.d.ts.map +1 -1
  10. package/esm/client/2_client_encrypted.js +12 -2
  11. package/esm/client/2_file_manager.js +1 -1
  12. package/esm/client/2_payment_manager.js +2 -2
  13. package/esm/client/2_takeout_manager.js +2 -2
  14. package/esm/client/2_update_manager.js +10 -10
  15. package/esm/client/3_account_manager.js +3 -3
  16. package/esm/client/3_message_manager.d.ts +11 -0
  17. package/esm/client/3_message_manager.d.ts.map +1 -1
  18. package/esm/client/3_message_manager.js +195 -74
  19. package/esm/client/3_sticker_set_manager.js +3 -3
  20. package/esm/client/3_video_chat_manager.js +1 -1
  21. package/esm/client/4_callback_query_manager.js +2 -2
  22. package/esm/client/4_chat_list_manager.js +3 -3
  23. package/esm/client/4_chat_manager.d.ts +3 -2
  24. package/esm/client/4_chat_manager.d.ts.map +1 -1
  25. package/esm/client/4_chat_manager.js +12 -5
  26. package/esm/client/4_contact_manager.js +1 -1
  27. package/esm/client/4_gift_manager.js +11 -11
  28. package/esm/client/4_inline_query_manager.js +1 -1
  29. package/esm/client/4_story_manager.d.ts +3 -1
  30. package/esm/client/4_story_manager.d.ts.map +1 -1
  31. package/esm/client/4_story_manager.js +17 -3
  32. package/esm/client/6_client.d.ts +100 -3
  33. package/esm/client/6_client.d.ts.map +1 -1
  34. package/esm/client/6_client.js +126 -1
  35. package/esm/client/6_client_dispatcher.d.ts +100 -3
  36. package/esm/client/6_client_dispatcher.d.ts.map +1 -1
  37. package/esm/client/6_client_dispatcher.js +126 -1
  38. package/esm/connection/0_get_tls_header.d.ts.map +1 -1
  39. package/esm/connection/0_get_tls_header.js +19 -0
  40. package/esm/connection/1_connection_web_socket.js +2 -2
  41. package/esm/session/2_session_encrypted.js +2 -2
  42. package/esm/storage/1_utilities.js +2 -2
  43. package/esm/transport/2_transport_provider_web_socket.js +1 -1
  44. package/esm/types/0_button_style.js +1 -1
  45. package/esm/types/0_chat_member_rights.js +34 -34
  46. package/esm/types/0_chat_photo.js +2 -2
  47. package/esm/types/0_dice.d.ts +1 -1
  48. package/esm/types/0_dice.d.ts.map +1 -1
  49. package/esm/types/0_giveaway_parameters.js +1 -1
  50. package/esm/types/0_live_stream_channel.d.ts +1 -1
  51. package/esm/types/0_live_stream_channel.d.ts.map +1 -1
  52. package/esm/types/0_report_reason.d.ts +63 -0
  53. package/esm/types/0_report_reason.d.ts.map +1 -0
  54. package/esm/types/0_report_reason.js +45 -0
  55. package/esm/types/0_story_report_option.d.ts +26 -0
  56. package/esm/types/0_story_report_option.d.ts.map +1 -0
  57. package/esm/types/0_story_report_option.js +25 -0
  58. package/esm/types/0_video_chat.js +2 -2
  59. package/esm/types/1_inline_keyboard_button.d.ts +2 -2
  60. package/esm/types/1_message_reaction.js +1 -1
  61. package/esm/types/1_sticker.js +1 -1
  62. package/esm/types/1_story_reaction.js +1 -1
  63. package/esm/types/1_story_report_result.d.ts +40 -0
  64. package/esm/types/1_story_report_result.d.ts.map +1 -0
  65. package/esm/types/1_story_report_result.js +36 -0
  66. package/esm/types/2_chat.js +2 -2
  67. package/esm/types/2_chat_member.js +3 -3
  68. package/esm/types/2_message_entity.js +1 -1
  69. package/esm/types/2_story_interactive_area.js +3 -3
  70. package/esm/types/3_chat_settings.js +1 -1
  71. package/esm/types/3_forward_header.js +3 -3
  72. package/esm/types/3_inline_query.js +1 -1
  73. package/esm/types/3_invite_link.js +2 -2
  74. package/esm/types/3_story.js +3 -3
  75. package/esm/types/4_gift.js +1 -1
  76. package/esm/types/5_gift_non_upgraded_information.js +8 -8
  77. package/esm/types/5_gift_upgraded_information.js +5 -5
  78. package/esm/types/6_poll_media.d.ts +1 -1
  79. package/esm/types/6_poll_media.d.ts.map +1 -1
  80. package/esm/types/7_inline_query_result.js +8 -8
  81. package/esm/types/7_poll_option.d.ts +1 -1
  82. package/esm/types/7_poll_option.d.ts.map +1 -1
  83. package/esm/types/8_inline_query_answer.js +1 -1
  84. package/esm/types/9_message.js +3 -3
  85. package/esm/utilities/0_env.js +1 -1
  86. package/package.json +1 -1
  87. package/script/3_types.d.ts +3 -0
  88. package/script/3_types.d.ts.map +1 -1
  89. package/script/3_types.js +3 -0
  90. package/script/client/0_markdown.js +4 -4
  91. package/script/client/0_params.d.ts +11 -1
  92. package/script/client/0_params.d.ts.map +1 -1
  93. package/script/client/1_client_generic.d.ts +100 -3
  94. package/script/client/1_client_generic.d.ts.map +1 -1
  95. package/script/client/2_client_encrypted.d.ts.map +1 -1
  96. package/script/client/2_client_encrypted.js +12 -2
  97. package/script/client/2_file_manager.js +1 -1
  98. package/script/client/2_payment_manager.js +2 -2
  99. package/script/client/2_takeout_manager.js +2 -2
  100. package/script/client/2_update_manager.js +10 -10
  101. package/script/client/3_account_manager.js +3 -3
  102. package/script/client/3_message_manager.d.ts +11 -0
  103. package/script/client/3_message_manager.d.ts.map +1 -1
  104. package/script/client/3_message_manager.js +194 -73
  105. package/script/client/3_sticker_set_manager.js +3 -3
  106. package/script/client/3_video_chat_manager.js +1 -1
  107. package/script/client/4_callback_query_manager.js +2 -2
  108. package/script/client/4_chat_list_manager.js +3 -3
  109. package/script/client/4_chat_manager.d.ts +3 -2
  110. package/script/client/4_chat_manager.d.ts.map +1 -1
  111. package/script/client/4_chat_manager.js +11 -4
  112. package/script/client/4_contact_manager.js +1 -1
  113. package/script/client/4_gift_manager.js +11 -11
  114. package/script/client/4_inline_query_manager.js +1 -1
  115. package/script/client/4_story_manager.d.ts +3 -1
  116. package/script/client/4_story_manager.d.ts.map +1 -1
  117. package/script/client/4_story_manager.js +15 -1
  118. package/script/client/6_client.d.ts +100 -3
  119. package/script/client/6_client.d.ts.map +1 -1
  120. package/script/client/6_client.js +126 -1
  121. package/script/client/6_client_dispatcher.d.ts +100 -3
  122. package/script/client/6_client_dispatcher.d.ts.map +1 -1
  123. package/script/client/6_client_dispatcher.js +126 -1
  124. package/script/connection/0_get_tls_header.d.ts.map +1 -1
  125. package/script/connection/0_get_tls_header.js +19 -0
  126. package/script/connection/1_connection_web_socket.js +2 -2
  127. package/script/session/2_session_encrypted.js +2 -2
  128. package/script/storage/1_utilities.js +2 -2
  129. package/script/transport/2_transport_provider_web_socket.js +1 -1
  130. package/script/types/0_button_style.js +1 -1
  131. package/script/types/0_chat_member_rights.js +34 -34
  132. package/script/types/0_chat_photo.js +2 -2
  133. package/script/types/0_dice.d.ts +1 -1
  134. package/script/types/0_dice.d.ts.map +1 -1
  135. package/script/types/0_giveaway_parameters.js +1 -1
  136. package/script/types/0_live_stream_channel.d.ts +1 -1
  137. package/script/types/0_live_stream_channel.d.ts.map +1 -1
  138. package/script/types/0_report_reason.d.ts +63 -0
  139. package/script/types/0_report_reason.d.ts.map +1 -0
  140. package/script/types/0_report_reason.js +48 -0
  141. package/script/types/0_story_report_option.d.ts +26 -0
  142. package/script/types/0_story_report_option.d.ts.map +1 -0
  143. package/script/types/0_story_report_option.js +28 -0
  144. package/script/types/0_video_chat.js +2 -2
  145. package/script/types/1_inline_keyboard_button.d.ts +2 -2
  146. package/script/types/1_message_reaction.js +1 -1
  147. package/script/types/1_sticker.js +1 -1
  148. package/script/types/1_story_reaction.js +1 -1
  149. package/script/types/1_story_report_result.d.ts +40 -0
  150. package/script/types/1_story_report_result.d.ts.map +1 -0
  151. package/script/types/1_story_report_result.js +39 -0
  152. package/script/types/2_chat.js +2 -2
  153. package/script/types/2_chat_member.js +3 -3
  154. package/script/types/2_message_entity.js +1 -1
  155. package/script/types/2_story_interactive_area.js +3 -3
  156. package/script/types/3_chat_settings.js +1 -1
  157. package/script/types/3_forward_header.js +3 -3
  158. package/script/types/3_inline_query.js +1 -1
  159. package/script/types/3_invite_link.js +2 -2
  160. package/script/types/3_story.js +3 -3
  161. package/script/types/4_gift.js +1 -1
  162. package/script/types/5_gift_non_upgraded_information.js +8 -8
  163. package/script/types/5_gift_upgraded_information.js +5 -5
  164. package/script/types/6_poll_media.d.ts +1 -1
  165. package/script/types/6_poll_media.d.ts.map +1 -1
  166. package/script/types/7_inline_query_result.js +8 -8
  167. package/script/types/7_poll_option.d.ts +1 -1
  168. package/script/types/7_poll_option.d.ts.map +1 -1
  169. package/script/types/8_inline_query_answer.js +1 -1
  170. package/script/types/9_message.js +3 -3
  171. package/script/utilities/0_env.js +1 -1
@@ -303,14 +303,14 @@ class MessageManager {
303
303
  const replyMarkup = await this.#constructReplyMarkup(params);
304
304
  const peer = await this.#c.getInputPeer(chatId);
305
305
  const randomId = (0, _1_utilities_js_1.getRandomId)();
306
- const noWebpage = params?.linkPreview?.isDisabled ? true : undefined;
307
- const invertMedia = params?.linkPreview?.isAboveText ? true : undefined;
308
- const silent = params?.isSilent ? true : undefined;
309
- const noforwards = params?.isContentProtected ? true : undefined;
306
+ const noWebpage = params?.linkPreview?.isDisabled || undefined;
307
+ const invertMedia = params?.linkPreview?.isAboveText || undefined;
308
+ const silent = params?.isSilent || undefined;
309
+ const noforwards = params?.isContentProtected || undefined;
310
310
  const sendAs = await this.#resolveSendAs(params);
311
311
  const effect = params?.effectId ? BigInt(params.effectId) : undefined;
312
312
  const schedule_date = params?.sendAt;
313
- const allow_paid_floodskip = params?.isPaidBroadcast ? true : undefined;
313
+ const allow_paid_floodskip = params?.isPaidBroadcast || undefined;
314
314
  let result;
315
315
  if (!noWebpage && params?.linkPreview?.url) {
316
316
  result = await this.#c.invoke({
@@ -320,9 +320,9 @@ class MessageManager {
320
320
  media: {
321
321
  _: "inputMediaWebPage",
322
322
  url: params.linkPreview.url,
323
- force_large_media: params.linkPreview.mediaSize === "large" ? true : undefined,
324
- force_small_media: params.linkPreview.mediaSize === "small" ? true : undefined,
325
- optional: message.length ? undefined : true,
323
+ force_large_media: params.linkPreview.mediaSize === "large" || undefined,
324
+ force_small_media: params.linkPreview.mediaSize === "small" || undefined,
325
+ optional: !message.length || undefined,
326
326
  },
327
327
  message,
328
328
  invert_media: invertMedia,
@@ -364,12 +364,12 @@ class MessageManager {
364
364
  const replyMarkup = await this.#constructReplyMarkup(params);
365
365
  const peer = await this.#c.getInputPeer(chatId);
366
366
  const randomId = (0, _1_utilities_js_1.getRandomId)();
367
- const silent = params?.isSilent ? true : undefined;
368
- const noforwards = params?.isContentProtected ? true : undefined;
367
+ const silent = params?.isSilent || undefined;
368
+ const noforwards = params?.isContentProtected || undefined;
369
369
  const sendAs = await this.#resolveSendAs(params);
370
370
  const effect = params?.effectId ? BigInt(params.effectId) : undefined;
371
371
  const schedule_date = params?.sendAt;
372
- const allow_paid_floodskip = params?.isPaidBroadcast ? true : undefined;
372
+ const allow_paid_floodskip = params?.isPaidBroadcast || undefined;
373
373
  const rich_message = MessageManager.inputRichTextToInputRichMessage(richText);
374
374
  const result = await this.#c.invoke({
375
375
  _: "messages.sendMessage",
@@ -466,8 +466,8 @@ class MessageManager {
466
466
  this.#checkParams(params);
467
467
  const peer = await this.#c.getInputPeer(chatId);
468
468
  const randomId = (0, _1_utilities_js_1.getRandomId)();
469
- const silent = params?.isSilent ? true : undefined;
470
- const noforwards = params?.isContentProtected ? true : undefined;
469
+ const silent = params?.isSilent || undefined;
470
+ const noforwards = params?.isContentProtected || undefined;
471
471
  const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
472
472
  const replyMarkup = await this.#constructReplyMarkup(params);
473
473
  const result = await this.#c.invoke({
@@ -495,7 +495,7 @@ class MessageManager {
495
495
  message: "",
496
496
  effect: params?.effectId ? BigInt(params.effectId) : undefined,
497
497
  schedule_date: params?.sendAt,
498
- allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
498
+ allow_paid_floodskip: params?.isPaidBroadcast || undefined,
499
499
  }, { businessConnectionId: params?.businessConnectionId });
500
500
  const message = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
501
501
  return (0, _3_types_js_2.assertMessageType)(message, "venue");
@@ -504,8 +504,8 @@ class MessageManager {
504
504
  this.#checkParams(params);
505
505
  const peer = await this.#c.getInputPeer(chatId);
506
506
  const randomId = (0, _1_utilities_js_1.getRandomId)();
507
- const silent = params?.isSilent ? true : undefined;
508
- const noforwards = params?.isContentProtected ? true : undefined;
507
+ const silent = params?.isSilent || undefined;
508
+ const noforwards = params?.isContentProtected || undefined;
509
509
  const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
510
510
  const replyMarkup = await this.#constructReplyMarkup(params);
511
511
  const result = await this.#c.invoke({
@@ -527,7 +527,7 @@ class MessageManager {
527
527
  message: "",
528
528
  effect: params?.effectId ? BigInt(params.effectId) : undefined,
529
529
  schedule_date: params?.sendAt,
530
- allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
530
+ allow_paid_floodskip: params?.isPaidBroadcast || undefined,
531
531
  }, { businessConnectionId: params?.businessConnectionId });
532
532
  const message = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
533
533
  return (0, _3_types_js_2.assertMessageType)(message, "contact");
@@ -536,8 +536,8 @@ class MessageManager {
536
536
  this.#checkParams(params);
537
537
  const peer = await this.#c.getInputPeer(chatId);
538
538
  const randomId = (0, _1_utilities_js_1.getRandomId)();
539
- const silent = params?.isSilent ? true : undefined;
540
- const noforwards = params?.isContentProtected ? true : undefined;
539
+ const silent = params?.isSilent || undefined;
540
+ const noforwards = params?.isContentProtected || undefined;
541
541
  const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
542
542
  const replyMarkup = await this.#constructReplyMarkup(params);
543
543
  const result = await this.#c.invoke({
@@ -556,7 +556,7 @@ class MessageManager {
556
556
  message: "",
557
557
  effect: params?.effectId ? BigInt(params.effectId) : undefined,
558
558
  schedule_date: params?.sendAt,
559
- allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
559
+ allow_paid_floodskip: params?.isPaidBroadcast || undefined,
560
560
  }, { businessConnectionId: params?.businessConnectionId });
561
561
  const message = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
562
562
  return (0, _3_types_js_2.assertMessageType)(message, "dice");
@@ -565,8 +565,8 @@ class MessageManager {
565
565
  this.#checkParams(params);
566
566
  const peer = await this.#c.getInputPeer(chatId);
567
567
  const randomId = (0, _1_utilities_js_1.getRandomId)();
568
- const silent = params?.isSilent ? true : undefined;
569
- const noforwards = params?.isContentProtected ? true : undefined;
568
+ const silent = params?.isSilent || undefined;
569
+ const noforwards = params?.isContentProtected || undefined;
570
570
  const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
571
571
  const replyMarkup = await this.#constructReplyMarkup(params);
572
572
  const result = await this.#c.invoke({
@@ -603,7 +603,7 @@ class MessageManager {
603
603
  message: "",
604
604
  effect: params?.effectId ? BigInt(params.effectId) : undefined,
605
605
  schedule_date: params?.sendAt,
606
- allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
606
+ allow_paid_floodskip: params?.isPaidBroadcast || undefined,
607
607
  }, { businessConnectionId: params?.businessConnectionId });
608
608
  const message = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
609
609
  return (0, _3_types_js_2.assertMessageType)(message, "location");
@@ -630,7 +630,7 @@ class MessageManager {
630
630
  return (0, _3_types_js_2.assertMessageType)(message, "audio");
631
631
  }
632
632
  static #isM4a(firstPart) {
633
- return firstPart.length >= 10 && (0, _0_deps_js_1.startsWith)(firstPart.subarray(4), new Uint8Array([0x66, 0x74, 0x79, 0x70, 0x4D, 0x34]));
633
+ return firstPart.byteLength >= 10 && (0, _0_deps_js_1.startsWith)(firstPart.subarray(4), new Uint8Array([0x66, 0x74, 0x79, 0x70, 0x4D, 0x34]));
634
634
  }
635
635
  async sendVoice(chatId, voice, params) {
636
636
  this.#checkParams(params);
@@ -667,13 +667,13 @@ class MessageManager {
667
667
  async sendVideo(chatId, video, params) {
668
668
  this.#checkParams(params);
669
669
  const message = await this.#sendDocumentInner(chatId, video, params, _3_types_js_2.FileType.Video, [
670
- { _: "documentAttributeVideo", supports_streaming: params?.supportsStreaming ? true : undefined, w: params?.width ?? 0, h: params?.height ?? 0, duration: params?.duration ?? 0 },
670
+ { _: "documentAttributeVideo", supports_streaming: params?.supportsStreaming || undefined, w: params?.width ?? 0, h: params?.height ?? 0, duration: params?.duration ?? 0 },
671
671
  ], undefined, VIDEO_MIME_TYPES, () => "video.mp4");
672
672
  return (0, _3_types_js_2.assertMessageType)(message, "video");
673
673
  }
674
674
  async #sendDocumentInner(chatId, document, params, fileType, otherAttribs, urlSupported = true, expectedMimeTypes, createName) {
675
675
  let media = null;
676
- const spoiler = params?.hasSpoiler ? true : undefined;
676
+ const spoiler = params?.hasSpoiler || undefined;
677
677
  const ttl_seconds = params && "selfDestruct" in params && typeof params.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined;
678
678
  if (typeof document === "string") {
679
679
  const fileId = this.resolveFileId(document, fileType);
@@ -711,7 +711,7 @@ class MessageManager {
711
711
  if (params?.thumbnail) {
712
712
  thumb = await this.#c.fileManager.upload(params.thumbnail, { chunkSize: params?.chunkSize, signal: params?.signal });
713
713
  }
714
- media = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType === _3_types_js_2.FileType.Document ? true : undefined, ttl_seconds };
714
+ media = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType === _3_types_js_2.FileType.Document || undefined, ttl_seconds };
715
715
  }
716
716
  }
717
717
  const message = await this.#sendMedia(chatId, media, params);
@@ -748,8 +748,8 @@ class MessageManager {
748
748
  }
749
749
  const peer = await this.#c.getInputPeer(chatId);
750
750
  const randomId = (0, _1_utilities_js_1.getRandomId)();
751
- const silent = params?.isSilent ? true : undefined;
752
- const noforwards = params?.isContentProtected ? true : undefined;
751
+ const silent = params?.isSilent || undefined;
752
+ const noforwards = params?.isContentProtected || undefined;
753
753
  const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
754
754
  const replyMarkup = await this.#constructReplyMarkup(params);
755
755
  const caption_ = params?.caption;
@@ -770,7 +770,7 @@ class MessageManager {
770
770
  entities: captionEntities,
771
771
  effect: params?.effectId ? BigInt(params.effectId) : undefined,
772
772
  schedule_date: params?.sendAt,
773
- allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
773
+ allow_paid_floodskip: params?.isPaidBroadcast || undefined,
774
774
  }, { businessConnectionId: params?.businessConnectionId });
775
775
  return (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
776
776
  }
@@ -806,8 +806,8 @@ class MessageManager {
806
806
  }
807
807
  const peer = await this.#c.getInputPeer(chatId);
808
808
  const randomId = (0, _1_utilities_js_1.getRandomId)();
809
- const silent = params?.isSilent ? true : undefined;
810
- const noforwards = params?.isContentProtected ? true : undefined;
809
+ const silent = params?.isSilent || undefined;
810
+ const noforwards = params?.isContentProtected || undefined;
811
811
  const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
812
812
  const replyMarkup = await this.#constructReplyMarkup(params);
813
813
  const explanation = params?.explanation;
@@ -832,17 +832,17 @@ class MessageManager {
832
832
  id: (0, _1_utilities_js_1.getRandomId)(),
833
833
  answers,
834
834
  question: { _: "textWithEntities", text: questionParseResult[0], entities: questionParseResult[1] ?? [] },
835
- closed: params?.isClosed ? true : undefined,
835
+ closed: params?.isClosed || undefined,
836
836
  close_date: params?.closeDate,
837
- close_period: params?.openPeriod ? params.openPeriod : undefined,
838
- multiple_choice: params?.isMultipleAnswersAllowed ? true : undefined,
839
- public_voters: params?.isAnonymous === false ? true : undefined,
840
- quiz: params?.type === "quiz" ? true : undefined,
837
+ close_period: params?.openPeriod || undefined,
838
+ multiple_choice: params?.isMultipleAnswersAllowed || undefined,
839
+ public_voters: params?.isAnonymous === false || undefined,
840
+ quiz: params?.type === "quiz" || undefined,
841
841
  hash: 0n,
842
- revoting_disabled: params?.isRevotingAllowed === false ? true : undefined,
843
- shuffle_answers: params?.isShuffled ? true : undefined,
844
- hide_results_until_close: params?.isResultHidden ? true : undefined,
845
- open_answers: params?.isAddingOptionsAllowed ? true : undefined,
842
+ revoting_disabled: params?.isRevotingAllowed === false || undefined,
843
+ shuffle_answers: params?.isShuffled || undefined,
844
+ hide_results_until_close: params?.isResultHidden || undefined,
845
+ open_answers: params?.isAddingOptionsAllowed || undefined,
846
846
  countries_iso2: params?.countries,
847
847
  subscribers_only: params?.isSubscriberOnly || undefined,
848
848
  };
@@ -873,7 +873,7 @@ class MessageManager {
873
873
  entities,
874
874
  effect: params?.effectId ? BigInt(params.effectId) : undefined,
875
875
  schedule_date: params?.sendAt,
876
- allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
876
+ allow_paid_floodskip: params?.isPaidBroadcast || undefined,
877
877
  }, { businessConnectionId: params?.businessConnectionId });
878
878
  const message = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
879
879
  return (0, _3_types_js_2.assertMessageType)(message, "poll");
@@ -922,8 +922,8 @@ class MessageManager {
922
922
  }
923
923
  const peer = await this.#c.getInputPeer(chatId);
924
924
  const randomId = (0, _1_utilities_js_1.getRandomId)();
925
- const silent = params?.isSilent ? true : undefined;
926
- const noforwards = params?.isContentProtected ? true : undefined;
925
+ const silent = params?.isSilent || undefined;
926
+ const noforwards = params?.isContentProtected || undefined;
927
927
  const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
928
928
  const list = items.map((v, i) => {
929
929
  const text = v.text;
@@ -936,8 +936,8 @@ class MessageManager {
936
936
  _: "todoList",
937
937
  title: { _: "textWithEntities", text: titleParseResult[0], entities: titleParseResult[1] ?? [] },
938
938
  list,
939
- others_can_append: params?.isExtendableByOthers ? true : undefined,
940
- others_can_complete: params?.isCompletableByOthers ? true : undefined,
939
+ others_can_append: params?.isExtendableByOthers || undefined,
940
+ others_can_complete: params?.isCompletableByOthers || undefined,
941
941
  };
942
942
  const media = { _: "inputMediaTodo", todo };
943
943
  const result = await this.#c.invoke({
@@ -952,7 +952,7 @@ class MessageManager {
952
952
  message: "",
953
953
  effect: params?.effectId ? BigInt(params.effectId) : undefined,
954
954
  schedule_date: params?.sendAt,
955
- allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
955
+ allow_paid_floodskip: params?.isPaidBroadcast || undefined,
956
956
  }, { businessConnectionId: params?.businessConnectionId });
957
957
  const message = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
958
958
  return (0, _3_types_js_2.assertMessageType)(message, "checklist");
@@ -994,11 +994,11 @@ class MessageManager {
994
994
  if (params?.linkPreview && params.linkPreview.type !== "input") {
995
995
  throw new _0_errors_js_1.InputError("Expected link preview of type input.");
996
996
  }
997
- const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.isDisabled ? true : undefined;
998
- const invertMedia = params?.linkPreview?.isAboveText ? true : undefined;
997
+ const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.isDisabled || undefined;
998
+ const invertMedia = params?.linkPreview?.isAboveText || undefined;
999
999
  let media = undefined;
1000
1000
  if (!noWebpage && params?.linkPreview?.url) {
1001
- media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.mediaSize === "large" ? true : undefined, force_small_media: params.linkPreview.mediaSize === "small" ? true : undefined, optional: message.length ? undefined : true };
1001
+ media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.mediaSize === "large" || undefined, force_small_media: params.linkPreview.mediaSize === "small" || undefined, optional: !message.length || undefined };
1002
1002
  }
1003
1003
  const result = await this.#c.invoke({
1004
1004
  _: "messages.editMessage",
@@ -1072,11 +1072,11 @@ class MessageManager {
1072
1072
  if (params?.linkPreview && params.linkPreview.type !== "input") {
1073
1073
  throw new _0_errors_js_1.InputError("Expected link preview of type input.");
1074
1074
  }
1075
- const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.isDisabled ? true : undefined;
1076
- const invertMedia = params?.linkPreview?.isAboveText ? true : undefined;
1075
+ const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.isDisabled || undefined;
1076
+ const invertMedia = params?.linkPreview?.isAboveText || undefined;
1077
1077
  let media = undefined;
1078
1078
  if (!noWebpage && params?.linkPreview?.url) {
1079
- media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.mediaSize === "large" ? true : undefined, force_small_media: params.linkPreview.mediaSize === "small" ? true : undefined, optional: message.length ? undefined : true };
1079
+ media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.mediaSize === "large" || undefined, force_small_media: params.linkPreview.mediaSize === "small" || undefined, optional: !message.length || undefined };
1080
1080
  }
1081
1081
  await this.#c.invoke({
1082
1082
  _: "messages.editInlineBotMessage",
@@ -1097,7 +1097,7 @@ class MessageManager {
1097
1097
  }
1098
1098
  async #resolveInputMediaInner(document, media, fileType, otherAttribs) {
1099
1099
  let media_ = null;
1100
- const spoiler = "hasSpoiler" in media && media.hasSpoiler ? true : undefined;
1100
+ const spoiler = "hasSpoiler" in media && media.hasSpoiler || undefined;
1101
1101
  if (typeof document === "string") {
1102
1102
  const fileId = this.resolveFileId(document, fileType);
1103
1103
  if (fileId !== null) {
@@ -1124,7 +1124,7 @@ class MessageManager {
1124
1124
  if ("thumbnail" in media && media.thumbnail) {
1125
1125
  thumb = await this.#c.fileManager.upload(media.thumbnail, { chunkSize: media?.chunkSize, signal: media?.signal });
1126
1126
  }
1127
- media_ = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType === _3_types_js_2.FileType.Document ? true : undefined };
1127
+ media_ = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType === _3_types_js_2.FileType.Document || undefined };
1128
1128
  }
1129
1129
  }
1130
1130
  return media_;
@@ -1144,7 +1144,7 @@ class MessageManager {
1144
1144
  return await this.#resolveInputMediaInner(media.document, media, _3_types_js_2.FileType.Document, []);
1145
1145
  case "photo": {
1146
1146
  let media_ = null;
1147
- const spoiler = media.hasSpoiler ? true : undefined;
1147
+ const spoiler = media.hasSpoiler || undefined;
1148
1148
  const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(media.selfDestruct) : undefined;
1149
1149
  if (typeof media.photo === "string") {
1150
1150
  const fileId = this.resolveFileId(media.photo, [_3_types_js_2.FileType.Photo, _3_types_js_2.FileType.ProfilePhoto]);
@@ -1166,7 +1166,7 @@ class MessageManager {
1166
1166
  case "video": {
1167
1167
  const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(media.selfDestruct) : undefined;
1168
1168
  const media_ = await this.#resolveInputMediaInner(media.video, media, _3_types_js_2.FileType.Video, [
1169
- { _: "documentAttributeVideo", supports_streaming: media?.supportsStreaming ? true : undefined, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
1169
+ { _: "documentAttributeVideo", supports_streaming: media?.supportsStreaming || undefined, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
1170
1170
  ]);
1171
1171
  media_.ttl_seconds = ttl_seconds;
1172
1172
  return media_;
@@ -1192,14 +1192,14 @@ class MessageManager {
1192
1192
  access_hash: messageMedia.photo.access_hash,
1193
1193
  file_reference: messageMedia.photo.file_reference,
1194
1194
  },
1195
- spoiler: "hasSpoiler" in media && media.hasSpoiler ? true : undefined,
1195
+ spoiler: "hasSpoiler" in media && media.hasSpoiler || undefined,
1196
1196
  };
1197
1197
  }
1198
1198
  else if ("document" in messageMedia && _2_tl_js_1.Api.is("document", messageMedia.document)) {
1199
1199
  return {
1200
1200
  _: "inputMediaDocument",
1201
1201
  id: { _: "inputDocument", id: messageMedia.document.id, access_hash: messageMedia.document.access_hash, file_reference: messageMedia.document.file_reference },
1202
- spoiler: "hasSpoiler" in media && media.hasSpoiler ? true : undefined,
1202
+ spoiler: "hasSpoiler" in media && media.hasSpoiler || undefined,
1203
1203
  };
1204
1204
  }
1205
1205
  else {
@@ -1224,7 +1224,7 @@ class MessageManager {
1224
1224
  }
1225
1225
  async #uploadPhoto(photo, params) {
1226
1226
  let media = null;
1227
- const spoiler = params?.hasSpoiler ? true : undefined;
1227
+ const spoiler = params?.hasSpoiler || undefined;
1228
1228
  const ttl_seconds = params && "selfDestruct" in params && params.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined;
1229
1229
  let video;
1230
1230
  if (params?.video) {
@@ -1233,7 +1233,7 @@ class MessageManager {
1233
1233
  if (typeof photo === "string") {
1234
1234
  const fileId = this.resolveFileId(photo, [_3_types_js_2.FileType.Photo, _3_types_js_2.FileType.ProfilePhoto]);
1235
1235
  if (fileId !== null) {
1236
- media = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds, live_photo: video !== undefined ? true : undefined, video };
1236
+ media = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds, live_photo: video !== undefined || undefined, video };
1237
1237
  }
1238
1238
  }
1239
1239
  if (media === null) {
@@ -1242,7 +1242,7 @@ class MessageManager {
1242
1242
  }
1243
1243
  else {
1244
1244
  const file = await this.#c.fileManager.upload(photo, params, (0, _0_utilities_js_1.checkPhotoName)(params), false);
1245
- media = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined, live_photo: video !== undefined ? true : undefined, video };
1245
+ media = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined, live_photo: video !== undefined || undefined, video };
1246
1246
  }
1247
1247
  }
1248
1248
  return media;
@@ -1364,7 +1364,7 @@ class MessageManager {
1364
1364
  await this.#c.invoke({ _: "channels.deleteMessages", channel: (0, _0_utilities_js_1.toInputChannel)(peer), id: messageIds });
1365
1365
  }
1366
1366
  else {
1367
- await this.#c.invoke({ _: "messages.deleteMessages", id: messageIds, revoke: params?.onlyForMe ? undefined : true });
1367
+ await this.#c.invoke({ _: "messages.deleteMessages", id: messageIds, revoke: !params?.onlyForMe || undefined });
1368
1368
  }
1369
1369
  }
1370
1370
  async deleteScheduledMessages(chatId, messageIds) {
@@ -1396,7 +1396,7 @@ class MessageManager {
1396
1396
  }
1397
1397
  async pinMessage(chatId, messageId, params) {
1398
1398
  this.#checkParams(params);
1399
- await this.#c.invoke({ _: "messages.updatePinnedMessage", peer: await this.#c.getInputPeer(chatId), id: (0, _0_utilities_js_1.checkMessageId)(messageId), silent: params?.isSilent ? true : undefined, pm_oneside: params?.bothSides ? undefined : true });
1399
+ await this.#c.invoke({ _: "messages.updatePinnedMessage", peer: await this.#c.getInputPeer(chatId), id: (0, _0_utilities_js_1.checkMessageId)(messageId), silent: params?.isSilent || undefined, pm_oneside: !params?.bothSides || undefined });
1400
1400
  }
1401
1401
  async unpinMessage(chatId, messageId, params) {
1402
1402
  this.#checkParams(params);
@@ -1410,7 +1410,7 @@ class MessageManager {
1410
1410
  });
1411
1411
  }
1412
1412
  async #sendReaction(chatId, messageId, reactions, params) {
1413
- await this.#c.invoke({ _: "messages.sendReaction", peer: await this.#c.getInputPeer(chatId), msg_id: (0, _0_utilities_js_1.checkMessageId)(messageId), reaction: reactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)), big: params?.isBig ? true : undefined, add_to_recent: params?.addToRecents ? true : undefined });
1413
+ await this.#c.invoke({ _: "messages.sendReaction", peer: await this.#c.getInputPeer(chatId), msg_id: (0, _0_utilities_js_1.checkMessageId)(messageId), reaction: reactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)), big: params?.isBig || undefined, add_to_recent: params?.addToRecents || undefined });
1414
1414
  }
1415
1415
  async setReactions(chatId, messageId, reactions, params) {
1416
1416
  await this.#sendReaction(chatId, messageId, reactions, params);
@@ -1659,7 +1659,7 @@ class MessageManager {
1659
1659
  }
1660
1660
  async getBlockedUsers(params) {
1661
1661
  this.#c.storage.assertUser("getBlockedUsers");
1662
- const my_stories_from = params?.isBlockedFromViewingStories ? true : undefined;
1662
+ const my_stories_from = params?.isBlockedFromViewingStories || undefined;
1663
1663
  const offset = params?.offset ?? 0;
1664
1664
  const limit = (0, _0_utilities_js_1.getLimit)(params?.limit);
1665
1665
  const result = await this.#c.invoke({ _: "contacts.getBlocked", my_stories_from, offset, limit });
@@ -1815,8 +1815,8 @@ class MessageManager {
1815
1815
  multiMedia[i] = { ...media_, media: { _: "inputMediaDocument", id: { ...document, _: "inputDocument" } } };
1816
1816
  }
1817
1817
  }
1818
- const silent = params?.isSilent ? true : undefined;
1819
- const noforwards = params?.isContentProtected ? true : undefined;
1818
+ const silent = params?.isSilent || undefined;
1819
+ const noforwards = params?.isContentProtected || undefined;
1820
1820
  const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
1821
1821
  const result = await this.#c.invoke({
1822
1822
  _: "messages.sendMultiMedia",
@@ -1827,7 +1827,7 @@ class MessageManager {
1827
1827
  silent,
1828
1828
  send_as: sendAs,
1829
1829
  reply_to: await this.#constructReplyTo(params),
1830
- allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
1830
+ allow_paid_floodskip: params?.isPaidBroadcast || undefined,
1831
1831
  });
1832
1832
  return await this.updatesToMessages(chatId, result);
1833
1833
  }
@@ -1973,10 +1973,10 @@ class MessageManager {
1973
1973
  }
1974
1974
  async openMiniApp(botId, chatId, params) {
1975
1975
  this.#c.storage.assertUser("openMiniApp");
1976
- const from_bot_menu = params?.isFromMenu ? true : undefined;
1977
- const silent = params?.isSilent ? true : undefined;
1978
- const compact = params?.mode === "compact" ? true : undefined;
1979
- const fullscreen = params?.mode === "fullscreen" ? true : undefined;
1976
+ const from_bot_menu = params?.isFromMenu || undefined;
1977
+ const silent = params?.isSilent || undefined;
1978
+ const compact = params?.mode === "compact" || undefined;
1979
+ const fullscreen = params?.mode === "fullscreen" || undefined;
1980
1980
  const peer = await this.#c.getInputPeer(chatId);
1981
1981
  const bot = await this.#c.getInputUser(botId);
1982
1982
  const url = params?.url;
@@ -2174,5 +2174,126 @@ class MessageManager {
2174
2174
  const message = (0, _3_types_js_2.assertMessageType)(await this.constructMessage(message_, false), "richText");
2175
2175
  return message.richText;
2176
2176
  }
2177
+ async getScheduledMessages(chatId) {
2178
+ this.#c.storage.assertUser("getScheduledMessages");
2179
+ const peer = await this.#c.getInputPeer(chatId);
2180
+ const result = _2_tl_js_1.Api.as("messages.messages", await this.#c.invoke({ _: "messages.getScheduledHistory", peer, hash: 0n }));
2181
+ return await Promise.all(result.messages.map((v) => this.constructMessage(v, false)));
2182
+ }
2183
+ async getFavoriteStickers() {
2184
+ this.#c.storage.assertUser("getFavoriteStickers");
2185
+ const result = _2_tl_js_1.Api.as("messages.favedStickers", await this.#c.invoke({ _: "messages.getFavedStickers", hash: 0n }));
2186
+ const stickers = await Promise.all(result.stickers.map((v) => _2_tl_js_1.Api.as("document", v)).map((v) => {
2187
+ const fileId = {
2188
+ type: _3_types_js_2.FileType.Sticker,
2189
+ dcId: v.dc_id,
2190
+ location: {
2191
+ type: "common",
2192
+ id: v.id,
2193
+ accessHash: v.access_hash,
2194
+ },
2195
+ fileReference: v.file_reference,
2196
+ };
2197
+ return (0, _3_types_js_1.constructSticker)(v, (0, _3_types_js_1.serializeFileId)(fileId), (0, _3_types_js_1.toUniqueFileId)(fileId), this.#c.fileManager.getStickerSetName.bind(this.#c.fileManager));
2198
+ }));
2199
+ return stickers;
2200
+ }
2201
+ async #faveSticker(fileId_, isFavorited) {
2202
+ const fileId = (0, _3_types_js_1.deserializeFileId)(fileId_);
2203
+ if (fileId.type !== _3_types_js_2.FileType.Sticker || fileId.location.type !== "common") {
2204
+ throw new _0_errors_js_1.InputError("Invalid file ID.");
2205
+ }
2206
+ const id_ = fileId.location.id;
2207
+ const access_hash = fileId.location.accessHash;
2208
+ const file_reference = fileId.fileReference ?? new Uint8Array();
2209
+ const id = { _: "inputDocument", id: id_, access_hash, file_reference };
2210
+ await this.#c.invoke({ _: "messages.faveSticker", id, unfave: !isFavorited });
2211
+ }
2212
+ async addStickerToFavorites(fileId) {
2213
+ this.#c.storage.assertUser("addStickerToFavorites");
2214
+ await this.#faveSticker(fileId, true);
2215
+ }
2216
+ async removeStickerFromFavorites(fileId) {
2217
+ this.#c.storage.assertUser("removeStickerFromFavorites");
2218
+ await this.#faveSticker(fileId, false);
2219
+ }
2220
+ async #changeStickerRecentStatus(fileId_, isSaved) {
2221
+ const fileId = (0, _3_types_js_1.deserializeFileId)(fileId_);
2222
+ if (fileId.type !== _3_types_js_2.FileType.Sticker || fileId.location.type !== "common") {
2223
+ throw new _0_errors_js_1.InputError("Invalid file ID.");
2224
+ }
2225
+ const id_ = fileId.location.id;
2226
+ const access_hash = fileId.location.accessHash;
2227
+ const file_reference = fileId.fileReference ?? new Uint8Array();
2228
+ const id = { _: "inputDocument", id: id_, access_hash, file_reference };
2229
+ await this.#c.invoke({ _: "messages.saveRecentSticker", id, unsave: !isSaved });
2230
+ }
2231
+ async addStickerToRecents(fileId) {
2232
+ this.#c.storage.assertUser("addStickerToRecents");
2233
+ await this.#changeStickerRecentStatus(fileId, true);
2234
+ }
2235
+ async removeStickerFromRecents(fileId) {
2236
+ this.#c.storage.assertUser("removeStickerFromRecents");
2237
+ await this.#changeStickerRecentStatus(fileId, false);
2238
+ }
2239
+ async clearRecentStickers() {
2240
+ this.#c.storage.assertUser("clearRecentStickers");
2241
+ await this.#c.invoke({ _: "messages.clearRecentStickers" });
2242
+ }
2243
+ async getRecentStickers() {
2244
+ this.#c.storage.assertUser("getRecentStickers");
2245
+ const result = _2_tl_js_1.Api.as("messages.recentStickers", await this.#c.invoke({ _: "messages.getRecentStickers", hash: 0n }));
2246
+ const stickers = await Promise.all(result.stickers.map((v) => _2_tl_js_1.Api.as("document", v)).map((v) => {
2247
+ const fileId = {
2248
+ type: _3_types_js_2.FileType.Sticker,
2249
+ dcId: v.dc_id,
2250
+ location: {
2251
+ type: "common",
2252
+ id: v.id,
2253
+ accessHash: v.access_hash,
2254
+ },
2255
+ fileReference: v.file_reference,
2256
+ };
2257
+ return (0, _3_types_js_1.constructSticker)(v, (0, _3_types_js_1.serializeFileId)(fileId), (0, _3_types_js_1.toUniqueFileId)(fileId), this.#c.fileManager.getStickerSetName.bind(this.#c.fileManager));
2258
+ }));
2259
+ return stickers;
2260
+ }
2261
+ async getSavedAnimations() {
2262
+ this.#c.storage.assertUser("getSavedAnimations");
2263
+ const result = _2_tl_js_1.Api.as("messages.savedGifs", await this.#c.invoke({ _: "messages.getSavedGifs", hash: 0n }));
2264
+ const animations = await Promise.all(result.gifs.map((v) => _2_tl_js_1.Api.as("document", v)).map((v) => {
2265
+ const fileId = {
2266
+ type: _3_types_js_2.FileType.Sticker,
2267
+ dcId: v.dc_id,
2268
+ location: {
2269
+ type: "common",
2270
+ id: v.id,
2271
+ accessHash: v.access_hash,
2272
+ },
2273
+ fileReference: v.file_reference,
2274
+ };
2275
+ return (0, _3_types_js_1.constructAnimation)(v, v.attributes.find((v) => _2_tl_js_1.Api.is("documentAttributeVideo", v)), v.attributes.find((v) => _2_tl_js_1.Api.is("documentAttributeFilename", v)), (0, _3_types_js_1.serializeFileId)(fileId), (0, _3_types_js_1.toUniqueFileId)(fileId));
2276
+ }));
2277
+ return animations;
2278
+ }
2279
+ async #setIsAnimationSaved(fileId_, isSaved) {
2280
+ const fileId = (0, _3_types_js_1.deserializeFileId)(fileId_);
2281
+ if (fileId.type !== _3_types_js_2.FileType.Animation || fileId.location.type !== "common") {
2282
+ throw new _0_errors_js_1.InputError("Invalid file ID.");
2283
+ }
2284
+ const id_ = fileId.location.id;
2285
+ const access_hash = fileId.location.accessHash;
2286
+ const file_reference = fileId.fileReference ?? new Uint8Array();
2287
+ const id = { _: "inputDocument", id: id_, access_hash, file_reference };
2288
+ await this.#c.invoke({ _: "messages.saveGif", id, unsave: !isSaved });
2289
+ }
2290
+ async saveAnimation(fileId) {
2291
+ this.#c.storage.assertUser("saveAnimation");
2292
+ await this.#setIsAnimationSaved(fileId, true);
2293
+ }
2294
+ async unsaveAnimation(fileId) {
2295
+ this.#c.storage.assertUser("unsaveAnimation");
2296
+ await this.#setIsAnimationSaved(fileId, false);
2297
+ }
2177
2298
  }
2178
2299
  exports.MessageManager = MessageManager;
@@ -101,9 +101,9 @@ class StickerSetManager {
101
101
  const thumb = params?.thumbnail ? await this.#uploadSticker(params.thumbnail, "⭐️", params, user_id) : undefined;
102
102
  const result = await this.#c.invoke({
103
103
  _: "stickers.createStickerSet",
104
- masks: params?.isMask ? true : undefined,
105
- emojis: params?.isCustomEmoji ? true : undefined,
106
- text_color: params?.isAdaptive ? true : undefined,
104
+ masks: params?.isMask || undefined,
105
+ emojis: params?.isCustomEmoji || undefined,
106
+ text_color: params?.isAdaptive || undefined,
107
107
  title: name,
108
108
  user_id,
109
109
  short_name: slug,
@@ -67,7 +67,7 @@ class VideoChatManager {
67
67
  async joinVideoChat(id, params, params_) {
68
68
  this.#c.storage.assertUser("joinVideoChat");
69
69
  const call = await this.#getInputGroupCall(id);
70
- const { updates } = await this.#c.invoke({ _: "phone.joinGroupCall", call, join_as: params_?.joinAs ? await this.#c.getInputPeer(params_.joinAs) : { _: "inputPeerSelf" }, params: { _: "dataJSON", data: params }, invite_hash: params_?.inviteHash, muted: params_?.isAudioEnabled ? undefined : true, video_stopped: params_?.isVideoEnabled ? undefined : true }).then((v) => _2_tl_js_1.Api.as("updates", v));
70
+ const { updates } = await this.#c.invoke({ _: "phone.joinGroupCall", call, join_as: params_?.joinAs ? await this.#c.getInputPeer(params_.joinAs) : { _: "inputPeerSelf" }, params: { _: "dataJSON", data: params }, invite_hash: params_?.inviteHash, muted: !params_?.isAudioEnabled || undefined, video_stopped: !params_?.isVideoEnabled || undefined }).then((v) => _2_tl_js_1.Api.as("updates", v));
71
71
  const updateGroupCall = updates
72
72
  .find((v) => _2_tl_js_1.Api.is("updateGroupCallConnection", v));
73
73
  if (!updateGroupCall)
@@ -38,7 +38,7 @@ class CallbackQueryManager {
38
38
  async answerCallbackQuery(id, params) {
39
39
  this.#c.storage.assertBot("answerCallbackQuery");
40
40
  (0, _0_utilities_js_1.checkCallbackQueryId)(id);
41
- await this.#c.invoke({ _: "messages.setBotCallbackAnswer", query_id: BigInt(id), cache_time: params?.cacheTime ?? 0, message: params?.text, alert: params?.isAlert ? true : undefined });
41
+ await this.#c.invoke({ _: "messages.setBotCallbackAnswer", query_id: BigInt(id), cache_time: params?.cacheTime ?? 0, message: params?.text, alert: params?.isAlert || undefined });
42
42
  }
43
43
  async sendCallbackQuery(botId, messageId, question) {
44
44
  this.#c.storage.assertUser("sendCallbackQuery");
@@ -49,7 +49,7 @@ class CallbackQueryManager {
49
49
  if (maybeAnswer !== null && !CallbackQueryManager.#isExpired(maybeAnswer[1], maybeAnswer[0].cache_time)) {
50
50
  return (0, _3_types_js_1.constructCallbackQueryAnswer)(maybeAnswer[0]);
51
51
  }
52
- const answer = await this.#c.invoke({ _: "messages.getBotCallbackAnswer", peer, msg_id: messageId, data: "data" in question ? (0, _1_utilities_js_1.encodeText)(question.data) : undefined, game: question.type === "game" ? true : undefined, password: question.type === "password" ? await this.#getPasswordCheck(question.password) : undefined });
52
+ const answer = await this.#c.invoke({ _: "messages.getBotCallbackAnswer", peer, msg_id: messageId, data: "data" in question ? (0, _1_utilities_js_1.encodeText)(question.data) : undefined, game: question.type === "game" || undefined, password: question.type === "password" ? await this.#getPasswordCheck(question.password) : undefined });
53
53
  if (answer.cache_time >= 0) {
54
54
  await this.#c.messageStorage.setCallbackQueryAnswer(peerId, messageId, questionKey, answer);
55
55
  }
@@ -254,9 +254,9 @@ class ChatListManager {
254
254
  title = this.#checkChatTitle(title);
255
255
  const updates = await this.#c.invoke({
256
256
  _: "channels.createChannel",
257
- broadcast: type === "channel" ? true : undefined,
258
- megagroup: type === "supergroup" ? true : undefined,
259
- forum: params && ("isForum" in params) && params.isForum ? true : undefined,
257
+ broadcast: type === "channel" || undefined,
258
+ megagroup: type === "supergroup" || undefined,
259
+ forum: params && ("isForum" in params) && params.isForum || undefined,
260
260
  title,
261
261
  about: params?.description || "",
262
262
  ttl_period: params?.messageTtl || undefined,
@@ -19,8 +19,8 @@
19
19
  */
20
20
  import { Api } from "../2_tl.js";
21
21
  import { type AvailableReactions, type ChatP, type SlowModeDuration } from "../3_types.js";
22
- import { type FileSource, type ID, type Update } from "../3_types.js";
23
- import type { AddChatMemberParams, ApproveJoinRequestsParams, BanChatMemberParams, CreateInviteLinkParams, DeclineJoinRequestsParams, EnableSignaturesParams, GetCreatedInviteLinksParams, GetJoinRequestsParams, PromoteChatMemberParams, SetChatMemberRightsParams, SetChatMemberTagParams, SetChatPhotoParams } from "./0_params.js";
22
+ import { type FileSource, type ID, type ReportReason, type Update } from "../3_types.js";
23
+ import type { AddChatMemberParams, ApproveJoinRequestsParams, BanChatMemberParams, CreateInviteLinkParams, DeclineJoinRequestsParams, EnableSignaturesParams, GetCreatedInviteLinksParams, GetJoinRequestsParams, PromoteChatMemberParams, ReportChatParams, SetChatMemberRightsParams, SetChatMemberTagParams, SetChatPhotoParams } from "./0_params.js";
24
24
  import type { UpdateProcessor } from "./0_update_processor.js";
25
25
  import type { C as C_ } from "./1_types.js";
26
26
  import type { FileManager } from "./2_file_manager.js";
@@ -85,6 +85,7 @@ export declare class ChatManager implements UpdateProcessor<ChatManagerUpdate, t
85
85
  enableChatHistoryForNewMembers(chatId: ID): Promise<void>;
86
86
  disableChatHistoryForNewMembers(chatId: ID): Promise<void>;
87
87
  setDefaultSendAs(chatId: ID, sendAs: ID): Promise<void>;
88
+ reportChat(chatId: ID, reason_: ReportReason, params?: ReportChatParams): Promise<void>;
88
89
  }
89
90
  export {};
90
91
  //# sourceMappingURL=4_chat_manager.d.ts.map