@mtkruto/node 0.0.958 → 0.0.960

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 (73) hide show
  1. package/esm/client/0_utilities.d.ts +3 -0
  2. package/esm/client/0_utilities.js +20 -0
  3. package/esm/client/3_client.d.ts +1 -1
  4. package/esm/client/3_client.js +55 -14
  5. package/esm/constants.d.ts +1 -1
  6. package/esm/constants.js +1 -1
  7. package/esm/storage/0_storage.d.ts +6 -0
  8. package/esm/storage/0_storage.js +33 -6
  9. package/esm/types/0_audio.d.ts +9 -0
  10. package/esm/types/0_chat_administrator_rights.d.ts +4 -4
  11. package/esm/types/0_contact.d.ts +6 -0
  12. package/esm/types/0_dice.d.ts +3 -0
  13. package/esm/types/0_force_reply.d.ts +1 -1
  14. package/esm/types/0_keyboard_button_poll_type.d.ts +1 -1
  15. package/esm/types/0_location.d.ts +7 -0
  16. package/esm/types/0_login_url.d.ts +3 -3
  17. package/esm/types/0_mask_position.d.ts +5 -0
  18. package/esm/types/0_message_entity.d.ts +4 -4
  19. package/esm/types/0_reply_keyboard_remove.d.ts +1 -1
  20. package/esm/types/0_thumbnail.d.ts +2 -1
  21. package/esm/types/0_venue.d.ts +6 -0
  22. package/esm/types/0_voice.d.ts +6 -0
  23. package/esm/types/1_animation.d.ts +10 -0
  24. package/esm/types/1_chat.d.ts +18 -18
  25. package/esm/types/1_document.d.ts +7 -0
  26. package/esm/types/1_inline_keyboard_button.d.ts +7 -7
  27. package/esm/types/1_keyboard_button.d.ts +14 -14
  28. package/esm/types/1_photo.d.ts +2 -1
  29. package/esm/types/1_sticker.d.ts +16 -0
  30. package/esm/types/1_user.d.ts +7 -7
  31. package/esm/types/1_video.d.ts +10 -0
  32. package/esm/types/1_video_note.d.ts +8 -0
  33. package/esm/types/2_game.d.ts +7 -0
  34. package/esm/types/2_reply_keyboard_markup.d.ts +5 -5
  35. package/esm/types/3_message.d.ts +57 -25
  36. package/esm/types/3_message.js +0 -1
  37. package/package.json +1 -1
  38. package/script/client/0_utilities.d.ts +3 -0
  39. package/script/client/0_utilities.js +48 -0
  40. package/script/client/3_client.d.ts +1 -1
  41. package/script/client/3_client.js +55 -14
  42. package/script/constants.d.ts +1 -1
  43. package/script/constants.js +1 -1
  44. package/script/storage/0_storage.d.ts +6 -0
  45. package/script/storage/0_storage.js +33 -6
  46. package/script/types/0_audio.d.ts +9 -0
  47. package/script/types/0_chat_administrator_rights.d.ts +4 -4
  48. package/script/types/0_contact.d.ts +6 -0
  49. package/script/types/0_dice.d.ts +3 -0
  50. package/script/types/0_force_reply.d.ts +1 -1
  51. package/script/types/0_keyboard_button_poll_type.d.ts +1 -1
  52. package/script/types/0_location.d.ts +7 -0
  53. package/script/types/0_login_url.d.ts +3 -3
  54. package/script/types/0_mask_position.d.ts +5 -0
  55. package/script/types/0_message_entity.d.ts +4 -4
  56. package/script/types/0_reply_keyboard_remove.d.ts +1 -1
  57. package/script/types/0_thumbnail.d.ts +2 -1
  58. package/script/types/0_venue.d.ts +6 -0
  59. package/script/types/0_voice.d.ts +6 -0
  60. package/script/types/1_animation.d.ts +10 -0
  61. package/script/types/1_chat.d.ts +18 -18
  62. package/script/types/1_document.d.ts +7 -0
  63. package/script/types/1_inline_keyboard_button.d.ts +7 -7
  64. package/script/types/1_keyboard_button.d.ts +14 -14
  65. package/script/types/1_photo.d.ts +2 -1
  66. package/script/types/1_sticker.d.ts +16 -0
  67. package/script/types/1_user.d.ts +7 -7
  68. package/script/types/1_video.d.ts +10 -0
  69. package/script/types/1_video_note.d.ts +8 -0
  70. package/script/types/2_game.d.ts +7 -0
  71. package/script/types/2_reply_keyboard_markup.d.ts +5 -5
  72. package/script/types/3_message.d.ts +57 -25
  73. package/script/types/3_message.js +0 -1
