@mtkruto/node 0.1.155 → 0.1.156

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 (85) hide show
  1. package/esm/4_constants.d.ts +1 -1
  2. package/esm/4_constants.js +1 -1
  3. package/esm/4_errors.d.ts +1 -1
  4. package/esm/client/0_params.d.ts +20 -0
  5. package/esm/client/0_password.d.ts +2 -2
  6. package/esm/client/0_types.d.ts +1 -0
  7. package/esm/client/1_composer.d.ts +3 -3
  8. package/esm/client/2_client_plain.d.ts +1 -4
  9. package/esm/client/2_client_plain.js +1 -4
  10. package/esm/client/2_message_manager.d.ts +9 -36
  11. package/esm/client/2_message_manager.js +73 -1
  12. package/esm/client/4_client.d.ts +90 -15
  13. package/esm/client/4_client.js +123 -12
  14. package/esm/storage/0_storage.d.ts +38 -38
  15. package/esm/storage/0_storage.js +2 -2
  16. package/esm/storage/0_utilities.d.ts +2 -2
  17. package/esm/storage/1_storage_indexed_db.d.ts +1 -1
  18. package/esm/storage/1_storage_local_storage.d.ts +1 -1
  19. package/esm/storage/1_storage_memory.d.ts +3 -3
  20. package/esm/storage/1_storage_session_storage.d.ts +1 -1
  21. package/esm/tl/0_tl_raw_writer.d.ts +9 -9
  22. package/esm/tl/1_tl_object.d.ts +1 -1
  23. package/esm/tl/1_tl_object.js +3 -3
  24. package/esm/tl/3_functions.d.ts +28 -28
  25. package/esm/tl/3_functions.js +586 -586
  26. package/esm/tl/3_utilities.d.ts +3 -3
  27. package/esm/tl/4_tl_writer.d.ts +1 -1
  28. package/esm/types/0_chat_administrator_rights.d.ts +2 -2
  29. package/esm/types/0_chat_member_rights.d.ts +1 -1
  30. package/esm/types/0_message_entity.d.ts +1 -1
  31. package/esm/types/0_message_search_filter.d.ts +2 -1
  32. package/esm/types/1_bot_command_scope.d.ts +2 -1
  33. package/esm/types/1_keyboard_button.d.ts +1 -1
  34. package/esm/types/1_story_interactive_area.d.ts +1 -1
  35. package/esm/types/2_inline_keyboard_button.d.ts +1 -1
  36. package/esm/types/2_invite_link.d.ts +6 -6
  37. package/esm/types/2_invite_link.js +4 -4
  38. package/esm/types/3_reply_markup.d.ts +2 -2
  39. package/esm/types/4_inline_query_result.d.ts +2 -1
  40. package/esm/types/4_message.d.ts +1 -60
  41. package/esm/types/5_callback_query.d.ts +2 -2
  42. package/esm/utilities/0_cache_map.d.ts +1 -1
  43. package/package.json +1 -1
  44. package/script/4_constants.d.ts +1 -1
  45. package/script/4_constants.js +1 -1
  46. package/script/4_errors.d.ts +1 -1
  47. package/script/client/0_params.d.ts +20 -0
  48. package/script/client/0_password.d.ts +2 -2
  49. package/script/client/0_types.d.ts +1 -0
  50. package/script/client/1_composer.d.ts +3 -3
  51. package/script/client/2_client_plain.d.ts +1 -4
  52. package/script/client/2_client_plain.js +1 -4
  53. package/script/client/2_message_manager.d.ts +9 -36
  54. package/script/client/2_message_manager.js +72 -0
  55. package/script/client/4_client.d.ts +90 -15
  56. package/script/client/4_client.js +123 -12
  57. package/script/storage/0_storage.d.ts +38 -38
  58. package/script/storage/0_storage.js +2 -2
  59. package/script/storage/0_utilities.d.ts +2 -2
  60. package/script/storage/1_storage_indexed_db.d.ts +1 -1
  61. package/script/storage/1_storage_local_storage.d.ts +1 -1
  62. package/script/storage/1_storage_memory.d.ts +3 -3
  63. package/script/storage/1_storage_session_storage.d.ts +1 -1
  64. package/script/tl/0_tl_raw_writer.d.ts +9 -9
  65. package/script/tl/1_tl_object.d.ts +1 -1
  66. package/script/tl/1_tl_object.js +3 -3
  67. package/script/tl/3_functions.d.ts +28 -28
  68. package/script/tl/3_functions.js +586 -586
  69. package/script/tl/3_utilities.d.ts +3 -3
  70. package/script/tl/4_tl_writer.d.ts +1 -1
  71. package/script/types/0_chat_administrator_rights.d.ts +2 -2
  72. package/script/types/0_chat_member_rights.d.ts +1 -1
  73. package/script/types/0_message_entity.d.ts +1 -1
  74. package/script/types/0_message_search_filter.d.ts +2 -1
  75. package/script/types/1_bot_command_scope.d.ts +2 -1
  76. package/script/types/1_keyboard_button.d.ts +1 -1
  77. package/script/types/1_story_interactive_area.d.ts +1 -1
  78. package/script/types/2_inline_keyboard_button.d.ts +1 -1
  79. package/script/types/2_invite_link.d.ts +6 -6
  80. package/script/types/2_invite_link.js +4 -4
  81. package/script/types/3_reply_markup.d.ts +2 -2
  82. package/script/types/4_inline_query_result.d.ts +2 -1
  83. package/script/types/4_message.d.ts +1 -60
  84. package/script/types/5_callback_query.d.ts +2 -2
  85. package/script/utilities/0_cache_map.d.ts +1 -1
