messaging-api-telegram
Version:
Messaging API client for Telegram
1,478 lines • 73.7 kB
TypeScript
import { OnRequestFunction } from 'messaging-api-common';
export declare type ClientConfig = {
accessToken: string;
origin?: string;
onRequest?: OnRequestFunction;
};
export declare type Update = {
updateId: number;
message?: Message;
editedMessage?: Message;
channelPost?: Message;
editedChannelPost?: Message;
inlineQuery?: InlineQuery;
chosenInlineResult?: ChosenInlineResult;
callbackQuery?: CallbackQuery;
shippingQuery?: ShippingQuery;
preCheckoutQuery?: PreCheckoutQuery;
poll?: Poll;
pollAnswer?: PollAnswer;
};
/**
* Contains information about the current status of a webhook.
*/
export declare type 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
*/
hasCustomCertificate: boolean;
/**
* Number of updates awaiting delivery
*/
pendingUpdateCount: number;
/**
* Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook
*/
lastErrorDate?: number;
/**
* Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook
*/
lastErrorMessage?: string;
/**
* Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery
*/
maxConnections?: number;
/**
* Optional. A list of update types the bot is subscribed to. Defaults to all update types
*/
allowedUpdates?: string[];
};
/**
* This object represents a Telegram user or bot.
*/
export declare type User = {
/**
* Unique identifier for this user or bot
*/
id: number;
/**
* True, if this user is a bot
*/
isBot: boolean;
/**
* User‘s or bot’s first name
*/
firstName: string;
/**
* Optional. User‘s or bot’s last name
*/
lastName?: string;
/**
* Optional. User‘s or bot’s username
*/
username?: string;
/**
* Optional. (IETF language tag)[https://en.wikipedia.org/wiki/IETF_language_tag] of the user's language
*/
languageCode?: string;
/**
* Optional. True, if the bot can be invited to groups. Returned only in getMe.
*/
canJoinGroups?: boolean;
/**
* Optional. True, if privacy mode is disabled for the bot. Returned only in getMe.
*/
canReadAllGroupMessages?: boolean;
/**
* Optional. True, if the bot supports inline queries. Returned only in getMe.
*/
supportsInlineQueries?: boolean;
};
export declare type Chat = {
id: number;
type: 'private' | 'group' | 'supergroup' | 'channel';
title?: string;
username?: string;
firstName?: string;
lastName?: string;
photo?: ChatPhoto;
description?: string;
inviteLink?: string;
pinnedMessage?: Message;
permissions?: ChatPermissions;
stickerSetName?: string;
canSetStickerSet?: boolean;
};
export declare type Message = {
messageId: number;
from?: User;
date: number;
chat: Chat;
forwardFrom?: User;
forwardFromChat?: Chat;
forwardFromMessageId?: number;
forwardSignature?: string;
forwardSenderName?: string;
forwardDate?: number;
replyToMessage?: Message;
editDate?: number;
mediaGroupId?: string;
authorSignature?: string;
text?: string;
entities?: MessageEntity[];
captionEntities?: MessageEntity[];
audio?: Audio;
document?: Document;
animation?: Animation;
game?: Game;
photo?: PhotoSize[];
sticker?: Sticker;
video?: Video;
voice?: Voice;
videoNote?: VideoNote;
caption?: string;
contact?: Contact;
location?: Location;
venue?: Venue;
poll?: Poll;
newChatMembers?: User[];
leftChatMember?: User;
newChatTitle?: string;
newChatPhoto?: PhotoSize[];
deleteChatPhoto?: boolean;
groupChatCreated?: boolean;
supergroupChatCreated?: boolean;
channelChatCreated?: boolean;
migrateToChatId?: number;
migrateFromChatId?: number;
pinnedMessage?: Message;
invoice?: Invoice;
successfulPayment?: SuccessfulPayment;
connectedWebsite?: string;
passportData?: PassportData;
replyMarkup?: InlineKeyboardMarkup;
};
export declare type MessageEntity = {
type: 'mention' | 'hashtag' | 'cashtag' | 'bot_command' | 'url' | 'email' | 'phone_number' | 'bold' | 'italic' | 'code' | 'pre' | 'text_link' | 'text_mention';
offset: number;
length: number;
url?: string;
user?: User;
};
export declare type PhotoSize = {
fileId: string;
width: number;
height: number;
fileSize?: number;
};
export declare type Audio = {
fileId: string;
duration: number;
performer?: string;
title?: string;
mimeType?: string;
fileSize?: number;
thumb?: PhotoSize;
};
export declare type Document = {
fileId: string;
thumb?: PhotoSize;
fileName?: string;
mimeType?: string;
fileSize?: number;
};
export declare type Video = {
fileId: string;
width: number;
height: number;
duration: number;
thumb?: PhotoSize;
mimeType?: string;
fileSize?: number;
};
export declare type Animation = {
fileId: string;
width: number;
height: number;
duration: number;
thumb?: PhotoSize;
fileName?: string;
mimeType?: string;
fileSize?: number;
};
export declare type Voice = {
fileId: string;
duration: number;
mimeType?: string;
fileSize?: number;
};
export declare type VideoNote = {
fileId: string;
length: number;
duration: number;
thumb?: PhotoSize;
fileSize?: number;
};
export declare type Contact = {
phoneNumber: string;
firstName: string;
lastName?: string;
userId?: number;
vcard?: string;
};
/**
* This object represents a point on the map.
*/
export declare type Location = {
/**
* Longitude as defined by sender
*/
longitude: number;
/**
* Latitude as defined by sender
*/
latitude: number;
};
/**
* This object represents a venue.
*/
export declare type Venue = {
/**
* Latitude of the venue
*/
latitude: number;
/**
* Longitude of the venue
*/
longitude: number;
/**
* Name of the venue
*/
title: string;
/**
* Address of the venue
*/
address: string;
/**
* Optional. Foursquare identifier of the venue
*/
foursquareId?: string;
/**
* Optional. Foursquare type of the venue. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".)
*/
foursquareType?: string;
};
export declare type PollOption = {
text: string;
voterCount: number;
};
export declare type Poll = {
/**
* Unique poll identifier
*/
id: string;
/**
* Poll question, 1-255 characters
*/
question: string;
/**
* List of poll options
*/
options: PollOption[];
/**
* Total number of users that voted in the poll
*/
totalVoterCount: number;
/**
* True, if the poll is closed
*/
isClosed: boolean;
/**
* True, if the poll is anonymous
*/
isAnonymous: boolean;
/**
* Poll type, currently can be “regular” or “quiz”
*/
type: string;
/**
* True, if the poll allows multiple answers
*/
allowsMultipleAnswers: 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.
*/
correctOptionId?: 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
*/
explanationEntities?: MessageEntity[];
/**
* Optional. Amount of time in seconds the poll will be active after creation
*/
openPeriod?: number;
/**
* Optional. Point in time (Unix timestamp) when the poll will be automatically closed
*/
closeDate?: number;
};
/**
* This object represents an answer of a user in a non-anonymous poll.
*/
export declare type PollAnswer = {
/**
* Unique poll identifier
*/
pollId: string;
/**
* The user, who changed the answer to the poll
*/
user: User;
/**
* 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.
*/
optionIds: number[];
};
export declare type UserProfilePhotos = {
totalCount: number;
photos: PhotoSize[][];
};
export declare type File = {
fileId: string;
fileSize?: number;
filePath: string;
};
/**
* This object represents a custom keyboard with reply options.
*
* - https://core.telegram.org/bots#keyboards
* - https://core.telegram.org/bots/api#replykeyboardmarkup
*/
export declare type ReplyKeyboardMarkup = {
/**
* Array of button rows, each represented by an Array of KeyboardButton objects
*
* - https://core.telegram.org/bots/api#keyboardbutton
*/
keyboard: KeyboardButton[][];
/**
* 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.
*/
resizeKeyboard?: 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.
*/
oneTimeKeyboard?: 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 replyToMessageId), 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.
*
* - https://core.telegram.org/bots/api#keyboardbutton
*/
export declare type 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
*/
requestContact?: boolean;
/**
* Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only
*/
requestLocation?: 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).
*
* - https://core.telegram.org/bots/api#replykeyboardremove
* - https://core.telegram.org/bots/api#replykeyboardmarkup
*/
export declare type 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 oneTimeKeyboard in ReplyKeyboardMarkup)
*/
removeKeyboard: true;
/**
* 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 replyToMessageId), 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.
*
* - https://core.telegram.org/bots/api#inlinekeyboardmarkup
*/
export declare type InlineKeyboardMarkup = {
/**
* Array of button rows, each represented by an Array of InlineKeyboardButton objects
*
* - https://core.telegram.org/bots/api#inlinekeyboardbutton
*/
inlineKeyboard: InlineKeyboardButton[][];
};
/**
* This object represents one button of an inline keyboard. You must use exactly one of the optional fields.
*
* - https://core.telegram.org/bots/api#inlinekeyboardbutton
*/
export declare type InlineKeyboardButton = {
/**
* Label text on the button
*/
text: string;
/**
* Optional. HTTP or tg:// url to be opened when button is pressed
*/
url?: string;
/**
* Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.
*
* - https://core.telegram.org/bots/api#loginurl
* - https://core.telegram.org/widgets/login
*/
loginUrl?: LoginUrl;
/**
* Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
*/
callbackData?: 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.
*
* Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switchPm… actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.
*/
switchInlineQuery?: 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.
*/
switchInlineQueryCurrentChat?: 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.
*
* - https://core.telegram.org/bots/api#callbackgame
*/
callbackGame?: CallbackGame;
/**
* Optional. Specify True, to send a Pay button.
*
* NOTE: This type of button must always be the first button in the first row.
*
* - https://core.telegram.org/bots/api#payments
*/
pay?: boolean;
};
/**
* 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:
*
* - https://core.telegram.org/bots/api#loginurl
*/
export declare type LoginUrl = {
/**
* 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.
*
* - https://core.telegram.org/widgets/login#receiving-authorization-data
* - https://core.telegram.org/widgets/login#checking-authorization
*/
url: string;
/**
* Optional. New text of the button in forwarded messages.
*/
forwardText?: 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.
*
* - https://core.telegram.org/widgets/login#setting-up-a-bot
* - https://core.telegram.org/widgets/login#linking-your-domain-to-the-bot
*/
botUsername?: string;
/**
* Optional. Pass True to request the permission for your bot to send messages to the user.
*/
requestWriteAccess?: boolean;
};
export declare type CallbackQuery = {
id: string;
from: User;
message?: Message;
inlineMessageId?: string;
chatInstance: string;
data?: string;
gameShortName?: string;
};
/**
* 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.
*
* - https://core.telegram.org/bots/api#forcereply
* - https://core.telegram.org/bots#privacy-mode
*/
export declare type ForceReply = {
/**
* Shows reply interface to the user, as if they manually selected the bot‘s message and tapped ’Reply'
*/
forceReply: boolean;
/**
* 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 replyToMessageId), sender of the original message.
*/
selective?: boolean;
};
export declare type ChatPhoto = {
smallFileId: string;
bigFileId: string;
};
export declare type ChatMember = any;
/**
* Describes actions that a non-administrator user is allowed to take in a chat.
*/
export declare type ChatPermissions = {
/**
* Optional. True, if the user is allowed to send text messages, contacts, locations and venues
*/
canSendMessages?: boolean;
/**
* Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages
*/
canSendMediaMessages?: boolean;
/**
* Optional. True, if the user is allowed to send polls, implies can_send_messages
*/
canSendPolls?: boolean;
/**
* Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages
*/
canSendOtherMessages?: boolean;
/**
* Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages
*/
canAddWebPagePreviews?: boolean;
/**
* Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups
*/
canChangeInfo?: boolean;
/**
* Optional. True, if the user is allowed to invite new users to the chat
*/
canInviteUsers?: boolean;
/**
* Optional. True, if the user is allowed to pin messages. Ignored in public supergroups
*/
canPinMessages?: boolean;
};
export declare type ResponseParameters = any;
export declare type InputMedia = InputMediaAnimation | InputMediaDocument | InputMediaAudio | InputMediaPhoto | InputMediaVideo;
export declare enum InputMediaType {
Photo = "photo",
Video = "video",
Animation = "animation",
Audio = "audio",
Document = "document"
}
export declare type InputMediaPhoto = {
/**
* Type of the result, must be photo
*/
type: InputMediaType.Photo;
/**
* File to send. Pass a fileId to send a file that exists on the Telegram servers (recommended) or pass an HTTP URL for Telegram to get a file from the Internet. Upload file is not supported yet.
*/
media: string;
/**
* Optional. Caption of the photo to be sent, 0-1024 characters
*/
caption?: string;
/**
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
*/
parseMode?: ParseMode;
};
export declare type InputMediaVideo = {
/**
* Type of the result, must be video
*/
type: InputMediaType.Video;
/**
* File to send. Pass a fileId to send a file that exists on the Telegram servers (recommended) or pass an HTTP URL for Telegram to get a file from the Internet. Upload file is not supported yet.
*/
media: string;
/**
* Thumb is not supported yet.
*/
thumb?: string;
/**
* Optional. Caption of the video to be sent, 0-1024 characters
*/
caption?: string;
/**
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
*/
parseMode?: string;
/**
* Optional. Video width
*/
width?: number;
/**
* Optional. Video height
*/
height?: number;
/**
* Optional. Video duration
*/
duration?: number;
/**
* Optional. Pass True, if the uploaded video is suitable for streaming
*/
supportsStreaming?: boolean;
};
export declare type InputMediaAnimation = {
type: InputMediaType.Animation;
media: string;
thumb?: string;
caption?: string;
parseMode?: string;
width?: number;
height?: number;
duration?: number;
};
export declare type InputMediaAudio = {
type: InputMediaType.Audio;
media: string;
thumb?: string;
caption?: string;
parseMode?: string;
duration?: number;
performer?: string;
title?: string;
};
export declare type InputMediaDocument = {
type: InputMediaType.Document;
media: string;
thumb?: string;
caption?: string;
parseMode?: string;
};
export declare enum ChatAction {
Typing = "typing",
UploadPhoto = "upload_photo",
RecordVideo = "record_video",
UploadVideo = "upload_video",
RecordAudio = "record_audio",
UploadAudio = "upload_audio",
UploadDocument = "upload_document",
FindLocation = "find_location",
RecordVideoNote = "record_video_note",
UploadVideoNote = "upload_video_note"
}
export declare type Sticker = {
fileId: string;
width: number;
height: number;
isAnimated: boolean;
thumb?: PhotoSize;
emoji?: string;
setName?: string;
maskPosition?: MaskPosition;
fileSize?: number;
};
export declare type StickerSet = {
name: string;
title: string;
isAnimated: boolean;
containsMasks: boolean;
stickers: Sticker[];
};
export declare type MaskPosition = {
point: 'forehead' | 'eyes' | 'mouth' | 'chin';
xShift: number;
yShift: number;
scale: number;
};
export declare type InlineQuery = {
id: string;
from: User;
location?: Location;
query: string;
offset: string;
};
export declare type InlineQueryResult = InlineQueryResultCachedAudio | InlineQueryResultCachedDocument | InlineQueryResultCachedGif | InlineQueryResultCachedMpeg4Gif | InlineQueryResultCachedPhoto | InlineQueryResultCachedSticker | InlineQueryResultCachedVideo | InlineQueryResultCachedVoice | InlineQueryResultArticle | InlineQueryResultAudio | InlineQueryResultContact | InlineQueryResultGame | InlineQueryResultDocument | InlineQueryResultGif | InlineQueryResultLocation | InlineQueryResultMpeg4Gif | InlineQueryResultPhoto | InlineQueryResultVenue | InlineQueryResultVideo | InlineQueryResultVoice;
export declare type InlineQueryResultArticle = {
type: 'article';
id: string;
title: string;
inputMessageContent: InputMessageContent;
replyMarkup?: InlineKeyboardMarkup;
url?: string;
hideUrl?: boolean;
description?: string;
thumbUrl?: string;
thumbWidth?: number;
thumbHeight?: number;
};
export declare type InlineQueryResultPhoto = {
type: 'photo';
id: string;
photoUrl: string;
thumbUrl: string;
title?: string;
description?: string;
caption?: string;
parseMode?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultGif = {
type: 'gif';
id: string;
gifUrl: string;
gifWidth?: number;
gifHeight?: number;
gifDuration?: number;
thumbUrl: string;
title?: string;
caption?: string;
parseMode?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultMpeg4Gif = {
type: 'mpeg4_gif';
id: string;
mpeg4Url: string;
mpeg4Width?: number;
mpeg4Height?: number;
mpeg4Duration?: number;
thumbUrl: string;
title?: string;
caption?: string;
parseMode?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultVideo = {
type: 'video';
id: string;
videoUrl: string;
mimeType: string;
thumbUrl: string;
title: string;
caption?: string;
parseMode?: string;
videoWidth?: number;
videoHeight?: number;
videoDuration?: number;
description?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultAudio = {
type: 'audio';
id: string;
audioUrl: string;
title: string;
caption?: string;
parseMode?: string;
performer?: string;
audioDuration?: number;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultVoice = {
type: 'voice';
id: string;
voiceUrl: string;
title: string;
caption?: string;
parseMode?: string;
voiceDuration?: number;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultDocument = {
type: 'document';
id: string;
title: string;
caption?: string;
parseMode?: string;
documentUrl: string;
mimeType: string;
description?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
thumbUrl?: string;
thumbWidth?: number;
thumbHeight?: number;
};
export declare type InlineQueryResultLocation = {
type: 'location';
id: string;
latitude: number;
longitude: number;
title: string;
livePeriod?: number;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
thumbUrl?: string;
thumbWidth?: number;
thumbHeight?: number;
};
export declare type InlineQueryResultVenue = {
type: 'venue';
id: string;
latitude: number;
longitude: number;
title: string;
address: string;
foursquareId?: string;
foursquareType?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
thumbUrl?: string;
thumbWidth?: number;
thumbHeight?: number;
};
export declare type InlineQueryResultContact = {
type: 'contact';
id: string;
phoneNumber: string;
firstName: string;
lastName?: string;
vcard?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
thumbUrl?: string;
thumbWidth?: number;
thumbHeight?: number;
};
export declare type InlineQueryResultGame = {
type: 'game';
id: string;
gameShortName: string;
replyMarkup?: InlineKeyboardMarkup;
};
export declare type InlineQueryResultCachedPhoto = {
type: 'photo';
id: string;
photoFileId: string;
title?: string;
description?: string;
caption?: string;
parseMode?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultCachedGif = {
type: 'gif';
id: string;
gifFileId: string;
title?: string;
caption?: string;
parseMode?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultCachedMpeg4Gif = {
type: 'mpeg4_gif';
id: string;
mpeg4FileId: string;
title?: string;
caption?: string;
parseMode?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultCachedSticker = {
type: 'sticker';
id: string;
stickerFileId: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultCachedDocument = {
type: 'document';
id: string;
title: string;
documentFileId: string;
description?: string;
caption?: string;
parseMode?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultCachedVideo = {
type: 'video';
id: string;
videoFileId: string;
title: string;
description?: string;
caption?: string;
parseMode?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultCachedVoice = {
type: 'voice';
id: string;
voiceFileId: string;
title: string;
caption?: string;
parseMode?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InlineQueryResultCachedAudio = {
type: 'audio';
id: string;
audioFileId: string;
caption?: string;
parseMode?: string;
replyMarkup?: InlineKeyboardMarkup;
inputMessageContent?: InputMessageContent;
};
export declare type InputMessageContent = InputTextMessageContent | InputLocationMessageContent | InputVenueMessageContent | InputContactMessageContent;
export declare type InputTextMessageContent = {
messageText: string;
parseMode?: string;
disableWebPagePreview?: boolean;
};
export declare type InputLocationMessageContent = {
latitude: number;
longitude: number;
livePeriod?: number;
};
export declare type InputVenueMessageContent = {
latitude: number;
longitude: number;
title: string;
address: string;
foursquareId?: string;
foursquareType?: string;
};
export declare type InputContactMessageContent = {
phoneNumber: string;
firstName: string;
lastName?: string;
vcard?: string;
};
export declare type ChosenInlineResult = {
resultId: string;
from: User;
location?: Location;
inlineMessageId?: string;
query: string;
};
export declare type LabeledPrice = {
label: string;
amount: number;
};
export declare type Invoice = {
title: string;
description: string;
startParameter: string;
currency: string;
totalAmount: number;
};
export declare type Product = {
title: string;
description: string;
startParameter: string;
currency: string;
payload: string;
providerToken: string;
prices: LabeledPrice[];
};
export declare type ShippingAddress = {
countryCode: string;
state: string;
city: string;
streetLine1: string;
streetLine2: string;
postCode: string;
};
export declare type OrderInfo = {
name?: string;
phoneNumber?: string;
email?: string;
shippingAddress?: ShippingAddress;
};
export declare type ShippingOption = {
id: string;
title: string;
prices: LabeledPrice[];
};
export declare type SuccessfulPayment = {
currency: string;
totalAmount: number;
invoicePayload: string;
shippingOptionId?: string;
orderInfo?: OrderInfo;
telegramPaymentChargeId: string;
providerPaymentChargeId: string;
};
export declare type ShippingQuery = {
id: string;
from: User;
invoicePayload: string;
shippingAddress: ShippingAddress;
};
export declare type PreCheckoutQuery = {
id: string;
from: User;
currency: string;
totalAmount: number;
invoicePayload: string;
shippingOptionId?: string;
orderInfo?: OrderInfo;
};
export declare type PassportData = {
data: EncryptedPassportElement[];
credentials: EncryptedCredentials;
};
export declare type PassportFile = {
fileId: string;
fileSize: number;
fileDate: number;
};
export declare type EncryptedPassportElement = {
type: 'personal_details' | 'passport' | 'driver_license' | 'identity_card' | 'internal_passport' | 'address' | 'utility_bill' | 'bank_statement' | 'rental_agreement' | 'passport_registration' | 'temporary_registration' | 'phone_number' | 'email';
data?: string;
phoneNumber?: string;
email?: string;
files?: PassportFile[];
frontSide?: PassportFile;
reverseSide?: PassportFile;
selfie?: PassportFile;
translation?: PassportFile[];
hash: string;
};
export declare type EncryptedCredentials = {
data: string;
hash: string;
secret: string;
};
export declare type PassportElementError = PassportElementErrorDataField | PassportElementErrorFrontSide | PassportElementErrorReverseSide | PassportElementErrorSelfie | PassportElementErrorFile | PassportElementErrorFiles | PassportElementErrorTranslationFile | PassportElementErrorTranslationFiles | PassportElementErrorUnspecified;
export declare type PassportElementErrorDataField = {
source: string;
type: 'personal_details' | 'passport' | 'driver_license' | 'identity_card' | 'internal_passport' | 'address';
fieldName: string;
dataHash: string;
message: string;
};
export declare type PassportElementErrorFrontSide = {
source: 'front_side';
type: 'passport' | 'driver_license' | 'identity_card' | 'internal_passport';
fileHash: string;
message: string;
};
export declare type PassportElementErrorReverseSide = {
source: 'reverse_side';
type: 'driver_license' | 'identity_card';
fileHash: string;
message: string;
};
export declare type PassportElementErrorSelfie = {
source: 'selfie';
type: 'passport' | 'driver_license' | 'identity_card' | 'internal_passport';
fileHash: string;
message: string;
};
export declare type PassportElementErrorFile = {
source: 'file';
type: 'utility_bill' | 'bank_statement' | 'rental_agreement' | 'passport_registration' | 'temporary_registration';
fileHash: string;
message: string;
};
export declare type PassportElementErrorFiles = {
source: 'files';
type: 'utility_bill' | 'bank_statement' | 'rental_agreement' | 'passport_registration' | 'temporary_registration';
fileHashes: string[];
message: string;
};
export declare type PassportElementErrorTranslationFile = {
source: 'translation_file';
type: 'passport' | 'driver_license' | 'identity_card' | 'internal_passport' | 'utility_bill' | 'bank_statement' | 'rental_agreement' | 'passport_registration' | 'temporary_registration';
fileHash: string;
message: string;
};
export declare type PassportElementErrorTranslationFiles = {
source: 'translation_files';
type: 'passport' | 'driver_license' | 'identity_card' | 'internal_passport' | 'utility_bill' | 'bank_statement' | 'rental_agreement' | 'passport_registration' | 'temporary_registration';
fileHashes: string[];
message: string;
};
export declare type PassportElementErrorUnspecified = {
source: 'unspecified';
type: string;
elementHash: string;
message: string;
};
export declare type Game = {
title: string;
description: string;
photo: PhotoSize[];
text?: string;
textEntities?: MessageEntity[];
animation?: Animation;
};
/**
* A placeholder, currently holds no information. Use BotFather to set up your game.
*
* - https://core.telegram.org/bots/api#callbackgame
*/
export declare type CallbackGame = any;
export declare type GameHighScore = {
position: number;
user: User;
score: number;
};
export declare type SetWebhookOption = {
/**
* not supported yet.
*/
certificate?: string;
/**
* 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.
*/
maxConnections?: 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.
*/
allowedUpdates?: string[];
};
export declare type GetUpdatesOption = {
/**
* 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 updateId. 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.
*/
allowedUpdates?: string[];
};
export declare type SendMessageOption = {
/**
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
*
* - https://core.telegram.org/bots/api#markdown-style
* - https://core.telegram.org/bots/api#html-style
* - https://core.telegram.org/bots/api#formatting-options
*/
parseMode?: ParseMode;
/**
* Disables link previews for links in this message
*/
disableWebPagePreview?: boolean;
/**
* Sends the message silently. Users will receive a notification with no sound.
*
* - https://telegram.org/blog/channels-2-0#silent-messages
*/
disableNotification?: boolean;
/**
* If the message is a reply, ID of the original message
*/
replyToMessageId?: number;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*
* - https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
* - https://core.telegram.org/bots#keyboards
* - https://core.telegram.org/bots/api#inlinekeyboardmarkup
* - https://core.telegram.org/bots/api#replykeyboardmarkup
* - https://core.telegram.org/bots/api#replykeyboardremove
* - https://core.telegram.org/bots/api#forcereply
*/
replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
};
export declare enum ParseMode {
Markdown = "Markdown",
HTML = "HTML"
}
export declare type ForwardMessageOption = {
/**
* Sends the message silently. Users will receive a notification with no sound.
*/
disableNotification?: boolean;
};
export declare type SendPhotoOption = {
/**
* Photo caption (may also be used when resending photos by fileId), 0-1024 characters
*/
caption?: string;
/**
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
*
* - https://core.telegram.org/bots/api#markdown-style
* - https://core.telegram.org/bots/api#html-style
* - https://core.telegram.org/bots/api#formatting-options
*/
parseMode?: ParseMode;
/**
* Sends the message silently. Users will receive a notification with no sound.
*
* - https://telegram.org/blog/channels-2-0#silent-messages
*/
disableNotification?: boolean;
/**
* If the message is a reply, ID of the original message
*/
replyToMessageId?: number;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*
* - https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
* - https://core.telegram.org/bots#keyboards
* - https://core.telegram.org/bots/api#inlinekeyboardmarkup
* - https://core.telegram.org/bots/api#replykeyboardmarkup
* - https://core.telegram.org/bots/api#replykeyboardremove
* - https://core.telegram.org/bots/api#forcereply
*/
replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
};
export declare type SendAudioOption = {
/**
* Audio caption, 0-1024 characters
*/
caption?: string;
/**
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
*
* - https://core.telegram.org/bots/api#markdown-style
* - https://core.telegram.org/bots/api#html-style
* - https://core.telegram.org/bots/api#formatting-options
*/
parseMode?: ParseMode;
/**
* Duration of the audio in seconds
*/
duration?: number;
/**
* Performer
*/
performer?: string;
/**
* Track name
*/
title?: string;
/**
* Thumb is not supported yet.
*/
thumb?: string;
/**
* Sends the message silently. Users will receive a notification with no sound.
*
* - https://telegram.org/blog/channels-2-0#silent-messages
*/
disableNotification?: boolean;
/**
* If the message is a reply, ID of the original message
*/
replyToMessageId?: number;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*
* - https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
* - https://core.telegram.org/bots#keyboards
* - https://core.telegram.org/bots/api#inlinekeyboardmarkup
* - https://core.telegram.org/bots/api#replykeyboardmarkup
* - https://core.telegram.org/bots/api#replykeyboardremove
* - https://core.telegram.org/bots/api#forcereply
*/
replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
};
export declare type SendDocumentOption = {
/**
* Thumb is not supported yet.
*/
thumb?: string;
/**
* Document caption (may also be used when resending documents by fileId), 0-1024 characters
*/
caption?: string;
/**
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
*
* - https://core.telegram.org/bots/api#markdown-style
* - https://core.telegram.org/bots/api#html-style
* - https://core.telegram.org/bots/api#formatting-options
*/
parseMode?: ParseMode;
/**
* Sends the message silently. Users will receive a notification with no sound.
*
* - https://telegram.org/blog/channels-2-0#silent-messages
*/
disableNotification?: boolean;
/**
* If the message is a reply, ID of the original message
*/
replyToMessageId?: number;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*
* - https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
* - https://core.telegram.org/bots#keyboards
* - https://core.telegram.org/bots/api#inlinekeyboardmarkup
* - https://core.telegram.org/bots/api#replykeyboardmarkup
* - https://core.telegram.org/bots/api#replykeyboardremove
* - https://core.telegram.org/bots/api#forcereply
*/
replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
};
export declare type SendVideoOption = {
/**
* Duration of sent video in seconds
*/
duration?: number;
/**
* Video width
*/
width?: number;
/**
* Video height
*/
height?: number;
/**
* Thumb is not supported yet.
*/
thumb?: string;
/**
* Video caption (may also be used when resending videos by fileId), 0-1024 characters
*/
caption?: string;
/**
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
*
* - https://core.telegram.org/bots/api#markdown-style
* - https://core.telegram.org/bots/api#html-style
* - https://core.telegram.org/bots/api#formatting-options
*/
parseMode?: ParseMode;
/**
* Pass True, if the uploaded video is suitable for streaming
*/
supportsStreaming?: boolean;
/**
* Sends the message silently. Users will receive a notification with no sound.
*
* - https://telegram.org/blog/channels-2-0#silent-messages
*/
disableNotification?: boolean;
/**
* If the message is a reply, ID of the original message
*/
replyToMessageId?: number;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*
* - https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
* - https://core.telegram.org/bots#keyboards
* - https://core.telegram.org/bots/api#inlinekeyboardmarkup
* - https://core.telegram.org/bots/api#replykeyboardmarkup
* - https://core.telegram.org/bots/api#replykeyboardremove
* - https://core.telegram.org/bots/api#forcereply
*/
replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
};
export declare type SendAnimationOption = {
/**
* Duration of sent animation in seconds
*/
duration?: number;
/**
* Animation width
*/
width?: number;
/**
* Animation height
*/
height?: number;
/**
* Thumb is not supported yet.
*/
thumb?: string;
/**
* Animation caption (may also be used when resending animation by fileId), 0-1024 characters
*/
caption?: string;
/**
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
*
* - https://core.telegram.org/bots/api#markdown-style
* - https://core.telegram.org/bots/api#html-style
* - https://core.telegram.org/bots/api#formatting-options
*/
parseMode?: ParseMode;
/**
* Sends the message silently. Users will receive a notification with no sound.
*
* - https://telegram.org/blog/channels-2-0#silent-messages
*/
disableNotification?: boolean;
/**
* If the message is a reply, ID of the original message
*/
replyToMessageId?: number;
/**
* Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*
* - https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
* - https://core.telegram.org/bots#keyboards
* - https://core.telegram.org/bots/api#inlinekeyboardmarkup
* - https://core.telegram.org/bots/api#replykeyboardmarkup
* - https://core.telegram.org/bots/api#replykeyboardremove
* - https://core.telegram.org/bots/api#forcereply
*/
replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
};
export declare type SendVoiceOption = {
/**
* Voice message caption, 0-1024 characters
*/
caption?: string;
/**
* Duration of the voice message in seconds
*/
duration?: number;
/**
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
*
* - https://core.telegram.org/bots/api#markdown-style
* - https://core.telegram.org/bots/api#html-style
*