@mtkruto/node 0.0.934 → 0.0.936

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 (39) hide show
  1. package/esm/constants.d.ts +1 -1
  2. package/esm/constants.js +1 -1
  3. package/esm/types/0_chat_administrator_rights.d.ts +13 -0
  4. package/esm/types/0_chat_photo.d.ts +6 -0
  5. package/esm/types/0_force_reply.d.ts +4 -0
  6. package/esm/types/0_keyboard_button_poll_type.d.ts +2 -0
  7. package/esm/types/0_login_url.d.ts +5 -0
  8. package/esm/types/0_message_entity.d.ts +7 -0
  9. package/esm/types/0_reply_keyboard_remove.d.ts +3 -0
  10. package/esm/types/0_thumbnail.d.ts +5 -0
  11. package/esm/types/0_web_app_info.d.ts +2 -0
  12. package/esm/types/1_chat.d.ts +32 -0
  13. package/esm/types/1_inline_keyboard_button.d.ts +9 -0
  14. package/esm/types/1_keyboard_button.d.ts +21 -0
  15. package/esm/types/1_photo.d.ts +5 -0
  16. package/esm/types/1_user.d.ts +15 -0
  17. package/esm/types/2_inline_keyboard_markup.d.ts +2 -0
  18. package/esm/types/2_reply_keyboard_markup.d.ts +7 -0
  19. package/esm/types/3_message.d.ts +29 -0
  20. package/package.json +1 -1
  21. package/script/constants.d.ts +1 -1
  22. package/script/constants.js +1 -1
  23. package/script/types/0_chat_administrator_rights.d.ts +13 -0
  24. package/script/types/0_chat_photo.d.ts +6 -0
  25. package/script/types/0_force_reply.d.ts +4 -0
  26. package/script/types/0_keyboard_button_poll_type.d.ts +2 -0
  27. package/script/types/0_login_url.d.ts +5 -0
  28. package/script/types/0_message_entity.d.ts +7 -0
  29. package/script/types/0_reply_keyboard_remove.d.ts +3 -0
  30. package/script/types/0_thumbnail.d.ts +5 -0
  31. package/script/types/0_web_app_info.d.ts +2 -0
  32. package/script/types/1_chat.d.ts +32 -0
  33. package/script/types/1_inline_keyboard_button.d.ts +9 -0
  34. package/script/types/1_keyboard_button.d.ts +21 -0
  35. package/script/types/1_photo.d.ts +5 -0
  36. package/script/types/1_user.d.ts +15 -0
  37. package/script/types/2_inline_keyboard_markup.d.ts +2 -0
  38. package/script/types/2_reply_keyboard_markup.d.ts +7 -0
  39. package/script/types/3_message.d.ts +29 -0
@@ -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.934";
7
+ export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.936";
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.934";
65
+ export const DEFAULT_APP_VERSION = "MTKruto 0.0.936";
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,16 +1,29 @@
1
1
  import * as types from "../tl/2_types.js";
2
+ /** Represents the rights of an administrator in a chat. */
2
3
  export interface ChatAdministratorRights {
4
+ /** True, if the user's presence in the chat is hidden */
3
5
  isAnonymous: boolean;
6
+ /** True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */
4
7
  canManageChat: boolean;
8
+ /** True, if the administrator can delete messages of other users */
5
9
  canDeleteMessages: boolean;
10
+ /** True, if the administrator can manage video chats */
6
11
  canManageVideoChats: boolean;
12
+ /** True, if the administrator can restrict, ban or unban chat members */
7
13
  canRestrictMembers: boolean;
14
+ /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
8
15
  canPromoteMembers: boolean;
16
+ /** True, if the user is allowed to change the chat title, photo and other settings */
9
17
  canChangeInfo: boolean;
18
+ /** True, if the user is allowed to invite new users to the chat */
10
19
  canInviteUsers: boolean;
20
+ /** Optional. True, if the administrator can post in the channel; channels only */
11
21
  canPostMessages?: boolean;
22
+ /** Optional. True, if the administrator can edit messages of other users and can pin messages; channels only */
12
23
  canEditMessages?: boolean;
24
+ /** Optional. True, if the user is allowed to pin messages; groups and supergroups only */
13
25
  canPinMessages?: boolean;
26
+ /** Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */
14
27
  canManageTopics?: boolean;
15
28
  }
16
29
  export declare function constructChatAdministratorRights(rights_: types.ChatAdminRights): ChatAdministratorRights;
@@ -1,10 +1,15 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  export declare namespace ChatPhoto {
3
3
  interface Base {
4
+ /** File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */
4
5
  smallFileId: string;
6
+ /** Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
5
7
  smallFileUniqueId: string;
8
+ /** File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */
6
9
  bigFileId: string;
10
+ /** Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
7
11
  bigFileUniqueId: string;
12
+ /** True, if an [animated profile picture](https://core.telegram.org/api/files#animated-profile-pictures) is available for the user */
8
13
  hasVideo: boolean;
9
14
  }
10
15
  interface User extends Base {
@@ -12,6 +17,7 @@ export declare namespace ChatPhoto {
12
17
  }
13
18
  type Chat = Base;
14
19
  }
20
+ /** This object represents a chat photo. */
15
21
  export type ChatPhoto = ChatPhoto.User | ChatPhoto.Chat;
16
22
  export declare function constructChatPhoto(photo: types.ChatPhoto, chatId: number, chatAccessHash: bigint): ChatPhoto.Chat;
17
23
  export declare function constructChatPhoto(photo: types.UserProfilePhoto, chatId: number, chatAccessHash: bigint): ChatPhoto.User;
@@ -1,7 +1,11 @@
1
1
  import * as types from "../tl/2_types.js";
2
+ /** Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. */
2
3
  export interface ForceReply {
4
+ /** Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' */
3
5
  forceReply: true;
6
+ /** Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' */
4
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. */
5
9
  selective?: boolean;
6
10
  }
7
11
  export declare function constructForceReply(replyMarkup_: types.ReplyKeyboardForceReply): ForceReply;
@@ -1,3 +1,5 @@
1
+ /** This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. */
1
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. */
2
4
  type?: string;
3
5
  }
@@ -1,6 +1,11 @@
1
+ /** This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the [Telegram Login Widget](https://core.telegram.org/widgets/login) when the user is coming from Telegram. */
1
2
  export interface LoginUrl {
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). */
2
4
  url: string;
5
+ /** Optional. New text of the button in forwarded messages. */
3
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. */
4
8
  botUsername?: string;
9
+ /** Optional. Pass True to request the permission for your bot to send messages to the user. */
5
10
  requestWriteAccess?: boolean;
6
11
  }
@@ -22,7 +22,9 @@ export declare enum MessageEntityType {
22
22
  }