@@ -1,13 +1,13 @@
1
1
  import { MaybePromise } from "../1_utilities.js";
2
- import { functions, types } from "../2_tl.js";
2
+ import { enums, functions, types } from "../2_tl.js";
3
3
  import { Storage } from "../3_storage.js";
4
4
  import { DC } from "../3_transport.js";
5
5
  import { InactiveChat } from "../3_types.js";
6
- import { BotCommand, Chat, ChatAction, ChatMember, ChatP, Document, FileSource, ID, InlineQueryResult, InputStoryContent, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageLocation, MessagePhoto, MessagePoll, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, NetworkStatistics, ParseMode, Reaction, Story, Update, UpdateIntersection, User } from "../3_types.js";
6
+ import { BotCommand, Chat, ChatAction, ChatMember, ChatP, Document, FileSource, ID, InlineQueryResult, InputStoryContent, InviteLink, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageLocation, MessagePhoto, MessagePoll, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, NetworkStatistics, ParseMode, Reaction, Story, Update, UpdateIntersection, User } from "../3_types.js";
7
7
  import { Migrate } from "../4_errors.js";
8
8
  import { ClientAbstract } from "./0_client_abstract.js";
9
9
  import { FilterQuery, WithFilter } from "./0_filters.js";
10
- import { AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, BanChatMemberParams, CreateStoryParams, DeleteMessageParams, DeleteMessagesParams, DownloadParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetChatsParams, GetHistoryParams, GetMyCommandsParams, PinMessageParams, ReplyParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams, SetMyCommandsParams, SetReactionsParams, UploadParams } from "./0_params.js";
10
+ import { AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, BanChatMemberParams, CreateInviteLinkParams, CreateStoryParams, DeleteMessageParams, DeleteMessagesParams, DownloadParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetMyCommandsParams, PinMessageParams, ReplyParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams, SetMyCommandsParams, SetReactionsParams, UploadParams } from "./0_params.js";
11
11
  import { Api } from "./0_types.js";
12
12
  import { Composer, Middleware } from "./1_composer.js";
13
13
  import { ClientPlainParams } from "./2_client_plain.js";
@@ -137,6 +137,16 @@ export interface Context {
137
137
  searchMessages: (query: string, params?: SearchMessagesParams) => Promise<Message[]>;
138
138
  /** Set the number of boosts required to circument the chat's default restrictions. */
139
139
  setBoostsRequiredToCircumventRestrictions: (boosts: number) => Promise<void>;
140
+ /** Create an invite link for the chat which the message was received from. */
141
+ createInviteLink: (params?: CreateInviteLinkParams) => Promise<InviteLink>;
142
+ /** Get the invite links that were created for the chat which the message was received from. */
143
+ getCreatedInviteLinks: (params?: GetCreatedInviteLinksParams) => Promise<InviteLink[]>;
144
+ /** Leave the chat which the message was received from. */
145
+ leave: () => Promise<void>;
146
+ /** Block the user who sent the message. User-only. */
147
+ block: () => Promise<void>;
148
+ /** Unblock the user who sent the message. */
149
+ unblock: () => Promise<void>;
140
150
  toJSON: () => Update;
141
151
  }
142
152
  export declare function skipInvoke<C extends Context>(): InvokeErrorHandler<Client<C>>;
@@ -237,10 +247,10 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
237
247
  * @param function_ The function to invoke.
238
248
  */
239
249
  invoke: {
240
- <T extends import("../tl/2_types.js").Type_ | functions.Function<unknown> = functions.Function<unknown>>(function_: T): Promise<T extends functions.Function<unknown> ? T["__R"] : void>;
241
- <T_1 extends import("../tl/2_types.js").Type_ | functions.Function<unknown> = functions.Function<unknown>>(function_: T_1, noWait: true): Promise<void>;
242
- } & {
243
- use: (handler: InvokeErrorHandler<Client<C>>) => void;
250
+ <T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T): Promise<T extends functions.Function<unknown> ? T["__R"] : void>;
251
+ <T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T, noWait: true): Promise<void>;
252
+ <T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T, noWait?: boolean): Promise<T | void>;
253
+ use(handler: InvokeErrorHandler<Client<C>>): void;
244
254
  };