@@ -0,0 +1,3 @@
1
+ import * as types from "../tl/2_types.js";
2
+ export declare function getChannelChatId(channelId: bigint): number;
3
+ export declare function peerToChatId(peer: types.TypePeer | types.TypeInputPeer): number;
@@ -0,0 +1,20 @@
1
+ import { ZERO_CHANNEL_ID } from "../constants.js";
2
+ import * as types from "../tl/2_types.js";
3
+ import { UNREACHABLE } from "../utilities/0_control.js";
4
+ export function getChannelChatId(channelId) {
5
+ return ZERO_CHANNEL_ID + -Number(channelId);
6
+ }
7
+ export function peerToChatId(peer) {
8
+ if (peer instanceof types.PeerUser || peer instanceof types.InputPeerUser) {
9
+ return Number(peer.userId);
10
+ }
11
+ else if (peer instanceof types.PeerChat || peer instanceof types.InputPeerChat) {
12
+ return -Number(peer.chatId);
13
+ }
14
+ else if (peer instanceof types.PeerChannel || peer instanceof types.InputPeerChannel) {
15
+ return getChannelChatId(peer.channelId);
16
+ }
17
+ else {
18
+ UNREACHABLE();
19
+ }
20
+ }
@@ -172,7 +172,7 @@ export declare class Client extends ClientAbstract {
172
172
  sendAs?: number | string;
173
173
  replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
174
174
  }): Promise<Message>;
175
- getMessages(chatId: number | string, messageIds: number[]): Promise<Omit<Message, "replyToMessage">[]>;
175
+ getMessages(chatId_: number | string, messageIds: number[]): Promise<Omit<Message, "replyToMessage">[]>;
176
176
  getMessage(chatId: number | string, messageId: number): Promise<Omit<Message, "replyToMessage"> | null>;
177
177
  private downloadInner;
178
178
  download(fileId_: string): Promise<AsyncGenerator<Uint8Array, void, unknown>>;
@@ -23,6 +23,7 @@ import { parseHtml } from "./0_html.js";
23
23
  import { checkPassword } from "./0_password.js";
24
24
  import { ClientAbstract } from "./1_client_abstract.js";
25
25
  import { ClientPlain } from "./2_client_plain.js";
26
+ import { getChannelChatId, peerToChatId } from "./0_utilities.js";
26
27
  const d = debug("Client");
27
28
  const dGap = debug("Client/recoverUpdateGap");
28
29
  const dGapC = debug("Client/recoverChannelUpdateGap");
@@ -507,7 +508,7 @@ export class Client extends ClientAbstract {
507
508
  this.promises.delete(messageId);
508
509
  }
509
510
  };
510
- if (result instanceof types.Updates || result instanceof types.TypeUpdate) {
511
+ if (result instanceof types.TypeUpdates || result instanceof types.TypeUpdate) {
511
512
  this.processUpdates(result).then(resolvePromise);
512
513
  }
513
514
  else {
@@ -663,6 +664,24 @@ export class Client extends ClientAbstract {
663
664
  d("applied update with pts %d", update.pts);
664
665
  await this.storage.setChannelPts(channelId, update.pts);
665
666
  }
667
+ if (update instanceof types.UpdateNewMessage || update instanceof types.UpdateNewMessage || update instanceof types.UpdateNewChannelMessage || update instanceof types.UpdateNewChannelMessage) {
668
+ if (update.message instanceof types.Message || update.message instanceof types.MessageService) {
669
+ await this.storage.setMessage(peerToChatId(update.message.peerId), update.message.id, update.message);
670
+ }
671
+ }
672
+ else if (update instanceof types.UpdateDeleteChannelMessages) {
673
+ for (const message of update.messages) {
674
+ await this.storage.setMessage(getChannelChatId(update.channelId), message, null);
675
+ }
676
+ }
677
+ else if (update instanceof types.UpdateDeleteMessages) {
678
+ for (const message of update.messages) {
679
+ const chatId = await this.storage.getMessageChat(message);
680
+ if (chatId) {
681
+ await this.storage.setMessage(chatId, message, null);
682
+ }
683
+ }
684
+ }
666
685
  // apply update (call listeners)
667
686
  this.updateHandler?.(this, update);
668
687
  }
@@ -1040,6 +1059,13 @@ export class Client extends ClientAbstract {
1040
1059
  await this.processChats(result.chats);
1041
1060
  await this.processUsers(result.users);
1042
1061
  }
1062
+ if (result instanceof types.MessagesMessages) {
1063
+ for (const message of result.messages) {
1064
+ if (message instanceof types.Message || message instanceof types.MessageService) {
1065
+ await this.storage.setMessage(peerToChatId(message.peerId), message.id, message);
1066
+ }
1067
+ }
1068
+ }
1043
1069
  }