23
23
  export declare namespace MessageEntity {
24
24
  interface Base {
25
+ /** Offset in [UTF-16 code units](https://core.telegram.org/api/entities#entity-length) to the start of the entity */
25
26
  offset: number;
27
+ /** Length of the entity in [UTF-16 code units](https://core.telegram.org/api/entities#entity-length) */
26
28
  length: number;
27
29
  }
28
30
  interface Mention extends Base {
@@ -48,6 +50,7 @@ export declare namespace MessageEntity {
48
50
  }
49
51
  interface Pre extends Base {
50
52
  type: MessageEntityType.Pre;
53
+ /** Optional. For “pre” only, the programming language of the entity text */
51
54
  language: string;
52
55
  }
53
56
  interface Code extends Base {
@@ -55,10 +58,12 @@ export declare namespace MessageEntity {
55
58
  }
56
59
  interface TextURL extends Base {
57
60
  type: MessageEntityType.TextURL;
61
+ /** Optional. For “text_link” only, URL that will be opened after user taps on the text */
58
62
  url: string;
59
63
  }
60
64
  interface MentionName extends Base {
61
65
  type: MessageEntityType.MentionName;
66
+ /** Optional. For “text_mention” only, the ID of the mentioned user */
62
67
  userId: number;
63
68
  }
64
69
  interface Cashtag extends Base {
@@ -84,9 +89,11 @@ export declare namespace MessageEntity {
84
89
  }
85
90
  interface CustomEmoji extends Base {
86
91
  type: MessageEntityType.CustomEmoji;
92
+ /** Optional. For “custom_emoji” only, unique identifier of the custom emoji */
87
93
  customEmojiId: string;
88
94
  }
89
95
  }
96
+ /** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */
90
97
  export type MessageEntity = MessageEntity.Mention | MessageEntity.Hashtag | MessageEntity.BotCommand | MessageEntity.URL | MessageEntity.EmailAddress | MessageEntity.Bold | MessageEntity.Italic | MessageEntity.Code | MessageEntity.Pre | MessageEntity.TextURL | MessageEntity.MentionName | MessageEntity.Cashtag | MessageEntity.Phone | MessageEntity.Underline | MessageEntity.Strike | MessageEntity.Blockquote | MessageEntity.BankCard | MessageEntity.Spoiler | MessageEntity.CustomEmoji;
91
98
  export declare function constructMessageEntity(obj: types.TypeMessageEntity): MessageEntity | null;
92
99
  export declare function messageEntityToTlObject(entity: MessageEntity): types.MessageEntityMention | types.MessageEntityHashtag | types.MessageEntityBotCommand | types.MessageEntityURL | types.MessageEntityEmail | types.MessageEntityBold | types.MessageEntityItalic | types.MessageEntityCode | types.MessageEntityPre | types.MessageEntityTextURL | types.MessageEntityMentionName | types.MessageEntityPhone | types.MessageEntityCashtag | types.MessageEntityUnderline | types.MessageEntityStrike | types.MessageEntityBlockquote | types.MessageEntityBankCard | types.MessageEntitySpoiler | types.MessageEntityCustomEmoji;
@@ -1,6 +1,9 @@
1
1
  import * as types from "../tl/2_types.js";
2
+ /** Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button. */
2
3
  export interface ReplyKeyboardRemove {
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`) */
3
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. */
4
7
  selective?: boolean;
5
8
  }
6
9
  export declare function constructReplyKeyboardRemove(replyMarkup_: types.ReplyKeyboardHide): ReplyKeyboardRemove;
@@ -1,9 +1,14 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  export interface Thumbnail {
3
+ /** Identifier for this file, which can be used to download or reuse the file */
3
4
  fileId: string;
5
+ /** 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
6
  fileUniqueId: string;
7
+ /** Photo width */
5
8
  width: number;
9
+ /** Photo height */
6
10
  height: number;
11
+ /** Optional. File size in bytes */
7
12
  fileSize: number;
8
13
  }
9
14
  export declare function constructThumbnail(size: types.PhotoSize, file: types.Document | types.Photo): Thumbnail;
@@ -1,4 +1,6 @@
1
+ /** Describes a [Web App](https://core.telegram.org/bots/webapps). */
1
2
  export interface WebAppInfo {
3
+ /** An HTTPS URL of a Web App to be opened with additional data as specified in [Initializing Web Apps](https://core.telegram.org/bots/webapps#initializing-web-apps) */
2
4
  url: string;
3
5
  }
4
6
  export declare function constructWebAppInfo(url: string): WebAppInfo;
@@ -8,54 +8,86 @@ export declare enum ChatType {
8
8
  }
9
9
  export declare namespace Chat {
10
10
  interface Base {
11
+ /** Type of chat, can be either “private”, “group”, “supergroup” or “channel” */
11
12
  type: ChatType;
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. */
12
14
  id: number;
13
15
  idColor: string;
16
+ /** Optional. Chat photo. */
14
17
  photo?: ChatPhoto;
15
18
  }
16
19
  interface Private extends Base {
17
20
  type: ChatType.Private;
21
+ /** True, if this user is a bot */
18
22
  isBot?: boolean;
23
+ /** Optional. First name of the other party in a private chat */
19
24
  firstName: string;
25
+ /** Optional. Last name of the other party in a private chat */
20
26
  lastName?: string;
27
+ /** Optional. Username, for private chats, supergroups and channels if available */
21
28
  username?: string;
29
+ /** Optional. Additional usernames */
22
30
  also?: string[];
31
+ /** Optional. Chat photo. */
23
32
  photo?: ChatPhoto.User;
33
+ /** True, if the user is a scam user */
24
34
  isScam: boolean;
35
+ /** True, if this user was reported by many users as a fake or scam user: be careful when interacting with them. */
25
36
  isFake: boolean;
37
+ /** True, if the user is an official support user */
26
38
  isSupport: boolean;
39
+ /** True, if the user is verified */
27
40
  isVerified: boolean;
41
+ /** True, if the access to the user must be restricted for the reason specified in `restriction_reason` */
28
42
  isRestricted?: boolean;
43
+ /** Optional. Contains the reason why access to the user must be restricted. */
29
44
  restrictionReason?: types.RestrictionReason[];
30
45
  }
31
46
  interface Group extends Base {
32
47
  type: ChatType.Group;
48
+ /** Optional. Title, for supergroups, channels and group chats */
33
49
  title: string;
50
+ /** Optional. Chat photo. */
34
51
  photo?: ChatPhoto.Chat;
52
+ /** True, if the user is creator of the chat */
35
53
  isCreator: boolean;
36
54
  }
37
55
  interface ChannelBase extends Base {
56
+ /** Optional. Title, for supergroups, channels and group chats */
38
57
  title: string;
58
+ /** Optional. Username, for private chats, supergroups and channels if available */
39
59
  username?: string;
60
+ /** Optional. Additional usernames */
40
61
  also?: string[];
62
+ /** Optional. Chat photo. */
41
63
  photo?: ChatPhoto.Chat;
64
+ /** True, if the user is a scam user */
42
65
  isScam: boolean;
66
+ /** True, if this user was reported by many users as a fake or scam user: be careful when interacting with them. */
43
67
  isFake: boolean;
68
+ /** True, if the user is verified */
44
69
  isVerified: boolean;
70
+ /** True, if the access to the user must be restricted for the reason specified in `restriction_reason` */
45
71
  isRestricted: boolean;
72
+ /** Optional. Contains the reason why access to the user must be restricted. */
46
73
  restrictionReason?: types.RestrictionReason[];
47
74
  }
48
75
  interface Channel extends ChannelBase {
49
76
  type: ChatType.Channel;
77
+ /** Optional. Title, for supergroups, channels and group chats */
50
78
  title: string;
79
+ /** Optional. Username, for private chats, supergroups and channels if available */
51
80
  username?: string;
81
+ /** Optional. Additional usernames */
52
82
  also?: string[];
53
83
  }
54
84
  interface Supergroup extends ChannelBase {
55
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) */
56
87
  isForum: boolean;
57
88
  }
58
89
  }
90
+ /** This object represents a chat. */
59
91
  export type Chat = Chat.Private | Chat.Group | Chat.Supergroup | Chat.Channel;
60
92
  export declare function constructChat(chat: types.User): Chat.Private;
61
93
  export declare function constructChat(chat: types.Chat): Chat.Group;
@@ -4,33 +4,42 @@ import { WebAppInfo } from "./0_web_app_info.js";
4
4
  import { LoginUrl } from "./0_login_url.js";
5
5
  export declare namespace InlineKeyboardButton {
6
6
  interface Base {
7
+ /** Label text on the button */
7
8
  text: string;
8
9
  }
9
10
  interface URL extends Base {
11
+ /** Optional. HTTP or tg:// URL to be opened when the button is pressed. Links `tg://user?id=<user_id>` can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. */
10
12
  url: string;
11
13
  }
12
14
  interface Callback extends Base {
15
+ /** Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes */
13
16
  callbackData: string;
14
17
  }
15
18
  interface WebApp extends Base {
19
+ /** Optional. Description of the [Web App](https://core.telegram.org/bots/webapps) that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. */
16
20
  webApp: WebAppInfo;
17
21
  }
18
22
  interface Login extends Base {
23
+ /** Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the [Telegram Login Widget](https://core.telegram.org/widgets/login). */
19
24
  loginUrl: LoginUrl;
20
25
  }
21
26
  interface SwitchInline extends Base {
27
+ /** Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. */
22
28
  switchInlineQuery: string;
23
29
  }
24
30
  interface SwitchInlineCurrent extends Base {
31
+ /** Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted. */
25
32
  switchInlineQueryCurrentChat: string;
26
33
  }
27
34
  interface Game extends Base {
28
35
  callbackGame: Record<never, never>;
29
36
  }
30
37
  interface Pay extends Base {
38
+ /** Optional. Specify True, to send a [Pay button](https://core.telegram.org/bots/api#payments). */
31
39
  pay: boolean;
32
40
  }
33
41
  }
42
+ /** This object represents one button of an inline keyboard. You **must** use exactly one of the optional fields. */
34
43
  export type InlineKeyboardButton = InlineKeyboardButton.URL | InlineKeyboardButton.Callback | InlineKeyboardButton.WebApp | InlineKeyboardButton.Login | InlineKeyboardButton.SwitchInline | InlineKeyboardButton.SwitchInlineCurrent | InlineKeyboardButton.Game | InlineKeyboardButton.Pay;
35
44
  export declare function constructInlineKeyboardButton(button_: types.TypeKeyboardButton): InlineKeyboardButton;
36
45
  export declare function inlineKeyboardButtonToTlObject(button: InlineKeyboardButton, usernameResolver: (username: string) => MaybePromise<types.InputUser>): Promise<types.KeyboardButtonURL | types.KeyboardButtonCallback | types.KeyboardButtonSwitchInline | types.KeyboardButtonBuy | types.InputKeyboardButtonURLAuth | types.KeyboardButtonWebView>;
@@ -4,40 +4,61 @@ import { KeyboardButtonPollType } from "./0_keyboard_button_poll_type.js";
4
4
  import { WebAppInfo } from "./0_web_app_info.js";
5
5
  export declare namespace KeyboardButton {
6
6
  interface Text {
7
+ /** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */
7
8
  text: string;
8
9
  }
10
+ /** This object defines the criteria used to request a suitable user. The identifier of the selected user will be shared with the bot when the corresponding button is pressed. [More about requesting users](https://core.telegram.org/bots/features#chat-and-user-selection) */
9
11
  interface RequestUser extends Text {
12
+ /** Optional. If specified, pressing the button will open a list of suitable users. Tapping on any user will send their identifier to the bot in a “user_shared” service message. Available in private chats only. */
10
13
  requestUser: {
14
+ /** Signed 32-bit identifier of the request, which will be received back in the [UserShared](https://core.telegram.org/bots/api#usershared) object. Must be unique within the message */
11
15
  requestId: number;
16
+ /** Optional. Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied. */
12
17
  userIsBot?: boolean;
18
+ /** Optional. Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied. */
13
19
  userIsPremium?: boolean;
14
20
  };
15
21
  }
22
+ /** This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed. [More about requesting chats](https://core.telegram.org/bots/features#chat-and-user-selection) */
16
23
  interface RequestChat extends Text {
24
+ /** Optional. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. */
17
25
  requestChat: {
26
+ /** Signed 32-bit identifier of the request, which will be received back in the [ChatShared](https://core.telegram.org/bots/api#chatshared) object. Must be unique within the message */
18
27
  requestId: number;
28
+ /** Pass True to request a channel chat, pass False to request a group or a supergroup chat. */
19
29
  chatIsChannel: boolean;
30
+ /** Optional. Pass True to request a forum supergroup, pass False to request a non-forum chat. If not specified, no additional restrictions are applied. */
20
31
  chatIsForum?: boolean;
32
+ /** Optional. Pass True to request a supergroup or a channel with a username, pass False to request a chat without a username. If not specified, no additional restrictions are applied. */
21
33
  chatHasUsername?: boolean;
34
+ /** Optional. Pass True to request a chat owned by the user. Otherwise, no additional restrictions are applied. */
22
35
  chatIsCreated?: boolean;
36
+ /** Optional. A JSON-serialized object listing the required administrator rights of the user in the chat. The rights must be a superset of _bot_administrator_rights_. If not specified, no additional restrictions are applied. */
23
37
  userAdministratorRights?: ChatAdministratorRights;
38
+ /** Optional. A JSON-serialized object listing the required administrator rights of the bot in the chat. The rights must be a subset of _user_administrator_rights_. If not specified, no additional restrictions are applied. */
24
39
  botAdministratorRights?: ChatAdministratorRights;
40
+ /** Optional. Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied. */
25
41
  botIsMember?: boolean;
26
42
  };
27
43
  }
28
44
  interface RequestContact extends Text {
45
+ /** Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. */
29
46
  requestContact: true;
30
47
  }
31
48
  interface RequestLocation extends Text {
49
+ /** Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only. */
32
50
  requestLocation: true;
33
51
  }
34
52
  interface RequestPoll extends Text {
53
+ /** Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. */
35
54
  requestPoll: KeyboardButtonPollType;
36
55
  }
37
56
  interface WebApp extends Text {
57
+ /** Optional. If specified, the described [Web App](https://core.telegram.org/bots/webapps) will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only. */
38
58
  webApp: WebAppInfo;
39
59
  }
40
60
  }
61
+ /** This object represents one button of the reply keyboard. For simple text buttons, _String_ can be used instead of this object to specify the button text. The optional fields _web_app_, _request_user_, _request_chat_, _request_contact_, _request_location_, and _request_poll_ are mutually exclusive. */
41
62
  export type KeyboardButton = KeyboardButton.Text | KeyboardButton.RequestUser | KeyboardButton.RequestChat | KeyboardButton.RequestContact | KeyboardButton.RequestLocation | KeyboardButton.RequestPoll | KeyboardButton.WebApp;
42
63
  export declare function constructKeyboardButton(button_: types.TypeKeyboardButton): KeyboardButton;
43
64
  export declare function keyboardButtonToTlObject(button: KeyboardButton): types.KeyboardButtonRequestPhone | types.KeyboardButtonRequestGeoLocation | types.KeyboardButtonRequestPoll | types.KeyboardButtonWebView | types.KeyboardButtonRequestPeer;
@@ -1,10 +1,15 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  import { Thumbnail } from "./0_thumbnail.js";
3
3
  export interface Photo {
4
+ /** Identifier for this file, which can be used to download or reuse the file */
4
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. */
5
7
  fileUniqueId: string;
8
+ /** Photo width */
6
9
  width: number;
10
+ /** Photo height */
7
11
  height: number;
12
+ /** Optional. File size in bytes */
8
13
  fileSize: number;
9
14
  thumbnails: Thumbnail[];
10
15
  }
@@ -1,20 +1,35 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  import { ChatPhoto } from "./0_chat_photo.js";
3
+ /** This object represents a Telegram user or bot. */
3
4
  export interface User {
5
+ /** Unique identifier for this user or bot. 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. */
4
6
  id: number;
5
7
  idColor: string;
8
+ /** True, if this user is a bot */
6
9
  isBot: boolean;
10
+ /** User's or bot's first name */
7
11
  firstName: string;
12
+ /** Optional. User's or bot's last name */
8
13
  lastName?: string;
14
+ /** Optional. User's or bot's username */
9
15
  username?: string;
16
+ /** Optional. Additional usernames */
10
17
  also?: string[];
18
+ /** Optional. Chat photo */
11
19
  photo?: ChatPhoto.User;
20
+ /** Optional. [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the user's language */
12
21
  languageCode?: string;
22
+ /** True, if the user is a scam user */
13
23
  isScam: boolean;
24
+ /** True, if this user was reported by many users as a fake or scam user: be careful when interacting with them. */
14
25
  isFake: boolean;
26
+ /** Optional. True, if this user is a Telegram Premium user */
15
27
  isPremium: boolean;
28
+ /** True, if the user is verified */
16
29
  isVerified: boolean;
30
+ /** True, if the user is an official support user */
17
31
  isSupport: boolean;
32
+ /** Optional. True, if this user added the bot to the attachment menu */
18
33
  addedToAttachmentMenu: boolean;
19
34
  }
20
35
  export declare function constructUser(user_: types.User): User;
@@ -1,6 +1,8 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  import { InlineKeyboardButton, inlineKeyboardButtonToTlObject } from "./1_inline_keyboard_button.js";
3
+ /** This object represents an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards) that appears right next to the message it belongs to. */
3
4
  export interface InlineKeyboardMarkup {
5
+ /** Array of button rows, each represented by an Array of InlineKeyboardButton objects */
4
6
  inlineKeyboard: InlineKeyboardButton[][];
5
7
  }
6
8
  export declare function constructInlineKeyboardMarkup(keyboard_: types.ReplyInlineMarkup): InlineKeyboardMarkup;
@@ -1,11 +1,18 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  import { KeyboardButton } from "./1_keyboard_button.js";
3
+ /** This object represents a [custom keyboard](https://core.telegram.org/bots/features#keyboards) with reply options (see [Introduction to bots](https://core.telegram.org/bots/features#keyboards) for details and examples). */
3
4
  export interface ReplyKeyboardMarkup {
5
+ /** Array of button rows, each represented by an Array of `KeyboardButton` objects */
4
6
  keyboard: KeyboardButton[][];
7
+ /** Optional. Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon. */
5
8
  isPersistent?: boolean;
9
+ /** Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. */
6
10
  resizeKeyboard?: boolean;
11
+ /** Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults to false. */
7
12
  oneTimeKeyboard?: boolean;
13
+ /** Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters */
8
14
  inputFieldPlaceholder?: string;
15
+ /** Optional. Use this parameter if you want to show the keyboard to 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
16
  selective?: boolean;
10
17
  }
11
18
  export declare function constructReplyKeyboardMarkup(keyboard_: types.ReplyKeyboardMarkup): ReplyKeyboardMarkup;
@@ -18,34 +18,63 @@ import { Voice } from "./0_voice.js";
18
18
  import { Dice } from "./0_dice.js";
19
19
  import { Contact } from "./0_contact.js";
20
20
  import { Game } from "./2_game.js";
21
+ /** This object represents a message. */
21
22
  export interface Message {
23
+ /** Unique message identifier inside this chat */
22
24
  id: number;
25
+ /** Optional. Unique identifier of a message thread to which the message belongs; for supergroups only */
23
26
  threadId?: number;
27
+ /** Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
24
28
  from?: User;
29
+ /** Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
25
30
  senderChat?: Chat;
31
+ /** Date the message was sent in Unix time */
26
32
  date?: Date;
33
+ /** Conversation the message belongs to */
27
34
  chat: Chat;
35
+ /** Optional. For forwarded messages, sender of the original message */
28
36
  forwardFrom?: User;
37
+ /** Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat */
29
38
  forwardFromChat?: Chat;
39
+ /** Optional. For messages forwarded from channels, identifier of the original message in the channel */
30
40
  forwardId?: number;
41
+ /** Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present */
31
42
  forwardSignature?: string;
43
+ /** Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages */
32
44
  forwardSenderName?: string;
45
+ /** Optional. For forwarded messages, date the original message was sent in Unix time */
33
46
  forwardDate?: Date;
47
+ /** Optional. True, if the message is sent to a forum topic */
34
48
  isTopicMessage: boolean;
49
+ /** Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group */
35
50
  isAutomaticForward?: boolean;
51
+ /** Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */
36
52
  replyToMessage?: Omit<Message, "replyToMessage">;
53
+ /** Optional. Bot through which the message was sent */
37
54
  viaBot?: User;
55
+ /** Optional. Date the message was last edited in Unix time */
38
56
  editDate?: Date;
57
+ /** Optional. True, if the message can't be forwarded */
39
58
  hasProtectedContent: boolean;
59
+ /** Optional. The unique identifier of a media message group this message belongs to */
40
60
  mediaGroupId?: string;
61
+ /** Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */
41
62
  authorSignature?: string;
63
+ /** Optional. For text messages, the actual UTF-8 text of the message */
42
64
  text?: string;
65
+ /** Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text */
43
66
  entities?: MessageEntity[];
67
+ /** Optional. Caption for the animation, audio, document, photo, video or voice */
44
68
  caption?: string;
69
+ /** Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption */
45
70
  captionEntities?: MessageEntity[];
71
+ /** Optional. True, if the message media is covered by a spoiler animation */
46
72
  hasMediaSpoiler?: boolean;
73
+ /** Optional. View count for channel posts */
47
74
  views?: number;
75
+ /** Optional. Inline keyboard attached to the message. `login_url` buttons are represented as ordinary `url` buttons. */
48
76
  replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
77
+ /** Optional. Message is a photo, available sizes of the photo */
49
78
  photo?: Photo;
50
79
  document?: Document;
51
80
  video?: Video;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "module": "./esm/mod.js",
3
3
  "main": "./script/mod.js",
4
4
  "name": "@mtkruto/node",
5
- "version": "0.0.934",
5
+ "version": "0.0.936",
6
6
  "description": "MTKruto for Node.js",
7
7
  "author": "Roj <rojvv@icloud.com>",
8
8
  "license": "LGPL-3.0-or-later",
@@ -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.934";
7
+ export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.936";
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 = "";
@@ -88,7 +88,7 @@ exports.publicKeys = new Map([
88
88
  exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
89
89
  exports.DEFAULT_INITIAL_DC = "2-test";
90
90
  exports.LAYER = 158;
91
- exports.DEFAULT_APP_VERSION = "MTKruto 0.0.934";
91
+ exports.DEFAULT_APP_VERSION = "MTKruto 0.0.936";
92
92
  // @ts-ignore: lib
93
93
  exports.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;
94
94
  exports.DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -1,16 +1,29 @@
1
1
  import * as types from "../tl/2_types.js";
2
+ /** Represents the rights of an administrator in a chat. */
2
3
  export interface ChatAdministratorRights {
4
+ /** True, if the user's presence in the chat is hidden */
3
5
  isAnonymous: boolean;
6
+ /** True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */
4
7
  canManageChat: boolean;
8
+ /** True, if the administrator can delete messages of other users */
5
9
  canDeleteMessages: boolean;
10
+ /** True, if the administrator can manage video chats */
6
11
  canManageVideoChats: boolean;
12
+ /** True, if the administrator can restrict, ban or unban chat members */
7
13
  canRestrictMembers: boolean;
14
+ /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
8
15
  canPromoteMembers: boolean;
16
+ /** True, if the user is allowed to change the chat title, photo and other settings */
9
17
  canChangeInfo: boolean;
18
+ /** True, if the user is allowed to invite new users to the chat */
10
19
  canInviteUsers: boolean;
20
+ /** Optional. True, if the administrator can post in the channel; channels only */
11
21
  canPostMessages?: boolean;
22
+ /** Optional. True, if the administrator can edit messages of other users and can pin messages; channels only */
12
23
  canEditMessages?: boolean;
24
+ /** Optional. True, if the user is allowed to pin messages; groups and supergroups only */
13
25
  canPinMessages?: boolean;
26
+ /** Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */
14
27
  canManageTopics?: boolean;
15
28
  }
16
29
  export declare function constructChatAdministratorRights(rights_: types.ChatAdminRights): ChatAdministratorRights;
@@ -1,10 +1,15 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  export declare namespace ChatPhoto {
3
3
  interface Base {
4
+ /** File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */
4
5
  smallFileId: string;
6
+ /** Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
5
7
  smallFileUniqueId: string;
8
+ /** File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */
6
9
  bigFileId: string;
10
+ /** Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
7
11
  bigFileUniqueId: string;
12
+ /** True, if an [animated profile picture](https://core.telegram.org/api/files#animated-profile-pictures) is available for the user */
8
13
  hasVideo: boolean;
9
14
  }
10
15
  interface User extends Base {
@@ -12,6 +17,7 @@ export declare namespace ChatPhoto {
12
17
  }
13
18
  type Chat = Base;
14
19
  }
20
+ /** This object represents a chat photo. */
15
21
  export type ChatPhoto = ChatPhoto.User | ChatPhoto.Chat;
16
22
  export declare function constructChatPhoto(photo: types.ChatPhoto, chatId: number, chatAccessHash: bigint): ChatPhoto.Chat;
17
23
  export declare function constructChatPhoto(photo: types.UserProfilePhoto, chatId: number, chatAccessHash: bigint): ChatPhoto.User;
@@ -1,7 +1,11 @@
1
1
  import * as types from "../tl/2_types.js";
2
+ /** Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. */
2
3
  export interface ForceReply {
4
+ /** Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' */
3
5
  forceReply: true;
6
+ /** Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' */
4
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. */
5
9
  selective?: boolean;
6
10
  }
7
11
  export declare function constructForceReply(replyMarkup_: types.ReplyKeyboardForceReply): ForceReply;
@@ -1,3 +1,5 @@
1
+ /** This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. */
1
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. */
2
4
  type?: string;
3
5
  }
@@ -1,6 +1,11 @@
1
+ /** This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the [Telegram Login Widget](https://core.telegram.org/widgets/login) when the user is coming from Telegram. */
1
2
  export interface LoginUrl {
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). */
2
4
  url: string;
5
+ /** Optional. New text of the button in forwarded messages. */
3
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. */
4
8
  botUsername?: string;
9
+ /** Optional. Pass True to request the permission for your bot to send messages to the user. */
5
10
  requestWriteAccess?: boolean;
6
11
  }
@@ -22,7 +22,9 @@ export declare enum MessageEntityType {
22
22
  }
23
23
  export declare namespace MessageEntity {
24
24
  interface Base {
25
+ /** Offset in [UTF-16 code units](https://core.telegram.org/api/entities#entity-length) to the start of the entity */
25
26
  offset: number;
27
+ /** Length of the entity in [UTF-16 code units](https://core.telegram.org/api/entities#entity-length) */
26
28
  length: number;
27
29
  }
28
30
  interface Mention extends Base {
@@ -48,6 +50,7 @@ export declare namespace MessageEntity {
48
50
  }
49
51
  interface Pre extends Base {
50
52
  type: MessageEntityType.Pre;
53
+ /** Optional. For “pre” only, the programming language of the entity text */
51
54
  language: string;
52
55
  }
53
56
  interface Code extends Base {
@@ -55,10 +58,12 @@ export declare namespace MessageEntity {
55
58
  }
56
59
  interface TextURL extends Base {
57
60
  type: MessageEntityType.TextURL;
61
+ /** Optional. For “text_link” only, URL that will be opened after user taps on the text */
58
62
  url: string;
59
63
  }
60
64
  interface MentionName extends Base {
61
65
  type: MessageEntityType.MentionName;
66
+ /** Optional. For “text_mention” only, the ID of the mentioned user */
62
67
  userId: number;
63
68
  }
64
69
  interface Cashtag extends Base {
@@ -84,9 +89,11 @@ export declare namespace MessageEntity {
84
89
  }
85
90
  interface CustomEmoji extends Base {
86
91
  type: MessageEntityType.CustomEmoji;
92
+ /** Optional. For “custom_emoji” only, unique identifier of the custom emoji */
87
93
  customEmojiId: string;
88
94
  }
89
95
  }
96
+ /** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */
90
97
  export type MessageEntity = MessageEntity.Mention | MessageEntity.Hashtag | MessageEntity.BotCommand | MessageEntity.URL | MessageEntity.EmailAddress | MessageEntity.Bold | MessageEntity.Italic | MessageEntity.Code | MessageEntity.Pre | MessageEntity.TextURL | MessageEntity.MentionName | MessageEntity.Cashtag | MessageEntity.Phone | MessageEntity.Underline | MessageEntity.Strike | MessageEntity.Blockquote | MessageEntity.BankCard | MessageEntity.Spoiler | MessageEntity.CustomEmoji;
91
98
  export declare function constructMessageEntity(obj: types.TypeMessageEntity): MessageEntity | null;
92
99
  export declare function messageEntityToTlObject(entity: MessageEntity): types.MessageEntityMention | types.MessageEntityHashtag | types.MessageEntityBotCommand | types.MessageEntityURL | types.MessageEntityEmail | types.MessageEntityBold | types.MessageEntityItalic | types.MessageEntityCode | types.MessageEntityPre | types.MessageEntityTextURL | types.MessageEntityMentionName | types.MessageEntityPhone | types.MessageEntityCashtag | types.MessageEntityUnderline | types.MessageEntityStrike | types.MessageEntityBlockquote | types.MessageEntityBankCard | types.MessageEntitySpoiler | types.MessageEntityCustomEmoji;
@@ -1,6 +1,9 @@
1
1
  import * as types from "../tl/2_types.js";
2
+ /** Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button. */
2
3
  export interface ReplyKeyboardRemove {
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`) */
3
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. */
4
7
  selective?: boolean;
5
8
  }
6
9
  export declare function constructReplyKeyboardRemove(replyMarkup_: types.ReplyKeyboardHide): ReplyKeyboardRemove;
@@ -1,9 +1,14 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  export interface Thumbnail {
3
+ /** Identifier for this file, which can be used to download or reuse the file */
3
4
  fileId: string;
5
+ /** 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
6
  fileUniqueId: string;
7
+ /** Photo width */
5
8
  width: number;
9
+ /** Photo height */
6
10
  height: number;
11
+ /** Optional. File size in bytes */
7
12
  fileSize: number;
8
13
  }
9
14
  export declare function constructThumbnail(size: types.PhotoSize, file: types.Document | types.Photo): Thumbnail;
@@ -1,4 +1,6 @@
1
+ /** Describes a [Web App](https://core.telegram.org/bots/webapps). */
1
2
  export interface WebAppInfo {
3
+ /** An HTTPS URL of a Web App to be opened with additional data as specified in [Initializing Web Apps](https://core.telegram.org/bots/webapps#initializing-web-apps) */
2
4
  url: string;
3
5
  }
4
6
  export declare function constructWebAppInfo(url: string): WebAppInfo;
@@ -8,54 +8,86 @@ export declare enum ChatType {
8
8
  }
9
9
  export declare namespace Chat {
10
10
  interface Base {
11
+ /** Type of chat, can be either “private”, “group”, “supergroup” or “channel” */
11
12
  type: ChatType;
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. */
12
14
  id: number;
13
15
  idColor: string;
16
+ /** Optional. Chat photo. */
14
17
  photo?: ChatPhoto;
15
18
  }
16
19
  interface Private extends Base {
17
20
  type: ChatType.Private;
21
+ /** True, if this user is a bot */
18
22
  isBot?: boolean;
23
+ /** Optional. First name of the other party in a private chat */
19
24
  firstName: string;
25
+ /** Optional. Last name of the other party in a private chat */
20
26
  lastName?: string;
27
+ /** Optional. Username, for private chats, supergroups and channels if available */
21
28
  username?: string;
29
+ /** Optional. Additional usernames */
22
30
  also?: string[];
31
+ /** Optional. Chat photo. */
23
32
  photo?: ChatPhoto.User;
33
+ /** True, if the user is a scam user */
24
34
  isScam: boolean;
35
+ /** True, if this user was reported by many users as a fake or scam user: be careful when interacting with them. */
25
36
  isFake: boolean;
37
+ /** True, if the user is an official support user */
26
38
  isSupport: boolean;
39
+ /** True, if the user is verified */
27
40
  isVerified: boolean;
41
+ /** True, if the access to the user must be restricted for the reason specified in `restriction_reason` */
28
42
  isRestricted?: boolean;
43
+ /** Optional. Contains the reason why access to the user must be restricted. */
29
44
  restrictionReason?: types.RestrictionReason[];
30
45
  }
31
46
  interface Group extends Base {
32
47
  type: ChatType.Group;
48
+ /** Optional. Title, for supergroups, channels and group chats */
33
49
  title: string;
50
+ /** Optional. Chat photo. */
34
51
  photo?: ChatPhoto.Chat;
52
+ /** True, if the user is creator of the chat */
35
53
  isCreator: boolean;
36
54
  }
37
55
  interface ChannelBase extends Base {
56
+ /** Optional. Title, for supergroups, channels and group chats */
38
57
  title: string;
58
+ /** Optional. Username, for private chats, supergroups and channels if available */
39
59
  username?: string;
60
+ /** Optional. Additional usernames */
40
61
  also?: string[];
62
+ /** Optional. Chat photo. */
41
63
  photo?: ChatPhoto.Chat;
64
+ /** True, if the user is a scam user */
42
65
  isScam: boolean;
66
+ /** True, if this user was reported by many users as a fake or scam user: be careful when interacting with them. */
43
67
  isFake: boolean;
68
+ /** True, if the user is verified */
44
69
  isVerified: boolean;
70
+ /** True, if the access to the user must be restricted for the reason specified in `restriction_reason` */
45
71
  isRestricted: boolean;
72
+ /** Optional. Contains the reason why access to the user must be restricted. */
46
73
  restrictionReason?: types.RestrictionReason[];
47
74
  }
48
75
  interface Channel extends ChannelBase {
49
76
  type: ChatType.Channel;
77
+ /** Optional. Title, for supergroups, channels and group chats */
50
78
  title: string;
79
+ /** Optional. Username, for private chats, supergroups and channels if available */
51
80
  username?: string;
81
+ /** Optional. Additional usernames */
52
82
  also?: string[];
53
83
  }
54
84
  interface Supergroup extends ChannelBase {
55
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) */
56
87
  isForum: boolean;
57
88
  }
58
89
  }
90
+ /** This object represents a chat. */
59
91
  export type Chat = Chat.Private | Chat.Group | Chat.Supergroup | Chat.Channel;
60
92
  export declare function constructChat(chat: types.User): Chat.Private;
61
93
  export declare function constructChat(chat: types.Chat): Chat.Group;
@@ -4,33 +4,42 @@ import { WebAppInfo } from "./0_web_app_info.js";
4
4
  import { LoginUrl } from "./0_login_url.js";
5
5
  export declare namespace InlineKeyboardButton {
6
6
  interface Base {
7
+ /** Label text on the button */
7
8
  text: string;
8
9
  }
9
10
  interface URL extends Base {
11
+ /** Optional. HTTP or tg:// URL to be opened when the button is pressed. Links `tg://user?id=<user_id>` can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. */
10
12
  url: string;
11
13
  }
12
14
  interface Callback extends Base {
15
+ /** Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes */
13
16
  callbackData: string;
14
17
  }
15
18
  interface WebApp extends Base {
19
+ /** Optional. Description of the [Web App](https://core.telegram.org/bots/webapps) that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. */
16
20
  webApp: WebAppInfo;
17
21
  }
18
22
  interface Login extends Base {
23
+ /** Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the [Telegram Login Widget](https://core.telegram.org/widgets/login). */
19
24
  loginUrl: LoginUrl;
20
25
  }
21
26
  interface SwitchInline extends Base {
27
+ /** Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. */
22
28
  switchInlineQuery: string;
23
29
  }
24
30
  interface SwitchInlineCurrent extends Base {
31
+ /** Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted. */
25
32
  switchInlineQueryCurrentChat: string;
26
33
  }
27
34
  interface Game extends Base {
28
35
  callbackGame: Record<never, never>;
29
36
  }
30
37
  interface Pay extends Base {
38
+ /** Optional. Specify True, to send a [Pay button](https://core.telegram.org/bots/api#payments). */
31
39
  pay: boolean;
32
40
  }
33
41
  }
42
+ /** This object represents one button of an inline keyboard. You **must** use exactly one of the optional fields. */
34
43
  export type InlineKeyboardButton = InlineKeyboardButton.URL | InlineKeyboardButton.Callback | InlineKeyboardButton.WebApp | InlineKeyboardButton.Login | InlineKeyboardButton.SwitchInline | InlineKeyboardButton.SwitchInlineCurrent | InlineKeyboardButton.Game | InlineKeyboardButton.Pay;
35
44
  export declare function constructInlineKeyboardButton(button_: types.TypeKeyboardButton): InlineKeyboardButton;
36
45
  export declare function inlineKeyboardButtonToTlObject(button: InlineKeyboardButton, usernameResolver: (username: string) => MaybePromise<types.InputUser>): Promise<types.KeyboardButtonURL | types.KeyboardButtonCallback | types.KeyboardButtonSwitchInline | types.KeyboardButtonBuy | types.InputKeyboardButtonURLAuth | types.KeyboardButtonWebView>;
@@ -4,40 +4,61 @@ import { KeyboardButtonPollType } from "./0_keyboard_button_poll_type.js";
4
4
  import { WebAppInfo } from "./0_web_app_info.js";
5
5
  export declare namespace KeyboardButton {
6
6
  interface Text {
7
+ /** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */
7
8
  text: string;
8
9
  }
10
+ /** This object defines the criteria used to request a suitable user. The identifier of the selected user will be shared with the bot when the corresponding button is pressed. [More about requesting users](https://core.telegram.org/bots/features#chat-and-user-selection) */
9
11
  interface RequestUser extends Text {
12
+ /** Optional. If specified, pressing the button will open a list of suitable users. Tapping on any user will send their identifier to the bot in a “user_shared” service message. Available in private chats only. */
10
13
  requestUser: {
14
+ /** Signed 32-bit identifier of the request, which will be received back in the [UserShared](https://core.telegram.org/bots/api#usershared) object. Must be unique within the message */
11
15
  requestId: number;
16
+ /** Optional. Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied. */
12
17
  userIsBot?: boolean;
18
+ /** Optional. Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied. */
13
19
  userIsPremium?: boolean;
14
20
  };
15
21
  }
22
+ /** This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed. [More about requesting chats](https://core.telegram.org/bots/features#chat-and-user-selection) */
16
23
  interface RequestChat extends Text {
24
+ /** Optional. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. */
17
25
  requestChat: {
26
+ /** Signed 32-bit identifier of the request, which will be received back in the [ChatShared](https://core.telegram.org/bots/api#chatshared) object. Must be unique within the message */
18
27
  requestId: number;
28
+ /** Pass True to request a channel chat, pass False to request a group or a supergroup chat. */
19
29
  chatIsChannel: boolean;
30
+ /** Optional. Pass True to request a forum supergroup, pass False to request a non-forum chat. If not specified, no additional restrictions are applied. */
20
31
  chatIsForum?: boolean;
32
+ /** Optional. Pass True to request a supergroup or a channel with a username, pass False to request a chat without a username. If not specified, no additional restrictions are applied. */
21
33
  chatHasUsername?: boolean;
34
+ /** Optional. Pass True to request a chat owned by the user. Otherwise, no additional restrictions are applied. */
22
35
  chatIsCreated?: boolean;
36
+ /** Optional. A JSON-serialized object listing the required administrator rights of the user in the chat. The rights must be a superset of _bot_administrator_rights_. If not specified, no additional restrictions are applied. */
23
37
  userAdministratorRights?: ChatAdministratorRights;
38
+ /** Optional. A JSON-serialized object listing the required administrator rights of the bot in the chat. The rights must be a subset of _user_administrator_rights_. If not specified, no additional restrictions are applied. */
24
39
  botAdministratorRights?: ChatAdministratorRights;
40
+ /** Optional. Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied. */
25
41
  botIsMember?: boolean;
26
42
  };
27
43
  }
28
44
  interface RequestContact extends Text {
45
+ /** Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. */
29
46
  requestContact: true;
30
47
  }
31
48
  interface RequestLocation extends Text {
49
+ /** Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only. */
32
50
  requestLocation: true;
33
51
  }
34
52
  interface RequestPoll extends Text {
53
+ /** Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. */
35
54
  requestPoll: KeyboardButtonPollType;
36
55
  }
37
56
  interface WebApp extends Text {
57
+ /** Optional. If specified, the described [Web App](https://core.telegram.org/bots/webapps) will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only. */
38
58
  webApp: WebAppInfo;
39
59
  }
40
60
  }
61
+ /** This object represents one button of the reply keyboard. For simple text buttons, _String_ can be used instead of this object to specify the button text. The optional fields _web_app_, _request_user_, _request_chat_, _request_contact_, _request_location_, and _request_poll_ are mutually exclusive. */
41
62
  export type KeyboardButton = KeyboardButton.Text | KeyboardButton.RequestUser | KeyboardButton.RequestChat | KeyboardButton.RequestContact | KeyboardButton.RequestLocation | KeyboardButton.RequestPoll | KeyboardButton.WebApp;
42
63
  export declare function constructKeyboardButton(button_: types.TypeKeyboardButton): KeyboardButton;
43
64
  export declare function keyboardButtonToTlObject(button: KeyboardButton): types.KeyboardButtonRequestPhone | types.KeyboardButtonRequestGeoLocation | types.KeyboardButtonRequestPoll | types.KeyboardButtonWebView | types.KeyboardButtonRequestPeer;
@@ -1,10 +1,15 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  import { Thumbnail } from "./0_thumbnail.js";
3
3
  export interface Photo {
4
+ /** Identifier for this file, which can be used to download or reuse the file */
4
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. */
5
7
  fileUniqueId: string;
8
+ /** Photo width */
6
9
  width: number;
10
+ /** Photo height */
7
11
  height: number;
12
+ /** Optional. File size in bytes */
8
13
  fileSize: number;
9
14
  thumbnails: Thumbnail[];
10
15
  }
@@ -1,20 +1,35 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  import { ChatPhoto } from "./0_chat_photo.js";
3
+ /** This object represents a Telegram user or bot. */
3
4
  export interface User {
5
+ /** Unique identifier for this user or bot. 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. */
4
6
  id: number;
5
7
  idColor: string;
8
+ /** True, if this user is a bot */
6
9
  isBot: boolean;
10
+ /** User's or bot's first name */
7
11
  firstName: string;
12
+ /** Optional. User's or bot's last name */
8
13
  lastName?: string;
14
+ /** Optional. User's or bot's username */
9
15
  username?: string;
16
+ /** Optional. Additional usernames */
10
17
  also?: string[];
18
+ /** Optional. Chat photo */
11
19
  photo?: ChatPhoto.User;
20
+ /** Optional. [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the user's language */
12
21
  languageCode?: string;
22
+ /** True, if the user is a scam user */
13
23
  isScam: boolean;
24
+ /** True, if this user was reported by many users as a fake or scam user: be careful when interacting with them. */
14
25
  isFake: boolean;
26
+ /** Optional. True, if this user is a Telegram Premium user */
15
27
  isPremium: boolean;
28
+ /** True, if the user is verified */
16
29
  isVerified: boolean;
30
+ /** True, if the user is an official support user */
17
31
  isSupport: boolean;
32
+ /** Optional. True, if this user added the bot to the attachment menu */
18
33
  addedToAttachmentMenu: boolean;
19
34
  }
20
35
  export declare function constructUser(user_: types.User): User;
@@ -1,6 +1,8 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  import { InlineKeyboardButton, inlineKeyboardButtonToTlObject } from "./1_inline_keyboard_button.js";
3
+ /** This object represents an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards) that appears right next to the message it belongs to. */
3
4
  export interface InlineKeyboardMarkup {
5
+ /** Array of button rows, each represented by an Array of InlineKeyboardButton objects */
4
6
  inlineKeyboard: InlineKeyboardButton[][];
5
7
  }
6
8
  export declare function constructInlineKeyboardMarkup(keyboard_: types.ReplyInlineMarkup): InlineKeyboardMarkup;
@@ -1,11 +1,18 @@
1
1
  import * as types from "../tl/2_types.js";
2
2
  import { KeyboardButton } from "./1_keyboard_button.js";
3
+ /** This object represents a [custom keyboard](https://core.telegram.org/bots/features#keyboards) with reply options (see [Introduction to bots](https://core.telegram.org/bots/features#keyboards) for details and examples). */
3
4
  export interface ReplyKeyboardMarkup {
5
+ /** Array of button rows, each represented by an Array of `KeyboardButton` objects */
4
6
  keyboard: KeyboardButton[][];
7
+ /** Optional. Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon. */
5
8
  isPersistent?: boolean;
9
+ /** Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. */
6
10
  resizeKeyboard?: boolean;
11
+ /** Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults to false. */
7
12
  oneTimeKeyboard?: boolean;
13
+ /** Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters */
8
14
  inputFieldPlaceholder?: string;
15
+ /** Optional. Use this parameter if you want to show the keyboard to 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
16
  selective?: boolean;
10
17
  }
11
18
  export declare function constructReplyKeyboardMarkup(keyboard_: types.ReplyKeyboardMarkup): ReplyKeyboardMarkup;
@@ -18,34 +18,63 @@ import { Voice } from "./0_voice.js";
18
18
  import { Dice } from "./0_dice.js";
19
19
  import { Contact } from "./0_contact.js";
20
20
  import { Game } from "./2_game.js";
21
+ /** This object represents a message. */
21
22
  export interface Message {
23
+ /** Unique message identifier inside this chat */
22
24
  id: number;
25
+ /** Optional. Unique identifier of a message thread to which the message belongs; for supergroups only */
23
26
  threadId?: number;
27
+ /** Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
24
28
  from?: User;
29
+ /** Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
25
30
  senderChat?: Chat;
31
+ /** Date the message was sent in Unix time */
26
32
  date?: Date;
33
+ /** Conversation the message belongs to */
27
34
  chat: Chat;
35
+ /** Optional. For forwarded messages, sender of the original message */
28
36
  forwardFrom?: User;
37
+ /** Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat */
29
38
  forwardFromChat?: Chat;
39
+ /** Optional. For messages forwarded from channels, identifier of the original message in the channel */
30
40
  forwardId?: number;
41
+ /** Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present */
31
42
  forwardSignature?: string;
43
+ /** Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages */
32
44
  forwardSenderName?: string;
45
+ /** Optional. For forwarded messages, date the original message was sent in Unix time */
33
46
  forwardDate?: Date;
47
+ /** Optional. True, if the message is sent to a forum topic */
34
48
  isTopicMessage: boolean;
49
+ /** Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group */
35
50
  isAutomaticForward?: boolean;
51
+ /** Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */
36
52
  replyToMessage?: Omit<Message, "replyToMessage">;
53
+ /** Optional. Bot through which the message was sent */
37
54
  viaBot?: User;
55
+ /** Optional. Date the message was last edited in Unix time */
38
56
  editDate?: Date;
57
+ /** Optional. True, if the message can't be forwarded */
39
58
  hasProtectedContent: boolean;
59
+ /** Optional. The unique identifier of a media message group this message belongs to */
40
60
  mediaGroupId?: string;
61
+ /** Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */
41
62
  authorSignature?: string;
63
+ /** Optional. For text messages, the actual UTF-8 text of the message */
42
64
  text?: string;
65
+ /** Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text */
43
66
  entities?: MessageEntity[];
67
+ /** Optional. Caption for the animation, audio, document, photo, video or voice */
44
68
  caption?: string;
69
+ /** Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption */
45
70
  captionEntities?: MessageEntity[];
71
+ /** Optional. True, if the message media is covered by a spoiler animation */
46
72
  hasMediaSpoiler?: boolean;
73
+ /** Optional. View count for channel posts */
47
74
  views?: number;
75
+ /** Optional. Inline keyboard attached to the message. `login_url` buttons are represented as ordinary `url` buttons. */
48
76
  replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
77
+ /** Optional. Message is a photo, available sizes of the photo */
49
78
  photo?: Photo;
50
79
  document?: Document;
51
80
  video?: Video;