245
255
  /**
246
256
  * Alias for `invoke` with its second parameter being `true`.
@@ -248,22 +258,22 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
248
258
  send<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T): Promise<void>;
249
259
  exportAuthString(): Promise<string>;
250
260
  importAuthString(authString: string): Promise<void>;
251
- getInputPeer(id: ID): Promise<import("../tl/2_types.js").InputPeerSelf_ | import("../tl/2_types.js").InputPeerChat_ | import("../tl/2_types.js").InputPeerUser_ | import("../tl/2_types.js").InputPeerChannel_>;
252
- getInputChannel(id: ID): Promise<import("../tl/2_types.js").InputChannel_>;
253
- getInputUser(id: ID): Promise<import("../tl/2_types.js").InputUser_>;
261
+ getInputPeer(id: ID): Promise<enums.InputPeer>;
262
+ getInputChannel(id: ID): Promise<types.InputChannel>;
263
+ getInputUser(id: ID): Promise<types.InputUser>;
254
264
  private [getEntity];
255
265
  private [getEntity];
256
266
  private [getEntity];
257
267
  private [getEntity];
258
- use(...middleware: Middleware<UpdateIntersection<C>>[]): Composer<UpdateIntersection<C>>;
259
- branch(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, trueHandler_: Middleware<UpdateIntersection<C>>, falseHandler_: Middleware<UpdateIntersection<C>>): Composer<UpdateIntersection<C>>;
268
+ use(...middleware: Middleware<UpdateIntersection<C>>[]): Composer<C>;
269
+ branch(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, trueHandler_: Middleware<UpdateIntersection<C>>, falseHandler_: Middleware<UpdateIntersection<C>>): Composer<C>;
260
270
  filter<D extends C>(predicate: (ctx: UpdateIntersection<C>) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
261
271
  filter(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, ...middleware: Middleware<UpdateIntersection<C>>[]): Composer<C>;
262
272
  on<Q extends FilterQuery>(filter: Q, ...middleawre: Middleware<WithFilter<C, Q>>[]): Composer<UpdateIntersection<WithFilter<C, Q>>>;
263
273
  command(commands: string | RegExp | (string | RegExp)[] | {
264
274
  names: string | RegExp | (string | RegExp)[];
265
275
  prefixes: string | string[];
266
- }, ...middleawre: Middleware<WithFilter<C, "message:text">>[]): Composer<UpdateIntersection<WithFilter<C, "message:text">>>;
276
+ }, ...middleawre: Middleware<WithFilter<C, "message:text">>[]): Composer<WithFilter<C, "message:text">>;
267
277
  /**
268
278
  * Send a text message.
269
279
  *
@@ -403,8 +413,9 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
403
413
  *
404
414
  * @method fs
405
415
  * @param contents The contents of the file.
416
+ * @returns The uploaded file.
406
417
  */
407
- upload(contents: Uint8Array, params?: UploadParams): Promise<import("../tl/2_types.js").InputFile_ | import("../tl/2_types.js").InputFileBig_>;
418
+ upload(contents: Uint8Array, params?: UploadParams): Promise<any>;
408
419
  /**
409
420
  * Set the bot's commands in the given scope and/or language. Bot-only.
410
421
  *
@@ -416,6 +427,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
416
427
  * Get the bot's commands in the given scope and/or language. Bot-only.
417
428
  *
418
429
  * @method bs
430
+ * @returns The current bot's commands in the specified language.
419
431
  */
420
432
  getMyCommands(params?: GetMyCommandsParams): Promise<BotCommand[]>;
421
433
  /**
@@ -457,14 +469,16 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
457
469
  * Get the bot's description in the given language. Bot-only.
458
470
  *
459
471
  * @method bs
472
+ * @returns The current bot's description in the specified language.
460
473
  */
461
474
  getMyDescription(params?: {
462
475
  languageCode?: string;
463
476
  }): Promise<string>;
464
477
  /**
465
- * Set the bot's name in the given language. Bot-only.
478
+ * Get the bot's name in the given language. Bot-only.
466
479
  *
467
480
  * @method bs
481
+ * @returns The current bot's name in the specified language.
468
482
  */
