@mtkruto/node 0.1.130 → 0.1.131

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.
@@ -4,7 +4,7 @@ export type PublicKeys = readonly [bigint, [bigint, bigint]][];
4
4
  export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const INITIAL_DC: DC;
6
6
  export declare const LAYER = 167;
7
- export declare const APP_VERSION = "MTKruto 0.1.130";
7
+ export declare const APP_VERSION = "MTKruto 0.1.131";
8
8
  export declare const DEVICE_MODEL: string;
9
9
  export declare const LANG_CODE: string;
10
10
  export declare const LANG_PACK = "";
@@ -53,7 +53,7 @@ export const PUBLIC_KEYS = Object.freeze([
53
53
  ]);
54
54
  export const INITIAL_DC = "2";
55
55
  export const LAYER = 167;
56
- export const APP_VERSION = "MTKruto 0.1.130";
56
+ export const APP_VERSION = "MTKruto 0.1.131";
57
57
  // @ts-ignore: lib
58
58
  export const DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
59
59
  export const LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -242,7 +242,7 @@ export interface DeleteMessageParams {
242
242
  onlyForMe?: boolean;
243
243
  }
244
244
  export interface SendPhotoParams {
245
- /** The file name to assign. */
245
+ /** The file name to assign if applicable. */
246
246
  fileName?: string;
247
247
  /** Size of each upload chunk in bytes. */
248
248
  chunkSize?: number;
@@ -335,6 +335,367 @@ export interface SendDocumentParams {
335
335
  */
336
336
  replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
337
337
  }
338
+ export interface SendVideoParams {
339
+ /** The duration of the video in seconds. */
340
+ duration?: number;
341
+ width?: number;
342
+ height?: number;
343
+ supportsStreaming?: boolean;
344
+ /** The file name to assign if applicable. */
345
+ fileName?: string;
346
+ /** The mime type to assign. */
347
+ mimeType?: string;
348
+ /** Size of each upload chunk in bytes. */
349
+ chunkSize?: number;
350
+ /** Upload abort signal. */
351
+ signal?: AbortSignal | null;
352
+ /** The caption of the document. */
353
+ caption?: string;
354
+ /**
355
+ * The caption's entities.
356
+ */
357
+ captionEntities?: MessageEntity[];
358
+ /**
359
+ * The parse mode to use for the caption. If not provided, the default parse mode will be used.
360
+ */
361
+ parseMode?: ParseMode;
362
+ /**
363
+ * Whether to mark the video as a spoiler.
364
+ */
365
+ hasSpoiler?: boolean;
366
+ /**
367
+ * Whether to send the message in a silent way without making a sound on the recipients' clients.
368
+ */
369
+ disableNotification?: boolean;
370
+ /**
371
+ * Whether to protect the contents of the message from copying and forwarding.
372
+ */
373
+ protectContent?: boolean;
374
+ /**
375
+ * The identifier of a message to reply to.
376
+ */
377
+ replyToMessageId?: number;
378
+ /**
379
+ * The identifier of a thread to send the message to.
380
+ */
381
+ messageThreadId?: number;
382
+ /**
383
+ * The identifier of the chat to send the message on behalf of. User-only.
384
+ */
385
+ sendAs?: ChatID;
386
+ /**
387
+ * The reply markup of the message. Bot-only.
388
+ */
389
+ replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
390
+ }
391
+ export interface SendAnimationParams {
392
+ /** The duration of the animation in seconds. */
393
+ duration?: number;
394
+ width?: number;
395
+ height?: number;
396
+ /** The file name to assign if applicable. */
397
+ fileName?: string;
398
+ /** The mime type to assign. */
399
+ mimeType?: string;
400
+ /** Size of each upload chunk in bytes. */
401
+ chunkSize?: number;
402
+ /** Upload abort signal. */
403
+ signal?: AbortSignal | null;
404
+ /** The caption of the document. */
405
+ caption?: string;
406
+ /**
407
+ * The caption's entities.
408
+ */
409
+ captionEntities?: MessageEntity[];
410
+ /**
411
+ * The parse mode to use for the caption. If not provided, the default parse mode will be used.
412
+ */
413
+ parseMode?: ParseMode;
414
+ /**
415
+ * Whether to mark the animation as a spoiler.
416
+ */
417
+ hasSpoiler?: boolean;
418
+ /**
419
+ * Whether to send the message in a silent way without making a sound on the recipients' clients.
420
+ */
421
+ disableNotification?: boolean;
422
+ /**
423
+ * Whether to protect the contents of the message from copying and forwarding.
424
+ */
425
+ protectContent?: boolean;
426
+ /**
427
+ * The identifier of a message to reply to.
428
+ */
429
+ replyToMessageId?: number;
430
+ /**
431
+ * The identifier of a thread to send the message to.
432
+ */
433
+ messageThreadId?: number;
434
+ /**
435
+ * The identifier of the chat to send the message on behalf of. User-only.
436
+ */
437
+ sendAs?: ChatID;
438
+ /**
439
+ * The reply markup of the message. Bot-only.
440
+ */
441
+ replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
442
+ }
443
+ export interface SendVoiceParams {
444
+ /** The duration of the voice message in seconds. */
445
+ duration?: number;
446
+ /** The file name to assign if applicable. */
447
+ fileName?: string;
448
+ /** The mime type to assign. */
449
+ mimeType?: string;
450
+ /** Size of each upload chunk in bytes. */
451
+ chunkSize?: number;
452
+ /** Upload abort signal. */
453
+ signal?: AbortSignal | null;
454
+ /** The caption of the document. */
455
+ caption?: string;
456
+ /**
457
+ * The caption's entities.
458
+ */
459
+ captionEntities?: MessageEntity[];
460
+ /**
461
+ * The parse mode to use for the caption. If not provided, the default parse mode will be used.
462
+ */
463
+ parseMode?: ParseMode;
464
+ /**
465
+ * Whether to send the message in a silent way without making a sound on the recipients' clients.
466
+ */
467
+ disableNotification?: boolean;
468
+ /**
469
+ * Whether to protect the contents of the message from copying and forwarding.
470
+ */
471
+ protectContent?: boolean;
472
+ /**
473
+ * The identifier of a message to reply to.
474
+ */
475
+ replyToMessageId?: number;
476
+ /**
477
+ * The identifier of a thread to send the message to.
478
+ */
479
+ messageThreadId?: number;
480
+ /**
481
+ * The identifier of the chat to send the message on behalf of. User-only.
482
+ */
483
+ sendAs?: ChatID;
484
+ /**
485
+ * The reply markup of the message. Bot-only.
486
+ */
487
+ replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
488
+ }
489
+ export interface SendAudioParams {
490
+ /** The duration of the audio file in seconds. */
491
+ duration?: number;
492
+ performer?: string;
493
+ title?: string;
494
+ /** The file name to assign if applicable. */
495
+ fileName?: string;
496
+ /** The mime type to assign. */
497
+ mimeType?: string;
498
+ /** Size of each upload chunk in bytes. */
499
+ chunkSize?: number;
500
+ /** Upload abort signal. */
501
+ signal?: AbortSignal | null;
502
+ /** The caption of the document. */
503
+ caption?: string;
504
+ /**
505
+ * The caption's entities.
506
+ */
507
+ captionEntities?: MessageEntity[];
508
+ /**
509
+ * The parse mode to use for the caption. If not provided, the default parse mode will be used.
510
+ */
511
+ parseMode?: ParseMode;
512
+ /**
513
+ * Whether to send the message in a silent way without making a sound on the recipients' clients.
514
+ */
515
+ disableNotification?: boolean;
516
+ /**
517
+ * Whether to protect the contents of the message from copying and forwarding.
518
+ */
519
+ protectContent?: boolean;
520
+ /**
521
+ * The identifier of a message to reply to.
522
+ */
523
+ replyToMessageId?: number;
524
+ /**
525
+ * The identifier of a thread to send the message to.
526
+ */
527
+ messageThreadId?: number;
528
+ /**
529
+ * The identifier of the chat to send the message on behalf of. User-only.
530
+ */
531
+ sendAs?: ChatID;
532
+ /**
533
+ * The reply markup of the message. Bot-only.
534
+ */
535
+ replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
536
+ }
537
+ export interface SendVideoNoteParams {
538
+ /** The duration of the video note in seconds. */
539
+ duration?: number;
540
+ length?: number;
541
+ /** The file name to assign if applicable. */
542
+ fileName?: string;
543
+ /** The mime type to assign. */
544
+ mimeType?: string;
545
+ /** Size of each upload chunk in bytes. */
546
+ chunkSize?: number;
547
+ /** Upload abort signal. */
548
+ signal?: AbortSignal | null;
549
+ /** The caption of the document. */
550
+ caption?: string;
551
+ /**
552
+ * The caption's entities.
553
+ */
554
+ captionEntities?: MessageEntity[];
555
+ /**
556
+ * The parse mode to use for the caption. If not provided, the default parse mode will be used.
557
+ */
558
+ parseMode?: ParseMode;
559
+ /**
560
+ * Whether to send the message in a silent way without making a sound on the recipients' clients.
561
+ */
562
+ disableNotification?: boolean;
563
+ /**
564
+ * Whether to protect the contents of the message from copying and forwarding.
565
+ */
566
+ protectContent?: boolean;
567
+ /**
568
+ * The identifier of a message to reply to.
569
+ */
570
+ replyToMessageId?: number;
571
+ /**
572
+ * The identifier of a thread to send the message to.
573
+ */
574
+ messageThreadId?: number;
575
+ /**
576
+ * The identifier of the chat to send the message on behalf of. User-only.
577
+ */
578
+ sendAs?: ChatID;
579
+ /**
580
+ * The reply markup of the message. Bot-only.
581
+ */
582
+ replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
583
+ }
584
+ export interface SendLocationParams {
585
+ horizontalAccuracy?: number;
586
+ livePeriod?: number;
587
+ heading?: number;
588
+ proximityAlertRadius?: number;
589
+ /**
590
+ * Whether to send the message in a silent way without making a sound on the recipients' clients.
591
+ */
592
+ disableNotification?: boolean;
593
+ /**
594
+ * Whether to protect the contents of the message from copying and forwarding.
595
+ */
596
+ protectContent?: boolean;
597
+ /**
598
+ * The identifier of a message to reply to.
599
+ */
600
+ replyToMessageId?: number;
601
+ /**
602
+ * The identifier of a thread to send the message to.
603
+ */
604
+ messageThreadId?: number;
605
+ /**
606
+ * The identifier of the chat to send the message on behalf of. User-only.
607
+ */
608
+ sendAs?: ChatID;
609
+ /**
610
+ * The reply markup of the message. Bot-only.
611
+ */
612
+ replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
613
+ }
614
+ export interface SendVenueParams {
615
+ foursquareId?: string;
616
+ foursquareType?: string;
617
+ /**
618
+ * Whether to send the message in a silent way without making a sound on the recipients' clients.
619
+ */
620
+ disableNotification?: boolean;
621
+ /**
622
+ * Whether to protect the contents of the message from copying and forwarding.
623
+ */
624
+ protectContent?: boolean;
625
+ /**
626
+ * The identifier of a message to reply to.
627
+ */
628
+ replyToMessageId?: number;
629
+ /**
630
+ * The identifier of a thread to send the message to.
631
+ */
632
+ messageThreadId?: number;
633
+ /**
634
+ * The identifier of the chat to send the message on behalf of. User-only.
635
+ */
636
+ sendAs?: ChatID;
637
+ /**
638
+ * The reply markup of the message. Bot-only.
639
+ */
640
+ replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
641
+ }
642
+ export interface SendContactParams {
643
+ /** The contact's last name. */
644
+ lastName?: string;
645
+ /** Additional information in the vCard format. */
646
+ vcard?: string;
647
+ /**
648
+ * Whether to send the message in a silent way without making a sound on the recipients' clients.
649
+ */
650
+ disableNotification?: boolean;
651
+ /**
652
+ * Whether to protect the contents of the message from copying and forwarding.
653
+ */
654
+ protectContent?: boolean;
655
+ /**
656
+ * The identifier of a message to reply to.
657
+ */
658
+ replyToMessageId?: number;
659
+ /**
660
+ * The identifier of a thread to send the message to.
661
+ */
662
+ messageThreadId?: number;
663
+ /**
664
+ * The identifier of the chat to send the message on behalf of. User-only.
665
+ */
666
+ sendAs?: ChatID;
667
+ /**
668
+ * The reply markup of the message. Bot-only.
669
+ */
670
+ replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
671
+ }
672
+ export interface SendDiceParams {
673
+ emoji?: "🎲" | "🎯" | "🏀" | "⚽" | "🎳" | "🎰";
674
+ /**
675
+ * Whether to send the message in a silent way without making a sound on the recipients' clients.
676
+ */
677
+ disableNotification?: boolean;
678
+ /**
679
+ * Whether to protect the contents of the message from copying and forwarding.
680
+ */
681
+ protectContent?: boolean;
682
+ /**
683
+ * The identifier of a message to reply to.
684
+ */
685
+ replyToMessageId?: number;
686
+ /**
687
+ * The identifier of a thread to send the message to.
688
+ */
689
+ messageThreadId?: number;
690
+ /**
691
+ * The identifier of the chat to send the message on behalf of. User-only.
692
+ */
693
+ sendAs?: ChatID;
694
+ /**
695
+ * The reply markup of the message. Bot-only.
696
+ */
697
+ replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
698
+ }
338
699
  export type ConnectionState = "notConnected" | "updating" | "ready";
339
700
  export type AuthorizationState = {
340
701
  authorized: boolean;
@@ -391,11 +752,10 @@ export interface NetworkStatistics {
391
752
  messages: NetworkStatisticsEntry;
392
753
  cdn: NetworkStatisticsEntry;
393
754
  }
394
- export type ChatList = "main" | "archived";
395
755
  export declare function getChatListId(chatList: string): 0 | 1;
396
756
  export interface GetChatsParams {
397
757
  /** The chat list to get the chats from. Defaults to main. */
398
- from?: ChatList;
758
+ from?: "main" | "archived";
399
759
  /** The last chat to get chats after. */
400
760
  after?: Chat;
401
761
  /** The maximum number of results to return. Must be in the range of 1-100. Defaults to 100. */
@@ -6,7 +6,7 @@ import { BotCommand, CallbackQuery, Chat, ChatAction, ChatID, Document, InlineQu
6
6
  import { Migrate } from "../4_errors.js";
7
7
  import { FileSource, With } from "./0_utilities.js";
8
8
  import { ClientAbstract } from "./1_client_abstract.js";
9
- import { AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, ClientParams, DeleteMessageParams, DeleteMessagesParams, DownloadParams, EditMessageParams, FilterableUpdates, FilterUpdate, ForwardMessagesParams, GetChatsParams, GetHistoryParams, GetMyCommandsParams, InvokeErrorHandler, NetworkStatistics, ReplyParams, SendDocumentParams, SendMessageParams, SendPhotoParams, SendPollParams, SetMyCommandsParams, Update, UploadParams } from "./3_types.js";
9
+ import { AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, ClientParams, DeleteMessageParams, DeleteMessagesParams, DownloadParams, EditMessageParams, FilterableUpdates, FilterUpdate, ForwardMessagesParams, GetChatsParams, GetHistoryParams, GetMyCommandsParams, InvokeErrorHandler, NetworkStatistics, ReplyParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetMyCommandsParams, Update, UploadParams } from "./3_types.js";
10
10
  import { Composer, Middleware } from "./4_composer.js";
11
11
  declare const getEntity: unique symbol;
12
12
  declare const getStickerSetName: unique symbol;
@@ -45,6 +45,24 @@ export interface Context extends Update {
45
45
  replyPhoto: (photo: FileSource, params?: Omit<SendPhotoParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "photo">>;
46
46
  /** Reply the received message with a document. */
47
47
  replyDocument: (document: FileSource, params?: Omit<SendDocumentParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "document">>;
48
+ /** Reply the received message with a location. */
49
+ replyLocation: (latitude: number, longitude: number, params?: Omit<SendLocationParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "location">>;
50
+ /** Reply the received message with a dice. */
51
+ replyDice: (params?: Omit<SendDiceParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "dice">>;
52
+ /** Reply the received message with a venue. */
53
+ replyVenue: (latitude: number, longitude: number, title: string, address: string, params?: Omit<SendVenueParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "venue">>;
54
+ /** Reply the received message with a contact. */
55
+ replyContact: (firstName: string, number: string, params?: Omit<SendContactParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "contact">>;
56
+ /** Reply the received message with a video. */
57
+ replyVideo: (video: FileSource, params?: Omit<SendVideoParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "video">>;
58
+ /** Reply the received message with an animation. */
59
+ replyAnimation: (animation: FileSource, params?: Omit<SendAnimationParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "animation">>;
60
+ /** Reply the received message with a voice message. */
61
+ replyVoice: (voice: FileSource, params?: Omit<SendVoiceParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "voice">>;
62
+ /** Reply the received message with an audio file. */
63
+ replyAudio: (audio: FileSource, params?: Omit<SendAudioParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "audio">>;
64
+ /** Reply the received message with a video note. */
65
+ replyVideoNote: (videoNote: FileSource, params?: Omit<SendVideoNoteParams, "replyToMessageId"> & ReplyParams) => Promise<With<Message, "videoNote">>;
48
66
  /** Delete the received message. */
49
67
  delete: () => Promise<void>;
50
68
  /** Forward the received message. */
@@ -389,6 +407,82 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
389
407
  * @param document The document to send.
390
408
  */
391
409
  sendDocument(chatId: ChatID, document: FileSource, params?: SendDocumentParams): Promise<With<Message, "document">>;
410
+ /**
411
+ * Send a video.
412
+ *
413
+ * @method
414
+ * @param chatId The chat to send the video to.
415
+ * @param video The video to send.
416
+ */
417
+ sendVideo(chatId: ChatID, video: FileSource, params?: SendVideoParams): Promise<With<Message, "video">>;
418
+ /**
419
+ * Send an animation.
420
+ *
421
+ * @method
422
+ * @param chatId The chat to send the animation to.
423
+ * @param animation The animation to send.
424
+ */
425
+ sendAnimation(chatId: ChatID, animation: FileSource, params?: SendAnimationParams): Promise<With<Message, "animation">>;
426
+ /**
427
+ * Send a voice message.
428
+ *
429
+ * @method
430
+ * @param chatId The chat to send the voice message to.
431
+ * @param voice The voice to send.
432
+ */
433
+ sendVoice(chatId: ChatID, voice: FileSource, params?: SendVoiceParams): Promise<With<Message, "voice">>;
434
+ /**
435
+ * Send an audio file.
436
+ *
437
+ * @method
438
+ * @param chatId The chat to send the audio file to.
439
+ * @param audio The audio to send.
440
+ */
441
+ sendAudio(chatId: ChatID, audio: FileSource, params?: SendAudioParams): Promise<With<Message, "audio">>;
442
+ /**
443
+ * Send a video note.
444
+ *
445
+ * @method
446
+ * @param chatId The chat to send the video note to.
447
+ * @param videoNote The video note to send.
448
+ */
449
+ sendVideoNote(chatId: ChatID, audio: FileSource, params?: SendVideoNoteParams): Promise<With<Message, "videoNote">>;
450
+ /**
451
+ * Send a location.
452
+ *
453
+ * @method
454
+ * @param chatId The chat to send the location to.
455
+ * @param latitude The location's latitude.
456
+ * @param longitude The location's longitude.
457
+ */
458
+ sendLocation(chatId: ChatID, latitude: number, longitude: number, params?: SendLocationParams): Promise<With<Message, "location">>;
459
+ /**
460
+ * Send a contact.
461
+ *
462
+ * @method
463
+ * @param chatId The chat to send the contact to.
464
+ * @param firstName The contact's first name.
465
+ * @param number The contact's phone number.
466
+ */
467
+ sendContact(chatId: ChatID, firstName: string, number: string, params?: SendContactParams): Promise<With<Message, "contact">>;
468
+ /**
469
+ * Send a dice.
470
+ *
471
+ * @method
472
+ * @param chatId The chat to send the dice to.
473
+ */
474
+ sendDice(chatId: ChatID, params?: SendDiceParams): Promise<With<Message, "dice">>;
475
+ /**
476
+ * Send a venue.
477
+ *
478
+ * @method
479
+ * @param chatId The chat to send the venue to.
480
+ * @param latitude The latitude of the venue.
481
+ * @param longitude The longitude of the venue.
482
+ * @param title The title of the venue.
483
+ * @param address The written address of the venue.
484
+ */
485
+ sendVenue(chatId: ChatID, latitude: number, longitude: number, title: string, address: string, params?: SendVenueParams): Promise<With<Message, "dice">>;
392
486
  /**
393
487
  * Get network statistics. This might not always be available.
394
488
  *
@@ -396,7 +490,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
396
490
  */
397
491
  getNetworkStatistics(): Promise<NetworkStatistics>;
398
492
  /**
399
- * Get chats from a chat list.
493
+ * Get chats from a chat list. User-only.
400
494
  *
401
495
  * @method
402
496
  */
@@ -408,7 +502,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
408
502
  */
409
503
  getChat(chatId: ChatID): Promise<Chat>;
410
504
  /**
411
- * Get chat history.
505
+ * Get chat history. User-only.
412
506
  *
413
507
  * @param chatId The identifier of the chat to get its history.
414
508
  * @method