teletron-ts
Version:
Fast and Flexible Telegram Bot API Framework for Node.js written in TypeScript.
1,563 lines (1,516 loc) • 136 kB
TypeScript
/**
* This object represents one size of a photo or a file / sticker thumbnail.
*/
interface IPhotoSize {
/**
* Identifier for this file, which can be used to download or reuse the file
*/
file_id: string;
/**
* 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.
*/
file_unique_id: string;
/**
* Photo width
*/
width: number;
/**
* Photo height
*/
height: number;
/**
* Optional. File size in bytes
*/
file_size?: number;
}
/**
* This object represents an audio file to be treated as music by the Telegram clients.
*/
interface IAudio {
/**
* Identifier for this file, which can be used to download or reuse the file
*/
file_id: string;
/**
* 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.
*/
file_unique_id: string;
/**
* Duration of the audio in seconds as defined by sender
*/
duration: number;
/**
* Optional. Performer of the audio as defined by sender or by audio tags
*/
performer?: string;
/**
* Optional. Title of the audio as defined by sender or by audio tags
*/
title?: string;
/**
* Optional. Original filename as defined by sender
*/
file_name?: string;
/**
* Optional. MIME type of the file as defined by sender
*/
mime_type?: string;
/**
* Optional. File size in bytes
*/
file_size?: number;
/**
* Optional. Thumbnail of the album cover to which the music file belongs
*/
thumb?: IPhotoSize;
}
/**
* A placeholder, currently holds no information. Use BotFather to set up your game.
*/
interface ICallbackGame {
}
/**
* This object represents a message.
*/
interface IMessage {
/**
* Unique message identifier inside this chat
*/
message_id: number;
/**
* Optional. Sender of the message; empty for messages sent to channels.
*/
from: IUser;
/**
* 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
*/
sender_chat: IChat;
/**
* Date the message was sent in Unix time
*/
date: number;
/**
* Conversation the message belongs to
*/
chat: IChat;
/**
* Optional. For forwarded messages, sender of the original message
*/
forward_from: IUser;
/**
* Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat
*/
forward_from_chat: IChat;
/**
* Optional. For messages forwarded from channels, identifier of the original message in the channel
*/
forward_from_message_id: number;
/**
* Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present
*/
forward_signature: string;
/**
* Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages
*/
forward_sender_name: string;
/**
* Optional. For forwarded messages, date the original message was sent in Unix time
*/
forward_date: number;
/**
* Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group
*/
is_automatic_forward: boolean;
/**
* 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.
*/
reply_to_message: IMessage;
/**
* Optional. Bot through which the message was sent
*/
via_bot: IUser;
/**
* Optional. Date the message was last edited in Unix time
*/
edit_date: number;
/**
* Optional. True, if the message can't be forwarded
*/
has_protected_content: boolean;
/**
* Optional. The unique identifier of a media message group this message belongs to
*/
media_group_id: string;
/**
* Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
*/
author_signature: string;
/**
* Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters
*/
text: string;
/**
* Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
*/
entities: IMessageEntity[];
/**
* Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set
*/
animation: IAnimation;
/**
* Optional. Message is an audio file, information about the file
*/
audio: IAudio;
/**
* Optional. Message is a general file, information about the file
*/
document: IDocument;
/**
* Optional. Message is a photo, available sizes of the photo
*/
photo: IPhotoSize[];
/**
* Optional. Message is a sticker, information about the sticker
*/
sticker: ISticker;
/**
* Optional. Message is a video, information about the video
*/
video: IVideo;
/**
* Optional. Message is a video note, information about the video message
*/
video_note: IVideoNote;
/**
* Optional. Message is a voice message, information about the file
*/
voice: IVoice;
/**
* Optional. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters
*/
caption: string;
/**
* Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
*/
caption_entities: IMessageEntity[];
/**
* Optional. Message is a shared contact, information about the contact
*/
contact: IContact;
/**
* Optional. Message is a dice with random value
*/
dice: IDice;
/**
* Optional. Message is a game, information about the game. More about games »
*/
game: IGame;
/**
* Optional. Message is a native poll, information about the poll
*/
poll: IPoll;
/**
* Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set
*/
venue: IVenue;
/**
* Optional. Message is a shared location, information about the location
*/
location: ILocation;
/**
* Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
*/
new_chat_members: IUser[];
/**
* Optional. A member was removed from the group, information about them (this member may be the bot itself)
*/
left_chat_member: IUser;
/**
* Optional. A chat title was changed to this value
*/
new_chat_title: string;
/**
* Optional. A chat photo was change to this value
*/
new_chat_photo: IPhotoSize[];
/**
* Optional. Service message: the chat photo was deleted
*/
delete_chat_photo: boolean;
/**
* Optional. Service message: the group has been created
*/
group_chat_created: boolean;
/**
* Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.
*/
supergroup_chat_created: boolean;
/**
* Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.
*/
channel_chat_created: boolean;
/**
* Optional. Service message: auto-delete timer settings changed in the chat
*/
message_auto_delete_timer_changed: IMessageAutoDeleteTimerChanged;
/**
* Optional. The group has been migrated to a supergroup with the specified identifier. 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.
*/
migrate_to_chat_id: number;
/**
* Optional. The supergroup has been migrated from a group with the specified identifier. 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.
*/
migrate_from_chat_id: number;
/**
* Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply
*/
pinned_message: IMessage;
/**
* Optional. Message is an invoice for a payment, information about the invoice.
*/
invoice: IInvoice;
/**
* Optional. Message is a service message about a successful payment, information about the payment.
*/
successful_payment: ISuccessfulPayment;
/**
* Optional. The domain name of the website on which the user has logged in
*/
connected_website: string;
/**
* Optional. Telegram Passport data
*/
passport_data: IPassportData;
/**
* Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.
*/
proximity_alert_triggered: IProximityAlertTriggered;
/**
* Optional. Service message: voice chat scheduled
*/
voice_chat_scheduled: IVoiceChatScheduled;
/**
* Optional. Service message: voice chat started
*/
voice_chat_started: IVoiceChatStarted;
/**
* Optional. Service message: voice chat ended
*/
voice_chat_ended: IVoiceChatEnded;
/**
* Optional. Service message: new participants invited to a voice chat
*/
voice_chat_participants_invited: IVoiceChatParticipantsInvited;
/**
* Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
*/
reply_markup: IInlineKeyboardMarkup;
}
/**
* This object represents a Telegram user or bot.
*/
interface IUser {
/**
* Unique identifier for this user or bot.
*/
id: number;
/**
* True, if this user is a bot
*/
is_bot: boolean;
/**
* User's or bot's first name
*/
first_name: string;
/**
* Optional. User's or bot's last name
*/
last_name?: string;
/**
* Optional. User's or bot's username
*/
username?: string;
/**
* Optional. IETF language tag of the user's language
*/
language_code?: string;
/**
* Optional. True, if the bot can be invited to groups. Returned only in getMe.
*/
can_join_groups?: boolean;
/**
* Optional. True, if privacy mode is disabled for the bot. Returned only in getMe.
*/
can_read_all_group_messages?: boolean;
/**
* Optional. True, if the bot supports inline queries. Returned only in getMe.
*/
supports_inline_queries?: boolean;
}
/**
* This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
*/
interface ICallbackQuery {
/**
* Unique identifier for this query
*/
id: string;
/**
* Sender
*/
from: IUser;
/**
* Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old
*/
message?: IMessage;
/**
* Optional. Identifier of the message sent via the bot in inline mode, that originated the query.
*/
inline_message_id?: string;
/**
* Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games.
*/
chat_instance?: string;
/**
* Optional. Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field.
*/
data?: string;
/**
* Optional. Short name of a Game to be returned, serves as the unique identifier for the game
*/
game_short_name?: string;
}
/**
* This object represents a chat.
*/
interface IChat {
/**
* Unique identifier for this chat.
*/
id: number;
/**
* Type of chat, can be either “private”, “group”, “supergroup” or “channel”
*/
type: string;
/**
* Optional. Title, for supergroups, channels and group chats
*/
title?: string;
/**
* Optional. Username, for private chats, supergroups and channels if available
*/
username?: string;
/**
* Optional. First name of the other party in a private chat
*/
first_name?: string;
/**
* Optional. Last name of the other party in a private chat
*/
last_name?: string;
/**
* Optional. Chat photo. Returned only in getChat.
*/
photo?: IChatPhoto;
/**
* Optional. Bio of the other party in a private chat. Returned only in getChat.
*/
bio?: string;
/**
* Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat.
*/
has_private_forwards?: boolean;
/**
* Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.
*/
description?: string;
/**
* Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
*/
invite_link?: string;
/**
* Optional. The most recent pinned message (by sending date). Returned only in getChat.
*/
pinned_message?: IMessage;
/**
* Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
*/
permissions?: IChatPermissions;
/**
* Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat.
*/
slow_mode_delay?: number;
/**
* Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.
*/
message_auto_delete_time?: number;
/**
* Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat.
*/
has_protected_content?: boolean;
/**
* Optional. For supergroups, name of group sticker set. Returned only in getChat.
*/
sticker_set_name?: string;
/**
* Optional. True, if the bot can change the group sticker set. Returned only in getChat.
*/
can_set_sticker_set?: boolean;
/**
* Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats
*/
linked_chat_id?: number;
/**
* Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
*/
location?: IChatLocation;
}
/**
* Represents an invite link for a chat.
*/
interface IChatInviteLink {
/**
* The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”.
*/
invite_link: string;
/**
* Creator of the link
*/
creator: IUser;
/**
* True, if users joining the chat via the link need to be approved by chat administrators
*/
creates_join_request: boolean;
/**
* True, if the link is primary
*/
is_primary: boolean;
/**
* True, if the link is revoked
*/
is_revoked: boolean;
/**
* Optional. Invite link name
*/
name?: string;
/**
* Optional. Point in time (Unix timestamp) when the link will expire or has been expired
*/
expire_date?: number;
/**
* Optional. Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
*/
member_limit?: number;
/**
* Optional. Number of pending join requests created using this link
*/
pending_join_request_count?: number;
}
/**
* Represents a join request sent to a chat.
*/
interface IChatJoinRequest {
/**
* Chat to which the request was sent
*/
chat: IChat;
/**
* User that sent the join request
*/
from: IUser;
/**
* Date the request was sent in Unix time
*/
date: number;
/**
* Optional. Bio of the user.
*/
bio?: string;
/**
* Optional. Chat invite link that was used by the user to send the join request
*/
invite_link?: IChatInviteLink;
}
/**
* This object represents a point on the map.
*/
interface ILocation {
/**
* Longitude as defined by sender
*/
longitude: number;
/**
* Latitude as defined by sender
*/
latitude: number;
/**
* Optional. The radius of uncertainty for the location, measured in meters; 0-1500
*/
horizontal_accuracy?: number;
/**
* Optional. Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only.
*/
live_period?: number;
/**
* Optional. The direction in which user is moving, in degrees; 1-360. For active live locations only.
*/
heading?: number;
/**
* Optional. Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only.
*/
proximity_alert_radius?: number;
}
/**
* Represents a location to which a chat is connected.
*/
interface IChatLocation {
/**
* The location to which the supergroup is connected. Can't be a live location.
*/
location: ILocation;
/**
* Location address; 1-64 characters, as defined by the chat owner
*/
address: string;
}
/**
* Describes actions that a non-administrator user is allowed to take in a chat.
*/
interface IChatPermissions {
/**
* Optional. True, if the user is allowed to send text messages, contacts, locations and venues
*/
can_send_messages?: boolean;
/**
* Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages
*/
can_send_media_messages?: boolean;
/**
* Optional. True, if the user is allowed to send polls, implies can_send_messages
*/
can_send_polls?: boolean;
/**
* Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages
*/
can_send_other_messages?: boolean;
/**
* Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages
*/
can_add_web_page_previews?: boolean;
/**
* Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups
*/
can_change_info?: boolean;
/**
* Optional. True, if the user is allowed to invite new users to the chat
*/
can_invite_users?: boolean;
/**
* Optional. True, if the user is allowed to pin messages. Ignored in public supergroups
*/
can_pin_messages?: boolean;
}
/**
* This object represents a chat photo.
*/
interface IChatPhoto {
/**
* 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.
*/
small_file_id: string;
/**
* 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.
*/
small_file_unique_id: string;
/**
* 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.
*/
big_file_id: string;
/**
* 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.
*/
big_file_unique_id: string;
}
/**
* Represents a result of an inline query that was chosen by the user and sent to their chat partner.
*/
interface IChosenInlineResult {
/**
* The unique identifier for the result that was chosen
*/
result_id: string;
/**
* The user that chose the result
*/
from: IUser;
/**
* Optional. Sender location, only for bots that require user location
*/
location?: ILocation;
/**
* Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message
*/
inline_message_id?: string;
/**
* The query that was used to obtain the result
*/
query?: string;
}
/**
* This object represents a phone contact.
*/
interface IContact {
/**
* Contact's phone number
*/
phone_number: string;
/**
* Contact's first name
*/
first_name: string;
/**
* Optional. Contact's last name
*/
last_name?: string;
/**
* Optional. 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.
*/
user_id?: number;
/**
* Optional. Additional data about the contact in the form of a vCard
*/
vcard?: string;
}
/**
* This object represents an animated emoji that displays a random value.
*/
interface IDice {
/**
* Emoji on which the dice throw animation is based
*/
emoji: string;
/**
* Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” and “⚽” base emoji, 1-64 for “🎰” base emoji
*/
value: number;
}
/**
* This object represents a general file (as opposed to photos, voice messages and audio files).
*/
interface IDocument {
/**
* Identifier for this file, which can be used to download or reuse the file
*/
file_id: string;
/**
* 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.
*/
file_unique_id: string;
/**
* Optional. Document thumbnail as defined by sender
*/
thumb?: IPhotoSize;
/**
* Optional. Original filename as defined by sender
*/
file_name?: string;
/**
* Optional. MIME type of the file as defined by sender
*/
mime_type?: string;
/**
* Optional. File size in bytes
*/
file_size?: number;
}
/**
* Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.
*/
interface IEncryptedCredentials {
/**
* Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication
*/
data: string;
/**
* Base64-encoded data hash for data authentication
*/
hash: string;
/**
* Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption
*/
secret: string;
}
/**
* This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.
*/
interface IPassportFile {
/**
* Identifier for this file, which can be used to download or reuse the file
*/
file_id: string;
/**
* 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.
*/
file_unique_id: string;
/**
* File size in bytes
*/
file_size: number;
/**
* Unix time when the file was uploaded
*/
file_date: number;
}
/**
* Contains information about documents or other Telegram Passport elements shared with the bot by the user.
*/
interface IEncryptedPassportElement {
/**
* Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.
*/
type: string;
/**
* Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials.
*/
data: string;
/**
* Optional. User's verified phone number, available only for “phone_number” type
*/
phone_number?: string;
/**
* Optional. User's verified email address, available only for “email” type
*/
email?: string;
/**
* Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
*/
files?: IPassportFile[];
/**
* Optional. Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
*/
front_side?: IPassportFile;
/**
* Optional. Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
*/
reverse_side?: IPassportFile;
/**
* Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
*/
selfie?: IPassportFile;
/**
* Optional. Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
*/
translation?: IPassportFile[];
/**
* Base64-encoded element hash for using in PassportElementErrorUnspecified
*/
hash: string;
}
/**
* This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
*/
interface IGame {
/**
* Title of the game
*/
title: string;
/**
* Description of the game
*/
description: string;
/**
* Photo that will be displayed in the game message in chats.
*/
photo: IPhotoSize[];
/**
* Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
*/
text?: string;
/**
* Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc.
*/
text_entities?: IMessageEntity[];
/**
* Optional. Animation that will be displayed in the game message in chats. Upload via BotFather
*/
animation?: IAnimation;
}
/**
* This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
*/
interface IAnimation {
/**
* Identifier for this file, which can be used to download or reuse the file
*/
file_id: string;
/**
* 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.
*/
file_unique_id: string;
/**
* Video width as defined by sender
*/
width: number;
/**
* Video height as defined by sender
*/
height: number;
/**
* Duration of the video in seconds as defined by sender
*/
duration: number;
/**
* Optional. Animation thumbnail as defined by sender
*/
thumb?: IPhotoSize;
/**
* Optional. Original animation filename as defined by sender
*/
file_name?: string;
/**
* Optional. MIME type of the file as defined by sender
*/
mime_type?: string;
/**
* Optional. File size in bytes
*/
file_size?: number;
}
/**
* This object represents one button of an inline keyboard. You must use exactly one of the optional fields.
*/
interface IInlineKeyboardButton {
/**
* Label text on the button
*/
text: string;
/**
* 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.
*/
url?: string;
/**
* Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.
*/
login_url?: ILoginUrl;
/**
* Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
*/
callback_data?: string;
/**
* 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. Can be empty, in which case just the bot's username will be inserted.
*/
switch_inline_query?: string;
/**
* Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted.
This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options.
*/
switch_inline_query_current_chat?: string;
/**
* Optional. Description of the game that will be launched when the user presses the button. NOTE: This type of button must always be the first button in the first row.
*/
callback_game?: ICallbackGame;
/**
* Optional. Specify True, to send a Pay button. NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
*/
pay?: boolean;
}
/**
* This object represents an inline keyboard that appears right next to the message it belongs to.
*/
interface IInlineKeyboardMarkup {
/**
* Array of button rows, each represented by an Array of InlineKeyboardButton objects
*/
inline_keyboard: [IInlineKeyboardButton[]];
}
/**
* This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
*/
interface IInlineQuery {
/**
* Unique identifier for this query
*/
id: number;
/**
* Sender
*/
from: IUser;
/**
* Text of the query (up to 256 characters)
*/
query: string;
/**
* Offset of the results to be returned, can be controlled by the bot
*/
offset: string;
/**
* Optional. Type of the chat, from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”.
*/
chat_type?: string;
/**
* Optional. Sender location, only for bots that request user location
*/
location?: ILocation;
}
/**
* This object contains basic information about an invoice.
*/
interface IInvoice {
/**
* Product name
*/
title: string;
/**
* Product description
*/
description: string;
/**
* Unique bot deep-linking parameter that can be used to generate this invoice
*/
start_parameter: string;
/**
* Three-letter ISO 4217 currency code
*/
currency: string;
/**
* Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
*/
total_amount: number;
}
/**
* 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 when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in:
*/
interface ILoginUrl {
/**
* An HTTP 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.
NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization.
*/
url: string;
/**
* Optional. New text of the button in forwarded messages.
*/
forward_text?: string;
/**
* Optional. Username of a bot, which will be used for user authorization. See 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 for more details.
*/
bot_username?: string;
/**
* Optional. Pass True to request the permission for your bot to send messages to the user.
*/
request_write_access?: boolean;
}
/**
* This object describes the position on faces where a mask should be placed by default.
*/
interface IMaskPosition {
/**
* The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”.
*/
point: string;
/**
* 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.
*/
x_shift: number;
/**
* 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.
*/
y_shift: number;
/**
* Mask scaling coefficient. For example, 2.0 means double size.
*/
scale: number;
}
/**
* This object represents a service message about a change in auto-delete timer settings.
*/
interface IMessageAutoDeleteTimerChanged {
/**
* New auto-delete time for messages in the chat; in seconds
*/
message_auto_delete_time: number;
}
interface IMessageEntity {
/**
* Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention”
*/
type: string;
/**
* Offset in UTF-16 code units to the start of the entity
*/
offset: number;
/**
* Length of the entity in UTF-16 code units
*/
length: number;
/**
* Optional. For “text_link” only, url that will be opened after user taps on the text
*/
url: string;
/**
* Optional. For “text_mention” only, the mentioned user
*/
user?: IUser;
/**
* Optional. For “pre” only, the programming language of the entity text
*/
language?: string;
}
/**
* This object represents a shipping address.
*/
interface IShippingAddress {
/**
* ISO 3166-1 alpha-2 country code
*/
country_code: string;
/**
* State, if applicable
*/
state: string;
/**
* City
*/
city: string;
/**
* First line for the address
*/
street_line1: string;
/**
* Second line for the address
*/
street_line2: string;
/**
* Address post code
*/
post_code: string;
}
/**
* This object represents information about an order.
*/
interface IOrderInfo {
/**
* Optional. User name
*/
name?: string;
/**
* Optional. User's phone number
*/
phone_number?: string;
/**
* Optional. User email
*/
email?: string;
/**
* Optional. User shipping address
*/
shipping_address?: IShippingAddress;
}
/**
* Contains information about Telegram Passport data shared with the bot by the user.
*/
interface IPassportData {
/**
* Array with information about documents and other Telegram Passport elements that was shared with the bot
*/
data: IEncryptedPassportElement[];
/**
* Encrypted credentials required to decrypt the data
*/
credentials: IEncryptedCredentials;
}
/**
* This object contains information about a poll.
*/
interface IPoll {
/**
* Unique poll identifier
*/
id: string;
/**
* Poll question, 1-300 characters
*/
question: string;
/**
* List of poll options
*/
options: IPollOption[];
/**
* Total number of users that voted in the poll
*/
total_voter_count: number;
/**
* True, if the poll is closed
*/
is_closed: boolean;
/**
* True, if the poll is anonymous
*/
is_anonymous: boolean;
/**
* Poll type, currently can be “regular” or “quiz”
*/
type: string;
/**
* True, if the poll allows multiple answers
*/
allows_multiple_answers: boolean;
/**
* Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
*/
correct_option_id?: number;
/**
* Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters
*/
explanation?: string;
/**
* Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
*/
explanation_entities?: IMessageEntity[];
/**
* Optional. Amount of time in seconds the poll will be active after creation
*/
open_period?: number;
/**
* Optional. Point in time (Unix timestamp) when the poll will be automatically closed
*/
close_data: number;
}
/**
* This object represents an answer of a user in a non-anonymous poll.
*/
interface IPollAnswer {
/**
* Unique poll identifier
*/
poll_id: string;
/**
* The user, who changed the answer to the poll
*/
user: IUser;
/**
* 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.
*/
option_ids: number[];
}
interface IPollOption {
/**
* Option text, 1-100 characters
*/
text: string;
/**
* Number of users that voted for this option
*/
voter_count: number;
}
/**
* This object contains information about an incoming pre-checkout query.
*/
interface IPreCheckoutQuery {
/**
* Unique query identifier
*/
id: string;
/**
* User who sent the query
*/
from: IUser;
/**
* Three-letter ISO 4217 currency code
*/
currency: string;
/**
* Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145
*/
total_amount: number;
/**
* Bot specified invoice payload
*/
invoice_payload: string;
/**
* Optional. Identifier of the shipping option chosen by the user
*/
shipping_option_id?: string;
/**
* Optional. Order info provided by the user
*/
order_info?: IOrderInfo;
}
/**
* This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.
*/
interface IProximityAlertTriggered {
/**
* User that triggered the alert
*/
traveler: IUser;
/**
* User that set the alert
*/
watcher: IUser;
/**
* The distance between the users
*/
distance: number;
}
/**
* This object contains information about an incoming shipping query.
*/
interface IShippingQuery {
/**
* Unique query identifier
*/
id: string;
/**
* User who sent the query
*/
from: IUser;
/**
* Bot specified invoice payload
*/
invoice_payload: string;
/**
* User specified shipping address
*/
shipping_address: IShippingAddress;
}
/**
* This object represents a sticker.
*/
interface ISticker {
/**
* Identifier for this file, which can be used to download or reuse the file
*/
file_id: string;
/**
* 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.
*/
file_unique_id: string;
/**
* Sticker width
*/
width: number;
/**
* Sticker height
*/
height: number;
/**
* True, if the sticker is animated
*/
is_animated: boolean;
/**
* True, if the sticker is a video sticker
*/
is_video: boolean;
/**
* Optional. Sticker thumbnail in the .WEBP or .JPG format
*/
thumb?: IPhotoSize;
/**
* Optional. Emoji associated with the sticker
*/
emoji?: string;
/**
* Optional. Name of the sticker set to which the sticker belongs
*/
set_name?: string;
/**
* Optional. For mask stickers, the position where the mask should be placed
*/
mask_position?: IMaskPosition;
/**
* Optional. File size in bytes
*/
file_size?: number;
}
/**
* This object contains basic information about a successful payment.
*/
interface ISuccessfulPayment {
/**
* Three-letter ISO 4217 currency code
*/
currency: string;
/**
* Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
*/
total_amount: number;
/**
* Bot specified invoice payload
*/
invoice_payload: string;
/**
* Optional. Identifier of the shipping option chosen by the user
*/
shipping_option_id?: string;
/**
* Optional. Order info provided by the user
*/
order_info?: IOrderInfo;
/**
* Telegram payment identifier
*/
telegram_payment_charge_id: string;
/**
* Provider payment identifier
*/
provider_payment_charge_id: string;
}
/**
* This object represents an incoming update.
*/
interface IUpdate {
/**
* The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence
*/
update_id: number;
/**
* Optional. New incoming message of any kind — text, photo, sticker, etc.
*/
message: IMessage;
/**
* Optional. New version of a message that is known to the bot and was edited
*/
edited_message?: IMessage;
/**
* Optional. New incoming channel post of any kind — text, photo, sticker, etc.
*/
channel_post?: IMessage;
/**
* Optional. New version of a channel post that is known to the bot and was edited
*/
edited_channel_post?: IMessage;
/**
* Optional. New incoming inline query
*/
inline_query?: IInlineQuery;
/**
* Optional. The result of an inline query that was chosen by a user and sent to their chat partner.
*/
chosen_inline_result?: IChosenInlineResult;
/**
* Optional. New incoming callback query
*/
callback_query?: ICallbackQuery;
/**
* Optional. New incoming shipping query. Only for invoices with flexible price
*/
shipping_query?: IShippingQuery;
/**
* Optional. New incoming pre-checkout query. Contains full information about checkout
*/
pre_checkout_query?: IPreCheckoutQuery;
/**
* Optional. New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot
*/
poll?: IPoll;
/**
* Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.
*/
poll_answer?: IPollAnswer;
/**
* Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates.
*/
chat_join_request?: IChatJoinRequest;
}
interface IUpdateOptions {
/**
* Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates
*/
offset?: number;
/**
* Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
*/
limit?: number;
/**
* Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.
*/
timeout?: number;
/**
* A JSON-serialized list of the update types you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types.
*/
allowed_updates?: string[];
}
/**
* This object represents a venue.
*/
interface IVenue {
/**
* Venue location. Can't be a live location
*/
location: ILocation;
/**
* Name of the venue
*/
title: string;
/**
* Address of the venue
*/
address: string;
/**
* Optional. Foursquare identifier of the venue
*/
foursquare_id?: string;
/**
* Optional. Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
*/
foursquare_type?: string;
/**
* Optional. Google Places identifier of the venue
*/
google_place_id?: string;
/**
* Optional. Google Places type of the venue. (See supported types.)
*/
google_place_type?: string;
}
/**
* This object represents a video file.
*/
interface IVideo {
/**
* Identifier for this file, which can be used to download or reuse the file
*/
file_id: string;
/**
* 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.
*/
file_unique_id: string;
/**
* Video width as defined by sender
*/
width: number;
/**
* Video height as defined by sender
*/
height: number;
/**
* Duration of the video in seconds as defined by sender
*/
duration: number;
/**
* Optional. Video thumbnail
*/
thumb?: IPhotoSize;
/**
* Optional. Original filename as defined by sender
*/
file_name?: string;
/**
* Optional. Mime type of a file as defined by sender
*/
mime_type?: string;
/**
* Optional. File size in bytes
*/
file_size?: number;
}
/**
* This object represents a video message (available in Telegram apps as of v.4.0).
*/
interface IVideoNote {
/**
* Identifier for this file, which can be used to download or reuse the file
*/
file_id: string;
/**
* Unique identifier for this file, which is supposed to be the same over time