469
483
  getMyName(params?: {
470
484
  languageCode?: string;
@@ -473,6 +487,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
473
487
  * Get the bot's short description in the given language. Bot-only.
474
488
  *
475
489
  * @method bs
490
+ * @returns The current bot's short description in the specified language.
476
491
  */
477
492
  getMyShortDescription(params?: {
478
493
  languageCode?: string;
@@ -499,6 +514,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
499
514
  * @method ms
500
515
  * @param chatId The chat to send the photo to.
501
516
  * @param photo The photo to send.
517
+ * @returns The sent photo.
502
518
  */
503
519
  sendPhoto(chatId: ID, photo: FileSource, params?: SendPhotoParams): Promise<MessagePhoto>;
504
520
  /**
@@ -507,6 +523,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
507
523
  * @method ms
508
524
  * @param chatId The chat to send the document to.
509
525
  * @param document The document to send.
526
+ * @returns The sent document.
510
527
  */
511
528
  sendDocument(chatId: ID, document: FileSource, params?: SendDocumentParams): Promise<MessageDocument>;
512
529
  /**
@@ -515,6 +532,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
515
532
  * @method ms
516
533
  * @param chatId The chat to send the video to.
517
534
  * @param video The video to send.
535
+ * @returns The sent video.
518
536
  */
519
537
  sendVideo(chatId: ID, video: FileSource, params?: SendVideoParams): Promise<MessageVideo>;
520
538
  /**
@@ -523,6 +541,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
523
541
  * @method ms
524
542
  * @param chatId The chat to send the animation to.
525
543
  * @param animation The animation to send.
544
+ * @returns The sent animation.
526
545
  */
527
546
  sendAnimation(chatId: ID, animation: FileSource, params?: SendAnimationParams): Promise<MessageAnimation>;
528
547
  /**
@@ -531,6 +550,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
531
550
  * @method ms
532
551
  * @param chatId The chat to send the voice message to.
533
552
  * @param voice The voice to send.
553
+ * @returns The sent voice message.
534
554
  */
535
555
  sendVoice(chatId: ID, voice: FileSource, params?: SendVoiceParams): Promise<MessageVoice>;
536
556
  /**
@@ -539,6 +559,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
539
559
  * @method ms
540
560
  * @param chatId The chat to send the audio file to.
541
561
  * @param audio The audio to send.
562
+ * @returns The sent audio filr.
542
563
  */
543
564
  sendAudio(chatId: ID, audio: FileSource, params?: SendAudioParams): Promise<MessageAudio>;
544
565
  /**
@@ -547,6 +568,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
547
568
  * @method ms
548
569
  * @param chatId The chat to send the video note to.
549
570
  * @param videoNote The video note to send.
571
+ * @returns The sent video note.
550
572
  */
551
573
  sendVideoNote(chatId: ID, videoNote: FileSource, params?: SendVideoNoteParams): Promise<MessageVideoNote>;
552
574
  /**
@@ -556,6 +578,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
556
578
  * @param chatId The chat to send the location to.
557
579
  * @param latitude The location's latitude.
558
580
  * @param longitude The location's longitude.
581
+ * @returns The sent location.
559
582
  */
560
583
  sendLocation(chatId: ID, latitude: number, longitude: number, params?: SendLocationParams): Promise<MessageLocation>;
561
584
  /**
@@ -565,6 +588,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
565
588
  * @param chatId The chat to send the contact to.
566
589
  * @param firstName The contact's first name.
567
590
  * @param number The contact's phone number.
591
+ * @returns The sent contact.
568
592
  */
569
593
  sendContact(chatId: ID, firstName: string, number: string, params?: SendContactParams): Promise<MessageContact>;
570
594
  /**
@@ -572,6 +596,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
572
596
  *
573
597
  * @method ms
574
598
  * @param chatId The chat to send the dice to.
599
+ * @returns The sent dice.
575
600
  */
576
601
  sendDice(chatId: ID, params?: SendDiceParams): Promise<MessageDice>;
577
602
  /**
@@ -583,6 +608,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
583
608
  * @param longitude The longitude of the venue.
584
609
  * @param title The title of the venue.
585
610
  * @param address The written address of the venue.
611
+ * @returns The sent venue.
586
612
  */
587
613
  sendVenue(chatId: ID, latitude: number, longitude: number, title: string, address: string, params?: SendVenueParams): Promise<MessageVenue>;
588
614
  /**
@@ -615,6 +641,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
615
641
  *
616
642
  * @method fs
617
643
  * @param id Identifier of one or more of custom emojis.
644
+ * @returns The custom emoji documents.
618
645
  */
619
646
  getCustomEmojiDocuments(id: string | string[]): Promise<Document[]>;
620
647
  /**
@@ -735,6 +762,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
735
762
  *
736
763
  * @method ch
737
764
  * @param chatId The identifier of the chat.
765
+ * @returns The chat's administrators.
738
766
  */
739
767
  getChatAdministrators(chatId: ID): Promise<ChatMember[]>;
740
768
  /**
@@ -759,6 +787,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
759
787
  * @method st
760
788
  * @param chatId The identifier of the chat to retrieve the story from.
761
789
  * @param storyId The identifier of the story to retrieve.
790
+ * @returns The retrieved story.
762
791
  */
763
792
  getStory(chatId: ID, storyId: number): Promise<Story | null>;
764
793
  /**
@@ -845,6 +874,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
845
874
  * @method ac
846
875
  * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
847
876
  * @param order The new order to use.
877
+ * @returns Whether the order was changed.
848
878
  */
849
879
  reorderUsernames(id: ID, order: string[]): Promise<boolean>;
850
880
  /**
@@ -858,6 +888,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
858
888
  * Get inactive chats. User-only.
859
889
  *
860
890
  * @method ch
891
+ * @retuns A list of inactive chats the current user is member of.
861
892
  */
862
893
  getInactiveChats(): Promise<InactiveChat[]>;
863
894
  /**
@@ -876,5 +907,49 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
876
907
  * @param boosts The number of boosts required to circumvent its restrictions.
877
908
  */
878
909
  setBoostsRequiredToCircumventRestrictions(chatId: ID, boosts: number): Promise<void>;
910
+ /**
911
+ * Create an invite link.
912
+ *
913
+ * @method ch
914
+ * @param chatId The identifier of the chat to create the invite link for.
915
+ * @returns The newly created invite link.
916
+ */
917
+ createInviteLink(chatId: ID, params?: CreateInviteLinkParams): Promise<InviteLink>;
918
+ /**
919
+ * Get the invite links created for a chat. User-only.
920
+ *
921
+ * @method ch
922
+ * @param chatId The identifier of the chat.
923
+ * @returns The invite links created for the chat. This might be a subset of the results if they were less than `limit`. The parameters `afterDate` and `afterInviteLink` can be used for pagination.
924
+ */
925
+ getCreatedInviteLinks(chatId: ID, params?: GetCreatedInviteLinksParams): Promise<InviteLink[]>;
926
+ /**
927
+ * Join a chat. User-only.
928
+ *
929
+ * @method ch
930
+ * @param chatId The identifier of the chat to join.
931
+ */
932
+ joinChat(chatId: ID): Promise<void>;
933
+ /**
934
+ * Leave a chat.
935
+ *
936
+ * @method ch
937
+ * @param chatId The identifier of the chat to leave.
938
+ */
939
+ leaveChat(chatId: ID): Promise<void>;
940
+ /**
941
+ * Block a user. User-only.
942
+ *
943
+ * @method mc
944
+ * @param userId The identifier of the user to block.
945
+ */
946
+ blockUser(userId: ID): Promise<void>;
947
+ /**
948
+ * Unblock a user. User-only.
949
+ *
950
+ * @method mc
951
+ * @param userId The identifier of the user to unblock.
952
+ */
953
+ unblockUser(userId: ID): Promise<void>;
879
954
  }
880
955
  export {};
@@ -41,13 +41,13 @@ const _3_inline_query_manager_js_1 = require("./3_inline_query_manager.js");
41
41
  const _3_story_manager_js_1 = require("./3_story_manager.js");
42
42
  let id = 0;
43
43
  const getEntity = Symbol();
44
- exports.handleMigrationError = Symbol();
44
+ exports.handleMigrationError = Symbol("handleMigrationError");
45
45
  const functionNamespaces = Object.entries(_2_tl_js_1.functions).filter(([, v]) => !(v instanceof Function)).map(([k]) => k);
46
46
  function skipInvoke() {
47
47
  return (_ctx, next) => next();
48
48
  }
49
49
  exports.skipInvoke = skipInvoke;
50
- exports.restartAuth = Symbol();
50
+ exports.restartAuth = Symbol("restartAuth");
51
51
  class Client extends _0_client_abstract_js_1.ClientAbstract {
52
52
  /**
53
53
  * Constructs the client.
@@ -220,6 +220,20 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
220
220
  (0, _1_utilities_js_1.UNREACHABLE)();
221
221
  }
222
222
  };
223
+ const mustGetUserId = () => {
224
+ if (msg?.from) {
225
+ return msg.from.id;
226
+ }
227
+ else if ("callbackQuery" in update) {
228
+ return update.callbackQuery.from.id;
229
+ }
230
+ else if ("chosenInlineResult" in update) {
231
+ return update.chosenInlineResult.from.id;
232
+ }
233
+ else {
234
+ (0, _1_utilities_js_1.UNREACHABLE)();
235
+ }
236
+ };
223
237
  const mustGetInlineMsgId = () => {
224
238
  if ("chosenInlineResult" in update) {
225
239
  if (update.chosenInlineResult.inlineMessageId) {
@@ -485,6 +499,24 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
485
499
  const { chatId } = mustGetMsg();
486
500
  return this.setBoostsRequiredToCircumventRestrictions(chatId, boosts);
487
501
  },
502
+ createInviteLink: (params) => {
503
+ const { chatId } = mustGetMsg();
504
+ return this.createInviteLink(chatId, params);
505
+ },
506
+ getCreatedInviteLinks: (params) => {
507
+ const { chatId } = mustGetMsg();
508
+ return this.getCreatedInviteLinks(chatId, params);
509
+ },
510
+ leave: () => {
511
+ const { chatId } = mustGetMsg();
512
+ return this.leaveChat(chatId);
513
+ },
514
+ block: () => {
515
+ return this.blockUser(mustGetUserId());
516
+ },
517
+ unblock: () => {
518
+ return this.unblockUser(mustGetUserId());
519
+ },
488
520
  };
489
521
  return (0, _1_utilities_js_1.cleanObject)(context);
490
522
  });
@@ -586,6 +618,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
586
618
  getSelfId: __classPrivateFieldGet(this, _Client_instances, "m", _Client_getSelfId).bind(this),
587
619
  getInputPeer: this.getInputPeer.bind(this),
588
620
  getInputChannel: this.getInputChannel.bind(this),
621
+ getInputUser: this.getInputUser.bind(this),
589
622
  getEntity: this[getEntity].bind(this),
590
623
  handleUpdate: __classPrivateFieldGet(this, _Client_instances, "m", _Client_queueHandleCtxUpdate).bind(this),
591
624
  parseMode: __classPrivateFieldGet(this, _Client_parseMode, "f"),
@@ -730,7 +763,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
730
763
  plain.setDc(dc);
731
764
  }
732
765
  await plain.connect();
733
- const { authKey, salt } = await plain.createAuthKey();
766
+ const [authKey, salt] = await plain.createAuthKey();
734
767
  await plain.disconnect();
735
768
  await this.storage.setAuthKey(authKey);
736
769
  await __classPrivateFieldGet(this, _Client_instances, "m", _Client_setAuth).call(this, authKey);
@@ -1462,7 +1495,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1462
1495
  * @param inlineMessageId The inline message's identifier.
1463
1496
  */
1464
1497
  async editInlineMessageReplyMarkup(inlineMessageId, params) {
1465
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").editInlineMessageReplyMarkup(inlineMessageId, params);
1498
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").editInlineMessageReplyMarkup(inlineMessageId, params);
1466
1499
  }
1467
1500
  /**
1468
1501
  * Retrieve multiple messages.
@@ -1577,14 +1610,16 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1577
1610
  * @param messageThreadId The thread to send the chat action to.
1578
1611
  */
1579
1612
  async sendChatAction(chatId, action, params) {
1580
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendChatAction(chatId, action, params);
1613
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").sendChatAction(chatId, action, params);
1581
1614
  }
1582
1615
  /**
1583
1616
  * Upload a file.
1584
1617
  *
1585
1618
  * @method fs
1586
1619
  * @param contents The contents of the file.
1620
+ * @returns The uploaded file.
1587
1621
  */
1622
+ // deno-lint-ignore no-explicit-any
1588
1623
  async upload(contents, params) {
1589
1624
  return await __classPrivateFieldGet(this, _Client_fileManager, "f").upload(contents, params);
1590
1625
  }
@@ -1601,6 +1636,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1601
1636
  * Get the bot's commands in the given scope and/or language. Bot-only.
1602
1637
  *
1603
1638
  * @method bs
1639
+ * @returns The current bot's commands in the specified language.
1604
1640
  */
1605
1641
  async getMyCommands(params) {
1606
1642
  return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyCommands(params);
@@ -1643,14 +1679,16 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1643
1679
  * Get the bot's description in the given language. Bot-only.
1644
1680
  *
1645
1681
  * @method bs
1682
+ * @returns The current bot's description in the specified language.
1646
1683
  */
1647
1684
  async getMyDescription(params) {
1648
1685
  return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyDescription(params);
1649
1686
  }
1650
1687
  /**
1651
- * Set the bot's name in the given language. Bot-only.
1688
+ * Get the bot's name in the given language. Bot-only.
1652
1689
  *
1653
1690
  * @method bs
1691
+ * @returns The current bot's name in the specified language.
1654
1692
  */
1655
1693
  async getMyName(params) {
1656
1694
  return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyName(params);
@@ -1659,6 +1697,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1659
1697
  * Get the bot's short description in the given language. Bot-only.
1660
1698
  *
1661
1699
  * @method bs
1700
+ * @returns The current bot's short description in the specified language.
1662
1701
  */
1663
1702
  async getMyShortDescription(params) {
1664
1703
  return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyShortDescription(params);
@@ -1671,7 +1710,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1671
1710
  * @param messageIds The identifiers of the messages to delete.
1672
1711
  */
1673
1712
  async deleteMessages(chatId, messageIds, params) {
1674
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, messageIds, params);
1713
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, messageIds, params);
1675
1714
  }
1676
1715
  /**
1677
1716
  * Delete a single message.
@@ -1681,7 +1720,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1681
1720
  * @param messageId The identifier of the message to delete.
1682
1721
  */
1683
1722
  async deleteMessage(chatId, messageId, params) {
1684
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, [messageId], params);
1723
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, [messageId], params);
1685
1724
  }
1686
1725
  /**
1687
1726
  * Send a photo.
@@ -1689,6 +1728,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1689
1728
  * @method ms
1690
1729
  * @param chatId The chat to send the photo to.
1691
1730
  * @param photo The photo to send.
1731
+ * @returns The sent photo.
1692
1732
  */
1693
1733
  async sendPhoto(chatId, photo, params) {
1694
1734
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendPhoto(chatId, photo, params);
@@ -1699,6 +1739,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1699
1739
  * @method ms
1700
1740
  * @param chatId The chat to send the document to.
1701
1741
  * @param document The document to send.
1742
+ * @returns The sent document.
1702
1743
  */
1703
1744
  async sendDocument(chatId, document, params) {
1704
1745
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDocument(chatId, document, params);
@@ -1709,6 +1750,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1709
1750
  * @method ms
1710
1751
  * @param chatId The chat to send the video to.
1711
1752
  * @param video The video to send.
1753
+ * @returns The sent video.
1712
1754
  */
1713
1755
  async sendVideo(chatId, video, params) {
1714
1756
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideo(chatId, video, params);
@@ -1719,6 +1761,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1719
1761
  * @method ms
1720
1762
  * @param chatId The chat to send the animation to.
1721
1763
  * @param animation The animation to send.
1764
+ * @returns The sent animation.
1722
1765
  */
1723
1766
  async sendAnimation(chatId, animation, params) {
1724
1767
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAnimation(chatId, animation, params);
@@ -1729,6 +1772,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1729
1772
  * @method ms
1730
1773
  * @param chatId The chat to send the voice message to.
1731
1774
  * @param voice The voice to send.
1775
+ * @returns The sent voice message.
1732
1776
  */
1733
1777
  async sendVoice(chatId, voice, params) {
1734
1778
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVoice(chatId, voice, params);
@@ -1739,6 +1783,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1739
1783
  * @method ms
1740
1784
  * @param chatId The chat to send the audio file to.
1741
1785
  * @param audio The audio to send.
1786
+ * @returns The sent audio filr.
1742
1787
  */
1743
1788
  async sendAudio(chatId, audio, params) {
1744
1789
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAudio(chatId, audio, params);
@@ -1749,6 +1794,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1749
1794
  * @method ms
1750
1795
  * @param chatId The chat to send the video note to.
1751
1796
  * @param videoNote The video note to send.
1797
+ * @returns The sent video note.
1752
1798
  */
1753
1799
  async sendVideoNote(chatId, videoNote, params) {
1754
1800
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideoNote(chatId, videoNote, params);
@@ -1760,6 +1806,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1760
1806
  * @param chatId The chat to send the location to.
1761
1807
  * @param latitude The location's latitude.
1762
1808
  * @param longitude The location's longitude.
1809
+ * @returns The sent location.
1763
1810
  */
1764
1811
  async sendLocation(chatId, latitude, longitude, params) {
1765
1812
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendLocation(chatId, latitude, longitude, params);
@@ -1771,6 +1818,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1771
1818
  * @param chatId The chat to send the contact to.
1772
1819
  * @param firstName The contact's first name.
1773
1820
  * @param number The contact's phone number.
1821
+ * @returns The sent contact.
1774
1822
  */
1775
1823
  async sendContact(chatId, firstName, number, params) {
1776
1824
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendContact(chatId, firstName, number, params);
@@ -1780,6 +1828,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1780
1828
  *
1781
1829
  * @method ms
1782
1830
  * @param chatId The chat to send the dice to.
1831
+ * @returns The sent dice.
1783
1832
  */
1784
1833
  async sendDice(chatId, params) {
1785
1834
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDice(chatId, params);
@@ -1793,6 +1842,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1793
1842
  * @param longitude The longitude of the venue.
1794
1843
  * @param title The title of the venue.
1795
1844
  * @param address The written address of the venue.
1845
+ * @returns The sent venue.
1796
1846
  */
1797
1847
  async sendVenue(chatId, latitude, longitude, title, address, params) {
1798
1848
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVenue(chatId, latitude, longitude, title, address, params);
@@ -1835,6 +1885,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1835
1885
  *
1836
1886
  * @method fs
1837
1887
  * @param id Identifier of one or more of custom emojis.
1888
+ * @returns The custom emoji documents.
1838
1889
  */
1839
1890
  async getCustomEmojiDocuments(id) {
1840
1891
  return await __classPrivateFieldGet(this, _Client_fileManager, "f").getCustomEmojiDocuments(id);
@@ -1909,7 +1960,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1909
1960
  * @param memberId The identifier of the member.
1910
1961
  */
1911
1962
  async deleteChatMemberMessages(chatId, memberId) {
1912
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatMemberMessages(chatId, memberId);
1963
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatMemberMessages(chatId, memberId);
1913
1964
  }
1914
1965
  /**
1915
1966
  * Pin a message in a chat.
@@ -1919,7 +1970,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1919
1970
  * @param messageId The message's identifier.
1920
1971
  */
1921
1972
  async pinMessage(chatId, messageId, params) {
1922
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").pinMessage(chatId, messageId, params);
1973
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").pinMessage(chatId, messageId, params);
1923
1974
  }
1924
1975
  /**
1925
1976
  * Unpin a pinned message.
@@ -1929,7 +1980,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1929
1980
  * @param messageId The message's identifier.
1930
1981
  */
1931
1982
  async unpinMessage(chatId, messageId) {
1932
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessage(chatId, messageId);
1983
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessage(chatId, messageId);
1933
1984
  }
1934
1985
  /**
1935
1986
  * Unpin all pinned messages.
@@ -1938,7 +1989,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1938
1989
  * @param chatId The identifier of the chat.
1939
1990
  */
1940
1991
  async unpinMessages(chatId) {
1941
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessages(chatId);
1992
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessages(chatId);
1942
1993
  }
1943
1994
  /**
1944
1995
  * Ban a member from a chat.
@@ -1986,6 +2037,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
1986
2037
  *
1987
2038
  * @method ch
1988
2039
  * @param chatId The identifier of the chat.
2040
+ * @returns The chat's administrators.
1989
2041
  */
1990
2042
  async getChatAdministrators(chatId) {
1991
2043
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").getChatAdministrators(chatId);
@@ -2019,6 +2071,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
2019
2071
  * @method st
2020
2072
  * @param chatId The identifier of the chat to retrieve the story from.
2021
2073
  * @param storyId The identifier of the story to retrieve.
2074
+ * @returns The retrieved story.
2022
2075
  */
2023
2076
  async getStory(chatId, storyId) {
2024
2077
  return await __classPrivateFieldGet(this, _Client_storyManager, "f").getStory(chatId, storyId);
@@ -2127,6 +2180,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
2127
2180
  * @method ac
2128
2181
  * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
2129
2182
  * @param order The new order to use.
2183
+ * @returns Whether the order was changed.
2130
2184
  */
2131
2185
  async reorderUsernames(id, order) {
2132
2186
  return await __classPrivateFieldGet(this, _Client_accountManager, "f").reorderUsernames(id, order);
@@ -2144,6 +2198,7 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
2144
2198
  * Get inactive chats. User-only.
2145
2199
  *
2146
2200
  * @method ch
2201
+ * @retuns A list of inactive chats the current user is member of.
2147
2202
  */
2148
2203
  async getInactiveChats() {
2149
2204
  return await __classPrivateFieldGet(this, _Client_accountManager, "f").getInactiveChats();
@@ -2168,6 +2223,62 @@ class Client extends _0_client_abstract_js_1.ClientAbstract {
2168
2223
  async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
2169
2224
  await __classPrivateFieldGet(this, _Client_messageManager, "f").setBoostsRequiredToCircumventRestrictions(chatId, boosts);
2170
2225
  }
2226
+ /**
2227
+ * Create an invite link.
2228
+ *
2229
+ * @method ch
2230
+ * @param chatId The identifier of the chat to create the invite link for.
2231
+ * @returns The newly created invite link.
2232
+ */
2233
+ async createInviteLink(chatId, params) {
2234
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").createInviteLink(chatId, params);
2235
+ }
2236
+ /**
2237
+ * Get the invite links created for a chat. User-only.
2238
+ *
2239
+ * @method ch
2240
+ * @param chatId The identifier of the chat.
2241
+ * @returns The invite links created for the chat. This might be a subset of the results if they were less than `limit`. The parameters `afterDate` and `afterInviteLink` can be used for pagination.
2242
+ */
2243
+ async getCreatedInviteLinks(chatId, params) {
2244
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").getCreatedInviteLinks(chatId, params);
2245
+ }
2246
+ /**
2247
+ * Join a chat. User-only.
2248
+ *
2249
+ * @method ch
2250
+ * @param chatId The identifier of the chat to join.
2251
+ */
2252
+ async joinChat(chatId) {
2253
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").joinChat(chatId);
2254
+ }
2255
+ /**
2256
+ * Leave a chat.
2257
+ *
2258
+ * @method ch
2259
+ * @param chatId The identifier of the chat to leave.
2260
+ */
2261
+ async leaveChat(chatId) {
2262
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").leaveChat(chatId);
2263
+ }
2264
+ /**
2265
+ * Block a user. User-only.
2266
+ *
2267
+ * @method mc
2268
+ * @param userId The identifier of the user to block.
2269
+ */
2270
+ async blockUser(userId) {
2271
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").blockUser(userId);
2272
+ }
2273
+ /**
2274
+ * Unblock a user. User-only.
2275
+ *
2276
+ * @method mc
2277
+ * @param userId The identifier of the user to unblock.
2278
+ */
2279
+ async unblockUser(userId) {
2280
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unblockUser(userId);
2281
+ }
2171
2282
  }
2172
2283
  exports.Client = Client;
2173
2284
  _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(update) {