1044
1070
  async updatesToMessages(chatId, updates) {
1045
1071
  const messages = new Array();
@@ -1121,22 +1147,37 @@ export class Client extends ClientAbstract {
1121
1147
  }));
1122
1148
  return await this.updatesToMessages(chatId, result).then((v) => v[0]);
1123
1149
  }
1124
- async getMessages(chatId, messageIds) {
1125
- const peer = await this.getInputPeer(chatId);
1126
- let messages_;
1127
- if (peer instanceof types.InputPeerChannel) {
1128
- messages_ = await this.invoke(new functions.ChannelsGetMessages({
1129
- channel: new types.InputChannel({ channelId: peer.channelId, accessHash: peer.accessHash }),
1130
- id: messageIds.map((v) => new types.InputMessageID({ id: v })),
1131
- })).then((v) => v[as](types.MessagesChannelMessages));
1150
+ async getMessages(chatId_, messageIds) {
1151
+ const peer = await this.getInputPeer(chatId_);
1152
+ let messages_ = new Array();
1153
+ const chatId = peerToChatId(peer);
1154
+ let shouldFetch = false;
1155
+ for (const messageId of messageIds) {
1156
+ const message = await this.storage.getMessage(chatId, messageId);
1157
+ if (message == null) {
1158
+ messages_ = [];
1159
+ shouldFetch = true;
1160
+ break;
1161
+ }
1162
+ else {
1163
+ messages_.push(message);
1164
+ }
1132
1165
  }
1133
- else {
1134
- messages_ = await this.invoke(new functions.MessagesGetMessages({
1135
- id: messageIds.map((v) => new types.InputMessageID({ id: v })),
1136
- })).then((v) => v[as](types.MessagesMessages));
1166
+ if (shouldFetch) {
1167
+ if (peer instanceof types.InputPeerChannel) {
1168
+ messages_ = await this.invoke(new functions.ChannelsGetMessages({
1169
+ channel: new types.InputChannel({ channelId: peer.channelId, accessHash: peer.accessHash }),
1170
+ id: messageIds.map((v) => new types.InputMessageID({ id: v })),
1171
+ })).then((v) => v[as](types.MessagesChannelMessages).messages);
1172
+ }
1173
+ else {
1174
+ messages_ = await this.invoke(new functions.MessagesGetMessages({
1175
+ id: messageIds.map((v) => new types.InputMessageID({ id: v })),
1176
+ })).then((v) => v[as](types.MessagesMessages).messages);
1177
+ }
1137
1178
  }
1138
1179
  const messages = new Array();
1139
- for (const message_ of messages_.messages) {
1180
+ for (const message_ of messages_) {
1140
1181
  messages.push(await constructMessage(message_, this[getEntity].bind(this), null, this[getStickerSetName].bind(this)));
1141
1182
  }
1142
1183
  return messages;
@@ -4,7 +4,7 @@ export declare const publicKeys: Map<bigint, [bigint, bigint]>;
4
4
  export declare const VECTOR_CONSTRUCTOR = 481674261;
5
5
  export declare const DEFAULT_INITIAL_DC: DC;
6
6
  export declare const LAYER = 158;
7
- export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.958";
7
+ export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.960";
8
8
  export declare const DEFAULT_DEVICE_MODEL: string;
9
9
  export declare const DEFAULT_LANG_CODE: string;
10
10
  export declare const DEFAULT_LANG_PACK = "";
package/esm/constants.js CHANGED
@@ -62,7 +62,7 @@ export const publicKeys = new Map([
62
62
  export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
63
63
  export const DEFAULT_INITIAL_DC = "2-test";
64
64
  export const LAYER = 158;
65
- export const DEFAULT_APP_VERSION = "MTKruto 0.0.958";
65
+ export const DEFAULT_APP_VERSION = "MTKruto 0.0.960";
66
66
  // @ts-ignore: lib
67
67
  export const DEFAULT_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;
68
68
  export const DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -1,5 +1,6 @@
1
1
  import { MaybePromise } from "../utilities/0_types.js";
2
2
  import { DC } from "../transport/2_transport_provider.js";
3
+ import { TLObject } from "../tl/1_tl_object.js";
3
4
  import * as types from "../tl/2_types.js";
4
5
  export type StorageKeyPart = string | number | bigint | Uint8Array;
5
6
  export declare abstract class Storage {
@@ -19,8 +20,13 @@ export declare abstract class Storage {
19
20
  getUserAccessHash(id: bigint): MaybePromise<bigint | null>;
20
21
  updateUsernames(type: "user" | "channel", id: bigint, usernames: string[]): Promise<void>;
21
22
  getUsername(username: string): MaybePromise<["channel" | "user", bigint, Date] | null>;
23
+ setTlObject(key: readonly StorageKeyPart[], value: TLObject | null): Promise<void>;
24
+ getTLObject(key: readonly StorageKeyPart[]): Promise<import("../tl/3_tl_reader.js").ReadObject | null>;
22
25
  setState(state: types.UpdatesState): Promise<void>;
23
26
  getState(): Promise<types.UpdatesState | null>;
27
+ setMessage(chatId: number, messageId: number, message: types.TypeMessage | null): Promise<void>;
28
+ getMessageChat(messageId: number): MaybePromise<number | null>;
29
+ getMessage(chatId: number, messageId: number): Promise<types.TypeMessage | null>;
24
30
  setChannelPts(channelId: bigint, pts: number): Promise<void>;
25
31
  getChannelPts(channelId: bigint): MaybePromise<number | null>;
26
32
  setEntity(peer: types.Channel): Promise<void>;
@@ -4,6 +4,8 @@ import { bigIntFromBuffer } from "../utilities/0_bigint.js";
4
4
  import { serialize } from "../tl/1_tl_object.js";
5
5
  import * as types from "../tl/2_types.js";
6
6
  import { TLReader } from "../tl/3_tl_reader.js";
7
+ import { rleDecode, rleEncode } from "../utilities/0_rle.js";
8
+ import { ZERO_CHANNEL_ID } from "../constants.js";
7
9
  const KPARTS__DC = ["dc"];
8
10
  const KPARTS__AUTH_KEY = ["authKey"];
9
11
  const KPARTS__CHANNEL_ACCESS_HASH = (v) => ["channelAccessHash", v];
@@ -14,6 +16,8 @@ const KPARTS__CHANNEL_PTS = (v) => ["channelPts", v];
14
16
  const KPARTS__PEER = (type, id) => ["peer", type, id];
15
17
  const KPARTS__ACCOUNT_TYPE = ["accountType"];
16
18
  const KPARTS__STICKER_SET_NAME = (id, accessHash) => ["stickerSetName", id, accessHash];
19
+ const KPARTS_MESSAGE = (chatId, messageId) => ["messages", chatId, messageId];
20
+ const KPARTS_MESSAGE_REF = (messageId) => ["messageRefs", messageId];
17
21
  export class Storage {
18
22
  constructor() {
19
23
  Object.defineProperty(this, "_authKeyId", {
@@ -71,18 +75,41 @@ export class Storage {
71
75
  username = username.toLowerCase();
72
76
  return this.get(KPARTS__USERNAME(username));
73
77
  }
74
- async setState(state) {
75
- await this.set(KPARTS__STATE, state[serialize]());
78
+ async setTlObject(key, value) {
79
+ if (value == null) {
80
+ await this.set(key, null);
81
+ }
82
+ else {
83
+ await this.set(key, rleEncode(value[serialize]()));
84
+ }
76
85
  }
77
- async getState() {
78
- const state = await this.get(KPARTS__STATE);
79
- if (state != null) {
80
- return new TLReader(state).readObject();
86
+ async getTLObject(key) {
87
+ const buffer = await this.get(key);
88
+ if (buffer != null) {
89
+ return new TLReader(rleDecode(buffer)).readObject();
81
90
  }
82
91
  else {
83
92
  return null;
84
93
  }
85
94
  }
95
+ async setState(state) {
96
+ await this.setTlObject(KPARTS__STATE, state);
97
+ }
98
+ async getState() {
99
+ return await this.getTLObject(KPARTS__STATE);
100
+ }
101
+ async setMessage(chatId, messageId, message) {
102
+ if (chatId > ZERO_CHANNEL_ID) {
103
+ await this.set(KPARTS_MESSAGE_REF(messageId), message == null ? null : chatId);
104
+ }
105
+ await this.setTlObject(KPARTS_MESSAGE(chatId, messageId), message);
106
+ }
107
+ getMessageChat(messageId) {
108
+ return this.get(KPARTS_MESSAGE_REF(messageId));
109
+ }
110
+ async getMessage(chatId, messageId) {
111
+ return await this.getTLObject(KPARTS_MESSAGE(chatId, messageId));
112
+ }
86
113
  async setChannelPts(channelId, pts) {
87
114
  await this.set(KPARTS__CHANNEL_PTS(channelId), pts);
88
115
  }
@@ -1,13 +1,22 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  import { Thumbnail } from "./0_thumbnail.js";
3
+ /** This object represents an audio file to be treated as music by the Telegram clients. */
3
4
  export interface Audio {
5
+ /** Identifier for this file, which can be used to download or reuse the file */
4
6
  fileId: string;
7
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
5
8
  fileUniqueId: string;
9
+ /** Duration of the audio in seconds as defined by sender */
6
10
  duration: number;
11
+ /** Performer of the audio as defined by sender or by audio tags */
7
12
  performer?: string;
13
+ /** Title of the audio as defined by sender or by audio tags */
8
14
  title?: string;
15
+ /** MIME type of the file as defined by sender */
9
16
  mimeType: string;
17
+ /** File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. */
10
18
  fileSize: number;
19
+ /** Thumbnail of the album cover to which the music file belongs */
11
20
  thumbnails: Thumbnail[];
12
21
  }
13
22
  export declare function constructAudio(document: types.Document, audioAttribute: types.DocumentAttributeAudio | undefined, fileId: string, fileUniqueId: string): Audio;
@@ -17,13 +17,13 @@ export interface ChatAdministratorRights {
17
17
  canChangeInfo: boolean;
18
18
  /** True, if the user is allowed to invite new users to the chat */
19
19
  canInviteUsers: boolean;
20
- /** Optional. True, if the administrator can post in the channel; channels only */
20
+ /** True, if the administrator can post in the channel; channels only */
21
21
  canPostMessages?: boolean;
22
- /** Optional. True, if the administrator can edit messages of other users and can pin messages; channels only */
22
+ /** True, if the administrator can edit messages of other users and can pin messages; channels only */
23
23
  canEditMessages?: boolean;
24
- /** Optional. True, if the user is allowed to pin messages; groups and supergroups only */
24
+ /** True, if the user is allowed to pin messages; groups and supergroups only */
25
25
  canPinMessages?: boolean;
26
- /** Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */
26
+ /** True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */
27
27
  canManageTopics?: boolean;
28
28
  }
29
29
  export declare function constructChatAdministratorRights(rights_: types.ChatAdminRights): ChatAdministratorRights;
@@ -1,9 +1,15 @@
1
1
  import * as types from "../tl/2_types.js";
2
+ /** This object represents a phone contact. */
2
3
  export interface Contact {
4
+ /** Contact's phone number */
3
5
  phoneNumber: string;
6
+ /** Contact's first name */
4
7
  firstName: string;
8
+ /** Contact's last name */
5
9
  lastName?: string;
10
+ /** Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. */
6
11
  userId?: number;
12
+ /** Additional data about the contact in the form of a [vCard](https://en.wikipedia.org/wiki/VCard) */
7
13
  vcard?: string;
8
14
  }
9
15
  export declare function constructContact(contact: types.MessageMediaContact): Contact;
@@ -1,6 +1,9 @@
1
1
  import * as types from "../tl/2_types.js";
2
+ /** This object represents an animated emoji that displays a random value. */
2
3
  export interface Dice {
4
+ /** Emoji on which the dice throw animation is based */
3
5
  emoji: string;
6
+ /** Value of the dice, 1-6 for "🎲", "🎯" and "🎳" base emoji, 1-5 for "🏀" and "⚽" base emoji, 1-64 for "🎰" base emoji */
4
7
  value: number;
5
8
  }
6
9
  export declare function constructDice(dice_: types.MessageMediaDice): Dice;
@@ -5,7 +5,7 @@ export interface ForceReply {
5
5
  forceReply: true;
6
6
  /** Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' */
7
7
  inputFieldPlaceholder?: string;
8
- /** Optional. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. */
8
+ /** Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. */
9
9
  selective?: boolean;
10
10
  }
11
11
  export declare function constructForceReply(replyMarkup_: types.ReplyKeyboardForceReply): ForceReply;
@@ -1,5 +1,5 @@
1
1
  /** This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. */
2
2
  export interface KeyboardButtonPollType {
3
- /** Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. */
3
+ /** If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. */
4
4
  type?: string;
5
5
  }
@@ -1,10 +1,17 @@
1
1
  import * as types from "../tl/2_types.js";
2
+ /** This object represents a point on the map. */
2
3
  export interface Location {
4
+ /** Latitude as defined by sender */
3
5
  latitude: number;
6
+ /** Longitude as defined by sender */
4
7
  longitude: number;
8
+ /** The radius of uncertainty for the location, measured in meters; 0-1500 */
5
9
  horizontalAccuracy?: number;
10
+ /** Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only. */
6
11
  livePeriod?: number;
12
+ /** The direction in which user is moving, in degrees; 1-360. For active live locations only. */
7
13
  heading?: number;
14
+ /** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
8
15
  proximityAlertRadius?: number;
9
16
  }
10
17
  export declare function constructLocation(geo_: types.MessageMediaGeo | types.MessageMediaGeoLive | types.GeoPoint): Location;
@@ -2,10 +2,10 @@
2
2
  export interface LoginUrl {
3
3
  /** An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in [Receiving authorization data](https://core.telegram.org/widgets/login#receiving-authorization-data). */
4
4
  url: string;
5
- /** Optional. New text of the button in forwarded messages. */
5
+ /** New text of the button in forwarded messages. */
6
6
  forwardText?: string;
7
- /** Optional. Username of a bot, which will be used for user authorization. See [Setting up a bot](https://core.telegram.org/widgets/login#setting-up-a-bot) for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See [Linking your domain to the bot](https://core.telegram.org/widgets/login#linking-your-domain-to-the-bot) for more details. */
7
+ /** Username of a bot, which will be used for user authorization. See [Setting up a bot](https://core.telegram.org/widgets/login#setting-up-a-bot) for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See [Linking your domain to the bot](https://core.telegram.org/widgets/login#linking-your-domain-to-the-bot) for more details. */
8
8
  botUsername?: string;
9
- /** Optional. Pass True to request the permission for your bot to send messages to the user. */
9
+ /** Pass True to request the permission for your bot to send messages to the user. */
10
10
  requestWriteAccess?: boolean;
11
11
  }
@@ -1,8 +1,13 @@
1
1
  import * as types from "../tl/2_types.js";
2
+ /** This object describes the position on faces where a mask should be placed by default. */
2
3
  export interface MaskPosition {
4
+ /** The part of the face relative to which the mask should be placed. One of "forehead", "eyes", "mouth", or "chin". */
3
5
  point: "forehead" | "eyes" | "mouth" | "chin";
6
+ /** Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. */
4
7
  xShift: number;
8
+ /** Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. */
5
9
  yShift: number;
10
+ /** Mask scaling coefficient. For example, 2.0 means double size. */
6
11
  scale: number;
7
12
  }
8
13
  export declare function constructMaskPosition({ n, x, y, zoom }: types.MaskCoords): MaskPosition;
@@ -50,7 +50,7 @@ export declare namespace MessageEntity {
50
50
  }
51
51
  interface Pre extends Base {
52
52
  type: MessageEntityType.Pre;
53
- /** Optional. For “pre” only, the programming language of the entity text */
53
+ /** For “pre” only, the programming language of the entity text */
54
54
  language: string;
55
55
  }
56
56
  interface Code extends Base {
@@ -58,12 +58,12 @@ export declare namespace MessageEntity {
58
58
  }
59
59
  interface TextURL extends Base {
60
60
  type: MessageEntityType.TextURL;
61
- /** Optional. For “text_link” only, URL that will be opened after user taps on the text */
61
+ /** For “text_link” only, URL that will be opened after user taps on the text */
62
62
  url: string;
63
63
  }
64
64
  interface MentionName extends Base {
65
65
  type: MessageEntityType.MentionName;
66
- /** Optional. For “text_mention” only, the ID of the mentioned user */
66
+ /** For “text_mention” only, the ID of the mentioned user */
67
67
  userId: number;
68
68
  }
69
69
  interface Cashtag extends Base {
@@ -89,7 +89,7 @@ export declare namespace MessageEntity {
89
89
  }
90
90
  interface CustomEmoji extends Base {
91
91
  type: MessageEntityType.CustomEmoji;
92
- /** Optional. For “custom_emoji” only, unique identifier of the custom emoji */
92
+ /** For “custom_emoji” only, unique identifier of the custom emoji */
93
93
  customEmojiId: string;
94
94
  }
95
95
  }
@@ -3,7 +3,7 @@ import * as types from "../tl/2_types.js";
3
3
  export interface ReplyKeyboardRemove {
4
4
  /** Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use _one_time_keyboard_ in `ReplyKeyboardMarkup`) */
5
5
  removeKeyboard: true;
6
- /** Optional. Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the `Message` object; 2) if the bot's message is a reply (has _reply_to_message_id_), sender of the original message. */
6
+ /** Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the `Message` object; 2) if the bot's message is a reply (has _reply_to_message_id_), sender of the original message. */
7
7
  selective?: boolean;
8
8
  }
9
9
  export declare function constructReplyKeyboardRemove(replyMarkup_: types.ReplyKeyboardHide): ReplyKeyboardRemove;
@@ -1,4 +1,5 @@
1
1
  import * as types from "../tl/2_types.js";
2
+ /** This object represents thumbnail of a file or a sticker. */
2
3
  export interface Thumbnail {
3
4
  /** Identifier for this file, which can be used to download or reuse the file */
4
5
  fileId: string;
@@ -8,7 +9,7 @@ export interface Thumbnail {
8
9
  width: number;
9
10
  /** Photo height */
10
11
  height: number;
11
- /** Optional. File size in bytes */
12
+ /** File size in bytes */
12
13
  fileSize: number;
13
14
  }
14
15
  export declare function constructThumbnail(size: types.PhotoSize, file: types.Document | types.Photo): Thumbnail;
@@ -1,10 +1,16 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  import { Location } from "./0_location.js";
3
+ /** */
3
4
  export interface Venue {
5
+ /** Venue location. Can't be a live location */
4
6
  location: Location;
7
+ /** Name of the venue */
5
8
  title: string;
9
+ /** Address of the venue */
6
10
  address: string;
11
+ /** Foursquare identifier of the venue */
7
12
  foursquareId?: string;
13
+ /** Foursquare type of the venue. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".) */
8
14
  foursquareType?: string;
9
15
  }
10
16
  export declare function constructVenue(media_: types.MessageMediaVenue): Venue;
@@ -1,9 +1,15 @@
1
1
  import * as types from "../tl/2_types.js";
2
+ /** This object represents a voice note. */
2
3
  export interface Voice {
4
+ /** Identifier for this file, which can be used to download or reuse the file */
3
5
  fileId: string;
6
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
4
7
  fileUniqueId: string;
8
+ /** Duration of the audio in seconds as defined by sender */
5
9
  duration: number;
10
+ /** MIME type of the file as defined by sender */
6
11
  mimeType: string;
12
+ /** File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. */
7
13
  fileSize: number;
8
14
  }
9
15
  export declare function constructVoice(document: types.Document, audioAttributes: types.DocumentAttributeAudio, fileId: string, fileUniqueId: string): Voice;
@@ -1,14 +1,24 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  import { Thumbnail } from "./0_thumbnail.js";
3
+ /** This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). */
3
4
  export interface Animation {
5
+ /** Identifier for this file, which can be used to download or reuse the file */
4
6
  fileId: string;
7
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
5
8
  fileUniqueId: string;
9
+ /** Video width as defined by sender */
6
10
  width: number;
11
+ /** Video height as defined by sender */
7
12
  height: number;
13
+ /** Duration of the video in seconds as defined by sender */
8
14
  duration: number;
15
+ /** Animation thumbnail as defined by sender */
9
16
  thumbnails: Thumbnail[];
17
+ /** Original animation filename as defined by sender */
10
18
  fileName?: string;
19
+ /** MIME type of the file as defined by sender */
11
20
  mimeType: string;
21
+ /** File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. */
12
22
  fileSize: number;
13
23
  }
14
24
  export declare function constructAnimation(document: types.Document, videoAttribute: types.DocumentAttributeVideo | undefined, fileAttribute: types.DocumentAttributeFilename | undefined, fileId: string, fileUniqueId: string): Animation;
@@ -13,22 +13,22 @@ export declare namespace Chat {
13
13
  /** Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
14
14
  id: number;
15
15
  idColor: string;
16
- /** Optional. Chat photo. */
16
+ /** Chat photo. */
17
17
  photo?: ChatPhoto;
18
18
  }
19
19
  interface Private extends Base {
20
20
  type: ChatType.Private;
21
21
  /** True, if this user is a bot */
22
22
  isBot?: boolean;
23
- /** Optional. First name of the other party in a private chat */
23
+ /** First name of the other party in a private chat */
24
24
  firstName: string;
25
- /** Optional. Last name of the other party in a private chat */
25
+ /** Last name of the other party in a private chat */
26
26
  lastName?: string;
27
- /** Optional. Username, for private chats, supergroups and channels if available */
27
+ /** Username, for private chats, supergroups and channels if available */
28
28
  username?: string;
29
- /** Optional. Additional usernames */
29
+ /** Additional usernames */
30
30
  also?: string[];
31
- /** Optional. Chat photo. */
31
+ /** Chat photo. */
32
32
  photo?: ChatPhoto.User;
33
33
  /** True, if the user is a scam user */
34
34
  isScam: boolean;
@@ -40,26 +40,26 @@ export declare namespace Chat {
40
40
  isVerified: boolean;
41
41
  /** True, if the access to the user must be restricted for the reason specified in `restriction_reason` */
42
42
  isRestricted?: boolean;
43
- /** Optional. Contains the reason why access to the user must be restricted. */
43
+ /** Contains the reason why access to the user must be restricted. */
44
44
  restrictionReason?: types.RestrictionReason[];
45
45
  }
46
46
  interface Group extends Base {
47
47
  type: ChatType.Group;
48
- /** Optional. Title, for supergroups, channels and group chats */
48
+ /** Title, for supergroups, channels and group chats */
49
49
  title: string;
50
- /** Optional. Chat photo. */
50
+ /** Chat photo. */
51
51
  photo?: ChatPhoto.Chat;
52
52
  /** True, if the user is creator of the chat */
53
53
  isCreator: boolean;
54
54
  }
55
55
  interface ChannelBase extends Base {
56
- /** Optional. Title, for supergroups, channels and group chats */
56
+ /** Title, for supergroups, channels and group chats */
57
57
  title: string;
58
- /** Optional. Username, for private chats, supergroups and channels if available */
58
+ /** Username, for private chats, supergroups and channels if available */
59
59
  username?: string;
60
- /** Optional. Additional usernames */
60
+ /** Additional usernames */
61
61
  also?: string[];
62
- /** Optional. Chat photo. */
62
+ /** Chat photo. */
63
63
  photo?: ChatPhoto.Chat;
64
64
  /** True, if the user is a scam user */
65
65
  isScam: boolean;
@@ -69,21 +69,21 @@ export declare namespace Chat {
69
69
  isVerified: boolean;
70
70
  /** True, if the access to the user must be restricted for the reason specified in `restriction_reason` */
71
71
  isRestricted: boolean;
72
- /** Optional. Contains the reason why access to the user must be restricted. */
72
+ /** Contains the reason why access to the user must be restricted. */
73
73
  restrictionReason?: types.RestrictionReason[];
74
74
  }
75
75
  interface Channel extends ChannelBase {
76
76
  type: ChatType.Channel;
77
- /** Optional. Title, for supergroups, channels and group chats */
77
+ /** Title, for supergroups, channels and group chats */
78
78
  title: string;
79
- /** Optional. Username, for private chats, supergroups and channels if available */
79
+ /** Username, for private chats, supergroups and channels if available */
80
80
  username?: string;
81
- /** Optional. Additional usernames */
81
+ /** Additional usernames */
82
82
  also?: string[];
83
83
  }
84
84
  interface Supergroup extends ChannelBase {
85
85
  type: ChatType.Supergroup;
86
- /** Optional. True, if the supergroup chat is a forum (has [topics](https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups) enabled) */
86
+ /** True, if the supergroup chat is a forum (has [topics](https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups) enabled) */
87
87
  isForum: boolean;
88
88
  }
89
89
  }
@@ -1,11 +1,18 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  import { Thumbnail } from "./0_thumbnail.js";
3
+ /** This object represents a general file (as opposed to [photos](https://corefork.telegram.org/bots/api#photosize), [voice messages](https://corefork.telegram.org/bots/api#voice) and [audio files](https://corefork.telegram.org/bots/api#audio)). */
3
4
  export interface Document {
5
+ /** Identifier for this file, which can be used to download or reuse the file */
4
6
  fileId: string;
7
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
5
8
  fileUniqueId: string;
9
+ /** Document thumbnail as defined by sender */
6
10
  thumbnails: Thumbnail[];
11
+ /** Original filename as defined by sender */
7
12
  fileName: string;
13
+ /** MIME type of the file as defined by sender */
8
14
  mimeType: string;
15
+ /** File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. */
9
16
  fileSize: number;
10
17
  }
11
18
  export declare function constructDocument(document: types.Document, fileNameAttribute: types.DocumentAttributeFilename, fileId: string, fileUniqueId: string): Document;