UNPKG

@xalbex/telegram-bot

Version:
1,323 lines 178 kB
/// <reference types="node" /> /** * All official methods of the Telegram Bot API without abstraction. */ export declare class TelegramBotRaw { /** * Each bot is given a unique authentication token when it is created. * The token looks something like 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11 */ private token; /** * To use this class a token is **required** and can be obtained * by talking to [@botfather](https://telegram.me/BotFather). */ constructor(token: string); /** * Make an HTTPS POST multipart/form-data request to the Telegram server */ request(method: string, params: { [s: string]: any; }): Promise<any>; /** * Use this method to receive incoming updates using long polling (wiki). An Array * of Update objects is returned. */ getUpdates(params: GetUpdatesParams): Promise<Array<Update>>; /** * Use this method to specify a url and receive incoming updates via an outgoing * webhook. Whenever there is an update for the bot, we will send an HTTPS POST * request to the specified url, containing a JSON-serialized Update. In case of an * unsuccessful request, we will give up after a reasonable amount of attempts. * Returns True on success.If you'd like to make sure that the Webhook request * comes from Telegram, we recommend using a secret path in the URL, e.g. * https://www.example.com/<token>. Since nobody else knows your bot‘s token, you * can be pretty sure it’s us. */ setWebhook(params: SetWebhookParams): Promise<boolean>; /** * Use this method to remove webhook integration if you decide to switch back to * getUpdates. Returns True on success. Requires no parameters. */ deleteWebhook(): Promise<boolean>; /** * Use this method to get current webhook status. Requires no parameters. On * success, returns a WebhookInfo object. If the bot is using getUpdates, will * return an object with the url field empty. */ getWebhookInfo(): Promise<WebhookInfo>; /** * A simple method for testing your bot's auth token. Requires no parameters. * Returns basic information about the bot in form of a User object. */ getMe(): Promise<User>; /** * Use this method to send text messages. On success, the sent Message is returned. */ sendMessage(params: SendMessageParams): Promise<Message>; /** * Use this method to forward messages of any kind. On success, the sent Message is * returned. */ forwardMessage(params: ForwardMessageParams): Promise<Message>; /** * Use this method to send photos. On success, the sent Message is returned. */ sendPhoto(params: SendPhotoParams): Promise<Message>; /** * Use this method to send audio files, if you want Telegram clients to display * them in the music player. Your audio must be in the .mp3 format. On success, the * sent Message is returned. Bots can currently send audio files of up to 50 MB in * size, this limit may be changed in the future.For sending voice messages, use * the sendVoice method instead. */ sendAudio(params: SendAudioParams): Promise<Message>; /** * Use this method to send general files. On success, the sent Message is returned. * Bots can currently send files of any type of up to 50 MB in size, this limit may * be changed in the future. */ sendDocument(params: SendDocumentParams): Promise<Message>; /** * Use this method to send video files, Telegram clients support mp4 videos (other * formats may be sent as Document). On success, the sent Message is returned. Bots * can currently send video files of up to 50 MB in size, this limit may be changed * in the future. */ sendVideo(params: SendVideoParams): Promise<Message>; /** * Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without * sound). On success, the sent Message is returned. Bots can currently send * animation files of up to 50 MB in size, this limit may be changed in the future. */ sendAnimation(params: SendAnimationParams): Promise<Message>; /** * Use this method to send audio files, if you want Telegram clients to display the * file as a playable voice message. For this to work, your audio must be in an * .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On * success, the sent Message is returned. Bots can currently send voice messages of * up to 50 MB in size, this limit may be changed in the future. */ sendVoice(params: SendVoiceParams): Promise<Message>; /** * As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 * minute long. Use this method to send video messages. On success, the sent * Message is returned. */ sendVideoNote(params: SendVideoNoteParams): Promise<Message>; /** * Use this method to send a group of photos or videos as an album. On success, an * array of the sent Messages is returned. */ sendMediaGroup(params: SendMediaGroupParams): Promise<Array<Message>>; /** * Use this method to send point on the map. On success, the sent Message is * returned. */ sendLocation(params: SendLocationParams): Promise<Message>; /** * Use this method to edit live location messages sent by the bot or via the bot * (for inline bots). A location can be edited until its live_period expires or * editing is explicitly disabled by a call to stopMessageLiveLocation. On success, * if the edited message was sent by the bot, the edited Message is returned, * otherwise True is returned. */ editMessageLiveLocation(params: EditMessageLiveLocationParams): Promise<Message | boolean>; /** * Use this method to stop updating a live location message sent by the bot or via * the bot (for inline bots) before live_period expires. On success, if the message * was sent by the bot, the sent Message is returned, otherwise True is returned. */ stopMessageLiveLocation(params: StopMessageLiveLocationParams): Promise<Message | boolean>; /** * Use this method to send information about a venue. On success, the sent Message * is returned. */ sendVenue(params: SendVenueParams): Promise<Message>; /** * Use this method to send phone contacts. On success, the sent Message is * returned. */ sendContact(params: SendContactParams): Promise<Message>; /** * Use this method when you need to tell the user that something is happening on * the bot's side. The status is set for 5 seconds or less (when a message arrives * from your bot, Telegram clients clear its typing status). Returns True on * success.Example: The ImageBot needs some time to process a request and upload * the image. Instead of sending a text message along the lines of “Retrieving * image, please wait…”, the bot may use sendChatAction with action = upload_photo. * The user will see a “sending photo” status for the bot. We only recommend using * this method when a response from the bot will take a noticeable amount of time * to arrive. */ sendChatAction(params: SendChatActionParams): Promise<boolean>; /** * Use this method to get a list of profile pictures for a user. Returns a * UserProfilePhotos object. */ getUserProfilePhotos(params: GetUserProfilePhotosParams): Promise<UserProfilePhotos>; /** * Use this method to get basic info about a file and prepare it for downloading. * For the moment, bots can download files of up to 20MB in size. On success, a * File object is returned. The file can then be downloaded via the link * https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken * from the response. It is guaranteed that the link will be valid for at least 1 * hour. When the link expires, a new one can be requested by calling getFile * again. */ getFile(params: GetFileParams): Promise<File>; /** * Use this method to kick a user from a group, a supergroup or a channel. In the * case of supergroups and channels, the user will not be able to return to the * group on their own using invite links, etc., unless unbanned first. The bot must * be an administrator in the chat for this to work and must have the appropriate * admin rights. Returns True on success.Note: In regular groups (non-supergroups), * this method will only work if the ‘All Members Are Admins’ setting is off in the * target group. Otherwise members may only be removed by the group's creator or by * the member that added them. */ kickChatMember(params: KickChatMemberParams): Promise<boolean>; /** * Use this method to unban a previously kicked user in a supergroup or channel. * The user will not return to the group or channel automatically, but will be able * to join via link, etc. The bot must be an administrator for this to work. * Returns True on success. */ unbanChatMember(params: UnbanChatMemberParams): Promise<boolean>; /** * Use this method to restrict a user in a supergroup. The bot must be an * administrator in the supergroup for this to work and must have the appropriate * admin rights. Pass True for all boolean parameters to lift restrictions from a * user. Returns True on success. */ restrictChatMember(params: RestrictChatMemberParams): Promise<boolean>; /** * Use this method to promote or demote a user in a supergroup or a channel. The * bot must be an administrator in the chat for this to work and must have the * appropriate admin rights. Pass False for all boolean parameters to demote a * user. Returns True on success. */ promoteChatMember(params: PromoteChatMemberParams): Promise<boolean>; /** * Use this method to generate a new invite link for a chat; any previously * generated link is revoked. The bot must be an administrator in the chat for this * to work and must have the appropriate admin rights. Returns the new invite link * as String on success. */ exportChatInviteLink(params: ExportChatInviteLinkParams): Promise<string>; /** * Use this method to set a new profile photo for the chat. Photos can't be changed * for private chats. The bot must be an administrator in the chat for this to work * and must have the appropriate admin rights. Returns True on success.Note: In * regular groups (non-supergroups), this method will only work if the ‘All Members * Are Admins’ setting is off in the target group. */ setChatPhoto(params: SetChatPhotoParams): Promise<boolean>; /** * Use this method to delete a chat photo. Photos can't be changed for private * chats. The bot must be an administrator in the chat for this to work and must * have the appropriate admin rights. Returns True on success.Note: In regular * groups (non-supergroups), this method will only work if the ‘All Members Are * Admins’ setting is off in the target group. */ deleteChatPhoto(params: DeleteChatPhotoParams): Promise<boolean>; /** * Use this method to change the title of a chat. Titles can't be changed for * private chats. The bot must be an administrator in the chat for this to work and * must have the appropriate admin rights. Returns True on success.Note: In regular * groups (non-supergroups), this method will only work if the ‘All Members Are * Admins’ setting is off in the target group. */ setChatTitle(params: SetChatTitleParams): Promise<boolean>; /** * Use this method to change the description of a supergroup or a channel. The bot * must be an administrator in the chat for this to work and must have the * appropriate admin rights. Returns True on success. */ setChatDescription(params: SetChatDescriptionParams): Promise<boolean>; /** * Use this method to pin a message in a supergroup or a channel. The bot must be * an administrator in the chat for this to work and must have the * ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin * right in the channel. Returns True on success. */ pinChatMessage(params: PinChatMessageParams): Promise<boolean>; /** * Use this method to unpin a message in a supergroup or a channel. The bot must be * an administrator in the chat for this to work and must have the * ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin * right in the channel. Returns True on success. */ unpinChatMessage(params: UnpinChatMessageParams): Promise<boolean>; /** * Use this method for your bot to leave a group, supergroup or channel. Returns * True on success. */ leaveChat(params: LeaveChatParams): Promise<boolean>; /** * Use this method to get up to date information about the chat (current name of * the user for one-on-one conversations, current username of a user, group or * channel, etc.). Returns a Chat object on success. */ getChat(params: GetChatParams): Promise<Chat>; /** * Use this method to get a list of administrators in a chat. On success, returns * an Array of ChatMember objects that contains information about all chat * administrators except other bots. If the chat is a group or a supergroup and no * administrators were appointed, only the creator will be returned. */ getChatAdministrators(params: GetChatAdministratorsParams): Promise<Array<ChatMember>>; /** * Use this method to get the number of members in a chat. Returns Int on success. */ getChatMembersCount(params: GetChatMembersCountParams): Promise<number>; /** * Use this method to get information about a member of a chat. Returns a * ChatMember object on success. */ getChatMember(params: GetChatMemberParams): Promise<ChatMember>; /** * Use this method to set a new group sticker set for a supergroup. The bot must be * an administrator in the chat for this to work and must have the appropriate * admin rights. Use the field can_set_sticker_set optionally returned in getChat * requests to check if the bot can use this method. Returns True on success. */ setChatStickerSet(params: SetChatStickerSetParams): Promise<boolean>; /** * Use this method to delete a group sticker set from a supergroup. The bot must be * an administrator in the chat for this to work and must have the appropriate * admin rights. Use the field can_set_sticker_set optionally returned in getChat * requests to check if the bot can use this method. Returns True on success. */ deleteChatStickerSet(params: DeleteChatStickerSetParams): Promise<boolean>; /** * Use this method to send answers to callback queries sent from inline keyboards. * The answer will be displayed to the user as a notification at the top of the * chat screen or as an alert. On success, True is returned.Alternatively, the user * can be redirected to the specified Game URL. For this option to work, you must * first create a game for your bot via @Botfather and accept the terms. Otherwise, * you may use links like t.me/your_bot?start=XXXX that open your bot with a * parameter. */ answerCallbackQuery(params: AnswerCallbackQueryParams): Promise<boolean>; /** * Use this method to edit text and game messages sent by the bot or via the bot * (for inline bots). On success, if edited message is sent by the bot, the edited * Message is returned, otherwise True is returned. */ editMessageText(params: EditMessageTextParams): Promise<Message | boolean>; /** * Use this method to edit captions of messages sent by the bot or via the bot (for * inline bots). On success, if edited message is sent by the bot, the edited * Message is returned, otherwise True is returned. */ editMessageCaption(params: EditMessageCaptionParams): Promise<Message | boolean>; /** * Use this method to edit audio, document, photo, or video messages. If a message * is a part of a message album, then it can be edited only to a photo or a video. * Otherwise, message type can be changed arbitrarily. When inline message is * edited, new file can't be uploaded. Use previously uploaded file via its file_id * or specify a URL. On success, if the edited message was sent by the bot, the * edited Message is returned, otherwise True is returned. */ editMessageMedia(params: EditMessageMediaParams): Promise<Message | boolean>; /** * Use this method to edit only the reply markup of messages sent by the bot or via * the bot (for inline bots). On success, if edited message is sent by the bot, the * edited Message is returned, otherwise True is returned. */ editMessageReplyMarkup(params: EditMessageReplyMarkupParams): Promise<Message | boolean>; /** * Use this method to delete a message, including service messages, with the * following limitations: - A message can only be deleted if it was sent less than * 48 hours ago. - Bots can delete outgoing messages in groups and supergroups. - * Bots granted can_post_messages permissions can delete outgoing messages in * channels. - If the bot is an administrator of a group, it can delete any message * there. - If the bot has can_delete_messages permission in a supergroup or a * channel, it can delete any message there. Returns True on success. */ deleteMessage(params: DeleteMessageParams): Promise<boolean>; /** * Use this method to send .webp stickers. On success, the sent Message is * returned. */ sendSticker(params: SendStickerParams): Promise<Message>; /** * Use this method to get a sticker set. On success, a StickerSet object is * returned. */ getStickerSet(params: GetStickerSetParams): Promise<StickerSet>; /** * Use this method to upload a .png file with a sticker for later use in * createNewStickerSet and addStickerToSet methods (can be used multiple times). * Returns the uploaded File on success. */ uploadStickerFile(params: UploadStickerFileParams): Promise<File>; /** * Use this method to create new sticker set owned by a user. The bot will be able * to edit the created sticker set. Returns True on success. */ createNewStickerSet(params: CreateNewStickerSetParams): Promise<boolean>; /** * Use this method to add a new sticker to a set created by the bot. Returns True * on success. */ addStickerToSet(params: AddStickerToSetParams): Promise<boolean>; /** * Use this method to move a sticker in a set created by the bot to a specific * position . Returns True on success. */ setStickerPositionInSet(params: SetStickerPositionInSetParams): Promise<boolean>; /** * Use this method to delete a sticker from a set created by the bot. Returns True * on success. */ deleteStickerFromSet(params: DeleteStickerFromSetParams): Promise<boolean>; /** * Use this method to send answers to an inline query. On success, True is * returned. No more than 50 results per query are allowed. */ answerInlineQuery(params: AnswerInlineQueryParams): Promise<boolean>; /** * Use this method to send invoices. On success, the sent Message is returned. */ sendInvoice(params: SendInvoiceParams): Promise<Message>; /** * If you sent an invoice requesting a shipping address and the parameter * is_flexible was specified, the Bot API will send an Update with a shipping_query * field to the bot. Use this method to reply to shipping queries. On success, True * is returned. */ answerShippingQuery(params: AnswerShippingQueryParams): Promise<boolean>; /** * Once the user has confirmed their payment and shipping details, the Bot API * sends the final confirmation in the form of an Update with the field * pre_checkout_query. Use this method to respond to such pre-checkout queries. On * success, True is returned. Note: The Bot API must receive an answer within 10 * seconds after the pre-checkout query was sent. */ answerPreCheckoutQuery(params: AnswerPreCheckoutQueryParams): Promise<boolean>; /** * Informs a user that some of the Telegram Passport elements they provided * contains errors. The user will not be able to re-submit their Passport to you * until the errors are fixed (the contents of the field for which you returned the * error must change). Returns True on success.Use this if the data submitted by * the user doesn't satisfy the standards your service requires for any reason. For * example, if a birthday date seems invalid, a submitted document is blurry, a * scan shows evidence of tampering, etc. Supply some details in the error message * to make sure the user knows how to correct the issues. */ setPassportDataErrors(params: SetPassportDataErrorsParams): Promise<boolean>; /** * Use this method to send a game. On success, the sent Message is returned. */ sendGame(params: SendGameParams): Promise<Message>; /** * Use this method to set the score of the specified user in a game. On success, if * the message was sent by the bot, returns the edited Message, otherwise returns * True. Returns an error, if the new score is not greater than the user's current * score in the chat and force is False. */ setGameScore(params: SetGameScoreParams): Promise<Message | boolean>; /** * Use this method to get data for high score tables. Will return the score of the * specified user and several of his neighbors in a game. On success, returns an * Array of GameHighScore objects.This method will currently return scores for the * target user, plus two of his closest neighbors on each side. Will also return * the top three users if the user and his neighbors are not among them. Please * note that this behavior is subject to change. */ getGameHighScores(params: GetGameHighScoresParams): Promise<Array<GameHighScore>>; } /** * This object represents an incoming update. At most one of the optional * parameters can be present in any given update. */ export interface Update { /** * 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, should they get out of order. If there are no new * updates for at least a week, then identifier of the next update will be chosen * randomly instead of sequentially. */ update_id: number; /** * Optional. New incoming message of any kind — text, photo, sticker, etc. */ message?: Message; /** * Optional. New version of a message that is known to the bot and was edited */ edited_message?: Message; /** * Optional. New incoming channel post of any kind — text, photo, sticker, etc. */ channel_post?: Message; /** * Optional. New version of a channel post that is known to the bot and was edited */ edited_channel_post?: Message; /** * Optional. New incoming inline query */ inline_query?: InlineQuery; /** * Optional. The result of an inline query that was chosen by a user and sent to * their chat partner. Please see our documentation on the feedback collecting for * details on how to enable these updates for your bot. */ chosen_inline_result?: ChosenInlineResult; /** * Optional. New incoming callback query */ callback_query?: CallbackQuery; /** * Optional. New incoming shipping query. Only for invoices with flexible price */ shipping_query?: ShippingQuery; /** * Optional. New incoming pre-checkout query. Contains full information about * checkout */ pre_checkout_query?: PreCheckoutQuery; } /** * Use this method to receive incoming updates using long polling (wiki). An Array * of Update objects is returned. */ export interface GetUpdatesParams { /** * Identifier of the first update to be returned. Must be greater by one than the * highest among the identifiers of previously received updates. By default, * updates starting with the earliest unconfirmed update are returned. An update is * considered confirmed as soon as getUpdates is called with an offset higher than * its update_id. The negative offset can be specified to retrieve updates starting * from -offset update from the end of the updates queue. All previous updates will * forgotten. */ 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; /** * List the types of updates you want your bot to receive. For example, specify * [“message”, “edited_channel_post”, “callback_query”] to only receive updates of * these types. See Update for a complete list of available update types. Specify * an empty list to receive all updates regardless of type (default). If not * specified, the previous setting will be used. Please note that this parameter * doesn't affect updates created before the call to the getUpdates, so unwanted * updates may be received for a short period of time. */ allowed_updates?: Array<string>; } /** * Use this method to specify a url and receive incoming updates via an outgoing * webhook. Whenever there is an update for the bot, we will send an HTTPS POST * request to the specified url, containing a JSON-serialized Update. In case of an * unsuccessful request, we will give up after a reasonable amount of attempts. * Returns True on success.If you'd like to make sure that the Webhook request * comes from Telegram, we recommend using a secret path in the URL, e.g. * https://www.example.com/<token>. Since nobody else knows your bot‘s token, you * can be pretty sure it’s us. */ export interface SetWebhookParams { /** * HTTPS url to send updates to. Use an empty string to remove webhook integration */ url: string; /** * Upload your public key certificate so that the root certificate in use can be * checked. See our self-signed guide for details. */ certificate?: { name: string; data: Buffer; }; /** * Maximum allowed number of simultaneous HTTPS connections to the webhook for * update delivery, 1-100. Defaults to 40. Use lower values to limit the load on * your bot‘s server, and higher values to increase your bot’s throughput. */ max_connections?: number; /** * List the types of updates you want your bot to receive. For example, specify * [“message”, “edited_channel_post”, “callback_query”] to only receive updates of * these types. See Update for a complete list of available update types. Specify * an empty list to receive all updates regardless of type (default). If not * specified, the previous setting will be used. Please note that this parameter * doesn't affect updates created before the call to the setWebhook, so unwanted * updates may be received for a short period of time. */ allowed_updates?: Array<string>; } /** * Contains information about the current status of a webhook. */ export interface WebhookInfo { /** * Webhook URL, may be empty if webhook is not set up */ url: string; /** * True, if a custom certificate was provided for webhook certificate checks */ has_custom_certificate: boolean; /** * Number of updates awaiting delivery */ pending_update_count: number; /** * Optional. Unix time for the most recent error that happened when trying to * deliver an update via webhook */ last_error_date?: number; /** * Optional. Error message in human-readable format for the most recent error that * happened when trying to deliver an update via webhook */ last_error_message?: string; /** * Optional. Maximum allowed number of simultaneous HTTPS connections to the * webhook for update delivery */ max_connections?: number; /** * Optional. A list of update types the bot is subscribed to. Defaults to all * update types */ allowed_updates?: Array<string>; } /** * This object represents a Telegram user or bot. */ export interface User { /** * 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; } /** * This object represents a chat. */ export interface Chat { /** * Unique identifier for this chat. This number may be greater than 32 bits and * some programming languages may have difficulty/silent defects in interpreting * it. But it is smaller than 52 bits, so a signed 64 bit integer or * double-precision float type are safe for storing this identifier. */ 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. True if a group has ‘All Members Are Admins’ enabled. */ all_members_are_administrators?: boolean; /** * Optional. Chat photo. Returned only in getChat. */ photo?: ChatPhoto; /** * Optional. Description, for supergroups and channel chats. Returned only in * getChat. */ description?: string; /** * Optional. Chat invite link, for supergroups and channel chats. Returned only in * getChat. */ invite_link?: string; /** * Optional. Pinned message, for supergroups and channel chats. Returned only in * getChat. */ pinned_message?: Message; /** * 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; } /** * This object represents a message. */ export interface Message { /** * Unique message identifier inside this chat */ message_id: number; /** * Optional. Sender, empty for messages sent to channels */ from?: User; /** * Date the message was sent in Unix time */ date: number; /** * Conversation the message belongs to */ chat: Chat; /** * Optional. For forwarded messages, sender of the original message */ forward_from?: User; /** * Optional. For messages forwarded from channels, information about the original * channel */ forward_from_chat?: Chat; /** * Optional. For messages forwarded from channels, identifier of the original * message in the channel */ forward_from_message_id?: number; /** * Optional. For messages forwarded from channels, signature of the post author if * present */ forward_signature?: string; /** * Optional. For forwarded messages, date the original message was sent in Unix * time */ forward_date?: number; /** * 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?: Message; /** * Optional. Date the message was last edited in Unix time */ edit_date?: number; /** * 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 */ 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?: Array<MessageEntity>; /** * Optional. For messages with a caption, special entities like usernames, URLs, * bot commands, etc. that appear in the caption */ caption_entities?: Array<MessageEntity>; /** * Optional. Message is an audio file, information about the file */ audio?: Audio; /** * Optional. Message is a general file, information about the file */ document?: Document; /** * 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?: Animation; /** * Optional. Message is a game, information about the game. More about games » */ game?: Game; /** * Optional. Message is a photo, available sizes of the photo */ photo?: Array<PhotoSize>; /** * Optional. Message is a sticker, information about the sticker */ sticker?: Sticker; /** * Optional. Message is a video, information about the video */ video?: Video; /** * Optional. Message is a voice message, information about the file */ voice?: Voice; /** * Optional. Message is a video note, information about the video message */ video_note?: VideoNote; /** * Optional. Caption for the audio, document, photo, video or voice, 0-200 * characters */ caption?: string; /** * Optional. Message is a shared contact, information about the contact */ contact?: Contact; /** * Optional. Message is a shared location, information about the location */ location?: Location; /** * Optional. Message is a venue, information about the venue */ venue?: Venue; /** * 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?: Array<User>; /** * Optional. A member was removed from the group, information about them (this * member may be the bot itself) */ left_chat_member?: User; /** * 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?: Array<PhotoSize>; /** * 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. The group has been migrated to a supergroup with the specified * identifier. This number may be greater than 32 bits and some programming * languages may have difficulty/silent defects in interpreting it. But it is * smaller than 52 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 be greater than 32 bits and some programming * languages may have difficulty/silent defects in interpreting it. But it is * smaller than 52 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?: Message; /** * Optional. Message is an invoice for a payment, information about the invoice. * More about payments » */ invoice?: Invoice; /** * Optional. Message is a service message about a successful payment, information * about the payment. More about payments » */ successful_payment?: SuccessfulPayment; /** * Optional. The domain name of the website on which the user has logged in. More * about Telegram Login » */ connected_website?: string; /** * Optional. Telegram Passport data */ passport_data?: PassportData; } /** * This object represents one special entity in a text message. For example, * hashtags, usernames, URLs, etc. */ export interface MessageEntity { /** * Type of the entity. Can be mention (@username), hashtag, cashtag, bot_command, * url, email, phone_number, bold (bold text), italic (italic text), code * (monowidth string), pre (monowidth block), text_link (for clickable text URLs), * text_mention (for users without usernames) */ 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?: User; } /** * This object represents one size of a photo or a file / sticker thumbnail. */ export interface PhotoSize { /** * Unique identifier for this file */ file_id: string; /** * Photo width */ width: number; /** * Photo height */ height: number; /** * Optional. File size */ file_size?: number; } /** * This object represents an audio file to be treated as music by the Telegram * clients. */ export interface Audio { /** * Unique identifier for this file */ file_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. MIME type of the file as defined by sender */ mime_type?: string; /** * Optional. File size */ file_size?: number; /** * Optional. Thumbnail of the album cover to which the music file belongs */ thumb?: PhotoSize; } /** * This object represents a general file (as opposed to photos, voice messages and * audio files). */ export interface Document { /** * Unique file identifier */ file_id: string; /** * Optional. Document thumbnail as defined by sender */ thumb?: PhotoSize; /** * 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 */ file_size?: number; } /** * This object represents a video file. */ export interface Video { /** * Unique identifier for this file */ file_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?: PhotoSize; /** * Optional. Mime type of a file as defined by sender */ mime_type?: string; /** * Optional. File size */ file_size?: number; } /** * This object represents an animation file (GIF or H.264/MPEG-4 AVC video without * sound). */ export interface Animation { /** * Unique file identifier */ file_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?: PhotoSize; /** * 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 */ file_size?: number; } /** * This object represents a voice note. */ export interface Voice { /** * Unique identifier for this file */ file_id: string; /** * Duration of the audio in seconds as defined by sender */ duration: number; /** * Optional. MIME type of the file as defined by sender */ mime_type?: string; /** * Optional. File size */ file_size?: number; } /** * This object represents a video message (available in Telegram apps as of v.4.0). */ export interface VideoNote { /** * Unique identifier for this file */ file_id: string; /** * Video width and height (diameter of the video message) as defined by sender */ length: number; /** * Duration of the video in seconds as defined by sender */ duration: number; /** * Optional. Video thumbnail */ thumb?: PhotoSize; /** * Optional. File size */ file_size?: number; } /** * This object represents a phone contact. */ export interface Contact { /** * 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 */ user_id?: number; /** * Optional. Additional data about the contact in the form of a vCard */ vcard?: string; } /** * This object represents a point on the map. */ export interface Location { /** * Longitude as defined by sender */ longitude: number; /** * Latitude as defined by sender */ latitude: number; } /** * This object represents a venue. */ export interface Venue { /** * Venue location */ location: Location; /** * 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; } /** * This object represent a user's profile pictures. */ export interface UserProfilePhotos { /** * Total number of profile pictures the target user has */ total_count: number; /** * Requested profile pictures (in up to 4 sizes each) */ photos: any; } /** * This object represents a file ready to be downloaded. The file can be downloaded * via the link https://api.telegram.org/file/bot<token>/<file_path>. It is * guaranteed that the link will be valid for at least 1 hour. When the link * expires, a new one can be requested by calling getFile.Maximum file size to * download is 20 MB */ export interface File { /** * Unique identifier for this file */ file_id: string; /** * Optional. File size, if known */ file_size?: number; /** * Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to * get the file. */ file_path?: string; } /** * This object represents a custom keyboard with reply options (see Introduction to * bots for details and examples). */ export interface ReplyKeyboardMarkup { /** * Array of button rows, each represented by an Array of KeyboardButton objects */ keyboard: any; /** * 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. */ resize_keyboard?: boolean; /** * 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. */ one_time_keyboard?: boolean; /** * 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. Example: A user requests to change the bot‘s language, bot * replies to the request with a keyboard to select the new language. Other users * in the group don’t see the keyboard. */ selective?: boolean; } /** * This object represents one button of the reply keyboard. For simple text buttons * String can be used instead of this object to specify text of the button. * Optional fields are mutually exclusive. */ export interface KeyboardButton { /** * Text of the button. If none of the optional fields are used, it will be sent as * a message when the button is pressed */ text: string; /** * Optional. If True, the user's phone number will be sent as a contact when the * button is pressed. Available in private chats only */ request_contact?: boolean; /** * Optional. If True, the user's current location will be sent when the button is * pressed. Available in private chats only */ request_location?: boolean; } /** * 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 (see ReplyKeyboardMarkup). */ export interface ReplyKeyboardRemove { /** * 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) */ remove_keyboard: boolean; /** * 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. Example: A user votes in a poll, bot returns confirmation * message in reply to the vote and removes the keyboard for that user, while still * showing the keyboard with poll options to users who haven't voted yet. */ selective?: boolean; } /** * This object represents an inline keyboard that appears right next to the message * it belongs to. */ export interface InlineKeyboardMarkup { /** * Array of button rows, each represented by an Array of InlineKeyboardButton * objects */ inline_keyboard: any; } /** * This object represen