regraf
Version:
Continuation of best modern Telegram Bot Framework
1,420 lines (1,171 loc) • 54 kB
TypeScript
import * as TT from '@grammyjs/types'
import { StoryArea } from '@grammyjs/types'
export * from '@grammyjs/types'
export type ParseMode = 'Markdown' | 'MarkdownV2' | 'HTML'
export type ChatAction =
'typing' |
'choose_sticker' |
'upload_photo' |
'record_video' |
'upload_video' |
'record_voice' |
'upload_voice' |
'upload_document' |
'find_location' |
'record_video_note' |
'upload_video_note'
export type ChatType =
'private' |
'group' |
'supergroup' |
'channel'
export type UpdateType =
'callback_query' |
'channel_post' |
'chosen_inline_result' |
'edited_channel_post' |
'edited_message' |
'inline_query' |
'message' |
'pre_checkout_query' |
'shipping_query' |
'poll' |
'poll_answer' |
'my_chat_member' |
'chat_member' |
'chat_join_request' |
'message_reaction' |
'message_reaction_count' |
'chat_boost' |
'removed_chat_boost' |
'business_connection ' |
'business_message' |
'edited_business_message' |
'deleted_business_messages' |
'purchased_paid_media'
export type MessageSubTypes =
'voice' |
'video_note' |
'video' |
'animation' |
'venue' |
'text' |
'supergroup_chat_created' |
'successful_payment' |
'sticker' |
'pinned_message' |
'photo' |
'new_chat_title' |
'new_chat_photo' |
'new_chat_members' |
'migrate_to_chat_id' |
'migrate_from_chat_id' |
'location' |
'left_chat_member' |
'invoice' |
'group_chat_created' |
'game' |
'dice' |
'document' |
'delete_chat_photo' |
'contact' |
'channel_chat_created' |
'audio' |
'connected_website' |
'passport_data' |
'poll' |
'forward' |
'message_auto_delete_timer_changed' |
'voice_chat_started' |
'voice_chat_ended' |
'voice_chat_participants_invited' |
'voice_chat_scheduled' |
'forum_topic_created' |
'forum_topic_edited' |
'forum_topic_closed' |
'forum_topic_reopened' |
'users_shared' |
'chat_shared' |
'giveaway' |
'giveaway_created' |
'giveaway_winners' |
'giveaway_completed' |
'story' |
'boost_added' |
'refunded_payment'
export type InputMediaTypes =
'photo'
| 'video'
| 'animation'
| 'audio'
| 'document'
export type ChatMemberStatus =
'creator'
| 'administrator'
| 'member'
| 'restricted'
| 'left'
| 'kicked'
export type MessageEntityType =
'mention'
| 'hashtag'
| 'cashtag'
| 'bot_command'
| 'url'
| 'email'
| 'phone_number'
| 'bold'
| 'italic'
| 'underline'
| 'strikethrough'
| 'code'
| 'text_link'
| 'text_mention'
| 'pre'
| 'spoiler'
export type InlineQueryResult =
TT.InlineQueryResultCachedAudio |
TT.InlineQueryResultCachedDocument |
TT.InlineQueryResultCachedGif |
TT.InlineQueryResultCachedMpeg4Gif |
TT.InlineQueryResultCachedPhoto |
TT.InlineQueryResultCachedSticker |
TT.InlineQueryResultCachedVideo |
TT.InlineQueryResultCachedVoice |
TT.InlineQueryResultArticle |
TT.InlineQueryResultAudio |
TT.InlineQueryResultContact |
TT.InlineQueryResultGame |
TT.InlineQueryResultDocument |
TT.InlineQueryResultGif |
TT.InlineQueryResultLocation |
TT.InlineQueryResultMpeg4Gif |
TT.InlineQueryResultPhoto |
TT.InlineQueryResultVenue |
TT.InlineQueryResultVideo |
TT.InlineQueryResultVoice
export type MessageMedia =
InputMediaPhoto |
InputMediaVideo |
InputMediaAnimation |
InputMediaAudio |
InputMediaDocument
export interface TargetEntity {
/**
* Required if chat_id is not specified. Unique identifier of the target user who will receive the gift.
*/
user_id?: number;
/**
* Required if user_id is not specified. Unique identifier for the chat or username of the channel (in the format @channelusername) that will receive the gift.
*/
chat_id?: number;
}
export type InputProfilePhoto = InputProfilePhotoStatic | InputProfilePhotoAnimated
export interface InputProfilePhotoStatic {
type: 'static'
photo: InputFile
}
export interface InputProfilePhotoAnimated {
type: 'animated'
animation: InputFile
main_frame_timestamp?: number
}
export type InputStoryContent = InputStoryContentPhoto | InputStoryContentVideo
export interface InputStoryContentPhoto {
type: 'photo'
photo: InputFile
}
export interface InputStoryContentVideo {
type: 'video'
video: InputFile
duration?: number
cover_frame_timestamp?: number
is_animation?: boolean
}
export interface InputMediaPhoto extends ExtraCaption, ExtraSpoiler {
type: InputMediaTypes
media: InputFile
}
export interface InputMediaVideo extends ExtraCaption, ExtraSpoiler, ExtraCover, ExtraStartTimestamp {
type: InputMediaTypes
media: InputFile
thumbnail?: string | InputFile
width?: number
height?: number
duration?: number
supports_streaming?: boolean
}
export interface InputMediaAnimation extends ExtraCaption, ExtraSpoiler {
type: InputMediaTypes
media: InputFile
thumbnail?: string | InputFile
width?: number
height?: number
duration?: number
supports_streaming?: boolean
}
export interface InputMediaAudio extends ExtraCaption {
type: InputMediaTypes
media: InputFile
thumbnail?: string | InputFile
performer?: string
title?: string
duration?: number
supports_streaming?: boolean
}
export interface InputMediaDocument extends ExtraCaption {
type: InputMediaTypes
media: InputFile
thumbnail?: string | InputFile
}
export interface InputSticker {
/**
* The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL.
*/
sticker: InputFile
/**
* Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a WEBM video
*/
format: 'static' | 'animated' | 'video'
/**
* List of 1-20 emoji associated with the sticker
*/
emoji_list: string[]
/**
* Position where the mask should be placed on faces. For “mask” stickers only.
*/
mask_position?: TT.MaskPosition
/**
* List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom_emoji” stickers only.
*/
keywords?: string[]
}
type FileId = string
export interface InputFileByPath {
source: string
}
export interface InputFileByReadableStream {
source: NodeJS.ReadableStream
filename: string
}
export interface InputFileByBuffer {
source: Buffer
filename: string
}
export interface InputFileByURL {
url: string
filename: string
}
export type InputFile =
FileId |
InputFileByPath |
InputFileByReadableStream |
InputFileByBuffer |
InputFileByURL
/**
* Sending video notes by a URL is currently unsupported
*/
export type InputFileVideoNote = Exclude<InputFile, InputFileByURL>
export interface PaidMediaPhoto {
type: "photo"
media: InputFile
}
export interface PaidMediaVideo extends ExtraCover, ExtraStartTimestamp {
type: "video"
media: InputFile
thumbnail?: InputFile
width?: number
height?: number
duration?: number
supports_streaming?: boolean
}
export type PaidMedia = PaidMediaPhoto | PaidMediaVideo
export type StickerFormat = "static" | "animated" | "video";
export type StickerType = "regular" | "mask" | "custom_emoji";
export interface ChatPermissions {
/** True, if the user is allowed to send text messages, contacts, locations and venues */
can_send_messages?: boolean
/** 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
/** True, if the user is allowed to send audios */
can_send_audios?: boolean
/** True, if the user is allowed to send photos */
can_send_photos?: boolean
/** True, if the user is allowed to send videos */
can_send_videos?: boolean
/** True, if the user is allowed to send video notes */
can_send_video_notes?: boolean
/** True, if the user is allowed to send voice notes */
can_send_voice_notes?: boolean
/** True, if the user is allowed to send polls, implies can_send_messages */
can_send_polls?: boolean
/** 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
/** 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
/** True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups */
can_change_info?: boolean
/** True, if the user is allowed to invite new users to the chat */
can_invite_users?: boolean
/** True, if the user is allowed to pin messages. Ignored in public supergroups */
can_pin_messages?: boolean
/** True, if the user is allowed to create forum topics. If omitted defaults to the value of can_pin_messages */
can_manage_topics?: boolean
}
export interface ExtraSetWebhook {
/** SSL public certificate */
certificate?: InputFile
/** The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS */
ip_address?: string
/** Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. */
max_connections?: number
/** List the types of updates you want your bot to receive */
allowed_updates?: UpdateType[]
/** Pass True to drop all pending updates */
drop_pending_updates?: boolean
/** A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you. */
secret_token?: string
}
export interface ExtraDeleteWebhook {
/** Pass True to drop all pending updates */
drop_pending_updates?: boolean
}
export interface ExtraRestrictChatMember {
/** New user permissions */
permissions: ChatPermissions
/** Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission. */
use_independent_chat_permissions?: boolean
/** Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever */
until_date?: number
}
export interface ExtraPromoteChatMember {
/** Pass True, if the administrator can change chat title, photo and other settings */
can_change_info?: boolean
/** Pass True, if the administrator can create channel posts, channels only */
can_post_messages?: boolean
/** Pass True, if the administrator can edit messages of other users and can pin messages, channels only */
can_edit_messages?: boolean
/** Pass True, if the administrator can delete messages of other users */
can_delete_messages?: boolean
/** Pass True, if the administrator can manage voice chats */
can_manage_video_chats?: boolean,
/** Pass True, if the administrator can invite new users to the chat */
can_invite_users?: boolean
/** Pass True, if the administrator can restrict, ban or unban chat members */
can_restrict_members?: boolean
/** Pass True, if the administrator can pin messages, supergroups only */
can_pin_messages?: boolean
/** True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) */
can_promote_members?: boolean
/** True, if the administrator can post stories to the chat */
can_post_stories?: boolean
/** True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive */
can_edit_stories?: boolean
/** True, if the administrator can delete stories posted by other users */
can_delete_stories?: boolean
/** True if the administrator can manage direct messages within the channel and decline suggested posts; for channels only */
can_manage_direct_messages?: boolean
/** True if the administrator can edit the tags of regular members; for groups and supergroups only */
can_manage_tags?: boolean
}
export type ReplyMarkupBundle = TT.ReplyKeyboardMarkup | TT.ReplyKeyboardRemove | TT.ForceReply
export type KeyboardMarkupBundle = TT.InlineKeyboardMarkup | ReplyMarkupBundle
export interface ExtraReplyMarkup {
/**
* Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
*/
reply_markup?: TT.InlineKeyboardMarkup | ReplyMarkupBundle
}
export interface ExtraReply<T extends KeyboardMarkupBundle> {
reply_markup?: T
}
export interface ExtraReplyMarkupInlineKeyboard {
/** A JSON-serialized object for a new message inline keyboard. */
reply_markup?: TT.InlineKeyboardMarkup
}
export interface ExtraFormatting {
/**
* Mode for parsing entities in the message text. See formatting options for more details.
*/
parse_mode?: ParseMode
/**
* List of special entities that appear in message text, which can be specified instead of parse_mode
*/
entities?: TT.MessageEntity[]
}
export interface ExtraCaptionFormatting {
/**
* Mode for parsing entities in the photo caption. See formatting options for more details.
*/
parse_mode?: ParseMode
/**
* List of special entities that appear in message text, which can be specified instead of parse_mode
*/
caption_entities?: TT.MessageEntity[]
}
export interface ExtraDirectMessagesTopicId {
/**
* Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
*/
direct_messages_topic_id?: number
}
export interface ExtraSuggestedPostParameters {
/**
* An object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
*/
suggested_post_parameters?: TT.SuggestedPostParameters
}
export interface ExtraTextFormatting {
/**
* Mode for parsing entities in the text. See formatting options for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, “custom_emoji”, and “date_time” are ignored.
*/
text_parse_mode?: ParseMode
/**
* List of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, “custom_emoji”, and “date_time” are ignored.
*/
text_entities?: TT.MessageEntity[]
}
export interface ExtraCaption extends ExtraCaptionFormatting {
/**
* Media caption, 0-1024 characters
*/
caption?: string
}
export interface ExtraDisableWebPagePreview {
/**
* Link preview generation options for the message
*/
link_preview_options?: TT.LinkPreviewOptions
}
export interface ExtraDisableNotifications {
/**
* Sends the message silently. Users will receive a notification with no sound.
*/
disable_notification?: boolean
}
export interface ReplyParameters {
/**
* Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified
*/
message_id: number
/**
* If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername).
* Not supported for messages sent on behalf of a business account.
*/
chat_id?: number | string
/**
* Pass True if the message should be sent even if the specified message to be replied to is not found. Always False for replies in another chat or forum topic.
* Always True for messages sent on behalf of a business account.
*/
allow_sending_without_reply?: boolean
/**
* Quoted part of the message to be replied to; 0-1024 characters after entities parsing.
* The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities.
* The message will fail to send if the quote isn't found in the original message.
*/
quote?: string
/**
* Mode for parsing entities in the quote. See formatting options for more details.
*/
quote_parse_mode?: ParseMode
/**
* A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode.
*/
quote_entities?: TT.MessageEntity[]
/**
* Position of the quote in the original message in UTF-16 code units
*/
quote_position?: number
/**
* Identifier of the specific checklist task to be replied to
*/
checklist_task_id?: number
}
export interface ExtraReplyMessage {
/**
* Description of the message to reply to
*/
reply_parameters?: ReplyParameters
}
export interface ExtraProtectContent {
/**
* Protects the contents of the sent message from forwarding and saving
*/
protect_content?: boolean
}
export interface ExtraMessageThread {
/**
* Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*/
message_thread_id?: number
}
export interface ExtraBusinessConnectionId {
/**
* Unique identifier of the business connection on behalf of which the message will be sent
*/
business_connection_id?: string
}
export interface ExtraEffectId {
/**
* Unique identifier of the message effect to be added to the message; for private chats only
*/
message_effect_id?: string
}
export interface ExtraCaptionAboveMedia {
/**
* Pass True, if the caption must be shown above the message media
*/
show_caption_above_media?: boolean
}
export interface ExtraPaidBroadcast {
/**
* Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
*/
allow_paid_broadcast?: boolean
}
export interface ExtraSendMessage extends ExtraFormatting, ExtraDisableWebPagePreview, ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
}
export interface ExtraEditMessage extends ExtraFormatting, ExtraDisableWebPagePreview, ExtraReplyMarkupInlineKeyboard, ExtraBusinessConnectionId {
}
export interface ExtraEditMessageMedia extends ExtraReplyMarkupInlineKeyboard, ExtraBusinessConnectionId {
}
export interface ExtraForwardMessage extends ExtraDisableNotifications, ExtraMessageThread, ExtraProtectContent, ExtraBusinessConnectionId, ExtraVideoStartTimestamp, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
}
export interface ExtraForwardMessages extends ExtraDisableNotifications, ExtraMessageThread, ExtraProtectContent, ExtraBusinessConnectionId, ExtraVideoStartTimestamp, ExtraDirectMessagesTopicId {
}
export interface ExtraSendChatAction extends ExtraMessageThread, ExtraBusinessConnectionId {
}
export interface ExtraPinMessage extends ExtraBusinessConnectionId, ExtraDisableNotifications {
}
export interface ExtraUnpinMessage extends ExtraBusinessConnectionId {
/**
* Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned.
*/
message_id?: number
}
export interface ExtraAudio extends ExtraCaption, ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
/**
* Duration of the audio in seconds
*/
duration?: number
/**
* Performer
*/
performer?: string
/**
* Track name
*/
title?: string
/**
* Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
* The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320.
* Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file,
* so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
*/
thumbnail?: InputFile
}
export interface ExtraDocument extends ExtraCaption, ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
/**
* Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
* The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320.
* Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file,
* so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
*/
thumbnail?: InputFile
/**
* Disables automatic server-side content type detection for files uploaded using multipart/form-data
*/
disable_content_type_detection?: Boolean
}
export interface ExtraGame extends ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkupInlineKeyboard, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast {
}
export interface ExtraInvoice extends ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkupInlineKeyboard, ExtraProtectContent, ExtraMessageThread, ExtraEffectId, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
}
export interface CreateInvoiceLink extends ExtraBusinessConnectionId {
/**
* The number of seconds the subscription will be active for before the next payment. The currency must be set to “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 10000 Telegram Stars.
*/
subscription_period: number
}
export interface ExtraLocation extends ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
/**
* The radius of uncertainty for the location, measured in meters; 0-1500
*/
horizontal_accuracy?: number
/**
* Period in seconds for which the location will be updated (should be between 60 and 86400)
*/
live_period?: number
/**
* For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
*/
heading?: number
/**
* For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
*/
proximity_alert_radius?: number
}
export interface ExtraEditLocation extends ExtraReplyMarkupInlineKeyboard, ExtraBusinessConnectionId {
/**
* The radius of uncertainty for the location, measured in meters; 0-1500
*/
horizontal_accuracy?: number
/**
* Period in seconds during which the location will be updated (see Live Locations, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.
*/
live_period?: number
/**
* For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
*/
heading?: number
/**
* For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
*/
proximity_alert_radius?: number
}
export interface ExtraStopLiveLocation extends ExtraReplyMarkupInlineKeyboard, ExtraBusinessConnectionId {
}
export interface ExtraCreateForumTopic extends ExtraIcon {
}
export interface ExtraIcon {
/**
* Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)
*/
icon_color?: number
/**
* Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers.
*/
icon_custom_emoji_id?: string
}
export interface ExtraVenue extends ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
/**
* Foursquare identifier of the venue
*/
foursquare_id?: string
/**
* Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
*/
foursquare_type?: string
/**
* Google Places identifier of the venue
*/
google_place_id?: string
/**
* Google Places type of the venue. (See [supported types](https://developers.google.com/places/web-service/supported_types).)
*/
google_place_type?: string
}
export interface ExtraContact extends ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
/**
* Contact's last name
*/
last_name?: string
/**
* Additional data about the contact in the form of a [vCard](https://en.wikipedia.org/wiki/VCard), 0-2048 bytes
*/
vcard?: string
}
export interface ExtraSpoiler {
/**
* Pass True if the photo needs to be covered with a spoiler animation
*/
has_spoiler?: boolean
}
export interface ExtraCover {
/**
* Cover for the video in the message.
*/
cover?: InputFile
}
export interface ExtraStartTimestamp {
/**
* Start timestamp for the video in the message
*/
start_timestamp?: number
}
export interface ExtraVideoStartTimestamp {
/**
* New start timestamp for the forwarded video in the message
*/
video_start_timestamp?: number
}
export interface ExtraPhoto extends ExtraCaption, ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraSpoiler, ExtraBusinessConnectionId, ExtraEffectId, ExtraCaptionAboveMedia, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
}
export interface ExtraMediaGroup extends ExtraDisableNotifications, ExtraReplyMessage, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast, ExtraDirectMessagesTopicId {
}
export interface ExtraAnimation extends ExtraCaption, ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraSpoiler, ExtraBusinessConnectionId, ExtraEffectId, ExtraCaptionAboveMedia, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
}
export interface ExtraSticker extends ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
/**
* Emoji associated with the sticker; only for just uploaded stickers
*/
emoji?: string
}
export interface ExtraVideo extends ExtraCaption, ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraSpoiler, ExtraBusinessConnectionId, ExtraEffectId, ExtraCaptionAboveMedia, ExtraPaidBroadcast, ExtraCover, ExtraStartTimestamp, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
/**
* Duration of sent video in seconds
*/
duration?: number
/**
* Video width
*/
width?: number
/**
* Video height
*/
height?: number
/**
* Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
* The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320.
* Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file,
* so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
*/
thumbnail?: InputFile
/**
* Pass True, if the uploaded video is suitable for streaming
*/
supports_streaming?: boolean
}
export interface ExtraVideoNote extends ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
/**
* Duration of sent video in seconds
*/
duration?: number
/**
* Video width and height, i.e. diameter of the video message
*/
length?: number
/**
* Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
* The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320.
* Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file,
* so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
*/
thumbnail?: InputFile
}
export interface ExtraVoice extends ExtraCaption, ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
/**
* Duration of the voice message in seconds
*/
duration?: number
}
export interface ExtraPaidMedia extends ExtraBusinessConnectionId, ExtraMessageThread, ExtraPayload, ExtraCaption, ExtraCaptionFormatting, ExtraCaptionAboveMedia, ExtraDisableNotifications, ExtraProtectContent, ExtraReplyMarkup, ExtraReplyMessage, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
}
export interface ExtraDice extends ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
/**
* Emoji on which the dice throw animation is based.
* Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, or “🎰”.
* Dice can have values 1-6 for “🎲” and “🎯”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”.
* Defaults to “🎲”
* */
emoji?: string
}
export interface ExtraMessageDraft extends ExtraMessageThread, ExtraFormatting {
/**
* Text of the message to be sent, 0-4096 characters after entities parsing. Pass an empty text to show a “Thinking…” placeholder.
*/
text?: string;
}
export interface ExtraPoll extends ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraBusinessConnectionId, ExtraEffectId, ExtraPaidBroadcast {
/** True, if the poll needs to be anonymous, defaults to True */
is_anonymous?: boolean
/** True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False */
allows_multiple_answers?: boolean
/** Pass True, if the poll needs to be immediately closed. This can be useful for poll preview. */
is_closed?: boolean
/** Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. */
open_period?: number
/** Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period. */
close_date?: number
/** Mode for parsing entities in the question. See formatting options for more details. Currently, only custom emoji entities are allowed */
question_parse_mode?: ParseMode
/** List of special entities that appear in the poll question. It can be specified instead of question_parse_mode */
question_entities?: TT.MessageEntity[]
}
export interface ExtraQuiz extends ExtraPoll {
/** 0-based identifier of the correct answer option, required for polls in quiz mode */
correct_option_id: number
/** 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 with at most 2 line feeds after entities parsing */
explanation?: string
/** List of special entities that appear in the poll explanation, which can be specified instead of parse_mode */
explanation_entities?: TT.MessageEntity[]
/** Mode for parsing entities in the explanation. See formatting options for more details. */
explanation_parse_mode?: ParseMode
}
export interface ExtraGift extends ExtraTextFormatting {
/**
* Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
*/
pay_for_upgrade?: boolean
/**
* Text that will be shown along with the gift; 0-128 characters
*/
text?: string
}
export interface ExtraStopPoll extends ExtraReplyMarkupInlineKeyboard, ExtraBusinessConnectionId {
}
export interface ExtraEditCaption extends ExtraCaptionFormatting, ExtraReplyMarkupInlineKeyboard, ExtraCaptionAboveMedia, ExtraBusinessConnectionId {
}
export interface ExtraEditMessageReplyMarkup extends ExtraBusinessConnectionId {
}
export interface ExtraAnswerCallbackQuery {
/**
* URL that will be opened by the user's client.
* If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game — note that this will only work if the query comes from a `callback_game` button.
*
* Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
*/
url?: string
/**
* The maximum amount of time in seconds that the result of the callback query may be cached client-side.
* Telegram apps will support caching starting in version 3.14. Defaults to 0.
*/
cache_time?: number
}
export interface ExtraGiftFilterExcludeUnlimited {
/**
* Pass True to exclude gifts that can be purchased an unlimited number of times
*/
exclude_unlimited?: boolean
}
export interface ExtraGiftFilterExcludeLimitedUpgradable {
/**
* Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
*/
exclude_limited_upgradable?: boolean
}
export interface ExtraGiftFilterExcludeLimitedNonUpgradable {
/**
* Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
*/
exclude_limited_non_upgradable?: boolean
}
export interface ExtraGiftFilterExcludeFromBlockchain {
/**
* Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
*/
exclude_from_blockchain?: boolean
}
export interface ExtraGiftFilterExcludeUnique {
/**
* Pass True to exclude unique gifts
*/
exclude_unique?: boolean
}
export interface ExtraGiftFilterExcludeUnsaved {
/**
* Pass True to exclude gifts that aren't saved to the account's profile page
*/
exclude_unsaved?: boolean
}
export interface ExtraGiftFilterExcludeSaved {
/**
* Pass True to exclude gifts that are saved to the account's profile page
*/
exclude_saved?: boolean
}
export interface ExtraGiftOffsetting {
/**
* Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
*/
sort_by_price?: boolean
/**
* Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
*/
offset?: string
/**
* The maximum number of gifts to be returned; 1-100. Defaults to 100
*/
limit?: number
}
export interface ExtraGetBusinessAccountGifts extends ExtraGiftFilterExcludeUnlimited, ExtraGiftFilterExcludeLimitedUpgradable, ExtraGiftFilterExcludeLimitedNonUpgradable, ExtraGiftFilterExcludeFromBlockchain, ExtraGiftFilterExcludeUnique, ExtraGiftOffsetting, ExtraGiftFilterExcludeUnsaved, ExtraGiftFilterExcludeSaved {
}
export interface ExtraGetUserGifts extends ExtraGiftFilterExcludeUnlimited, ExtraGiftFilterExcludeLimitedUpgradable, ExtraGiftFilterExcludeLimitedNonUpgradable, ExtraGiftFilterExcludeFromBlockchain, ExtraGiftFilterExcludeUnique, ExtraGiftOffsetting {
}
export interface ExtraGetChatGifts extends ExtraGiftFilterExcludeUnsaved, ExtraGiftFilterExcludeSaved, ExtraGiftFilterExcludeUnlimited, ExtraGiftFilterExcludeLimitedUpgradable, ExtraGiftFilterExcludeLimitedNonUpgradable, ExtraGiftFilterExcludeFromBlockchain, ExtraGiftFilterExcludeUnique, ExtraGiftOffsetting {
}
export interface ExtraUpgradeGift {
/**
* Pass True to keep the original gift text, sender and receiver in the upgraded gift
*/
keep_original_details?: boolean
/**
* The amount of Telegram Stars that will be paid for the upgrade from the business account balance. If `gift.prepaid_upgrade_star_count > 0`, then pass 0, otherwise, the can_transfer_stars business bot right is required and `gift.upgrade_star_count` must be passed.
*/
star_count?: number
}
export interface ExtraPostToChatPage {
/**
* Pass True to keep the story accessible after it expires
*/
post_to_chat_page: boolean
}
export interface ExtraPostStory extends ExtraCaption, ExtraCaptionFormatting, ExtraProtectContent, ExtraPostToChatPage {
/**
* A list of clickable areas to be shown on the story
*/
areas: StoryArea[]
}
export interface ExtraRepostStory extends ExtraPostToChatPage, ExtraProtectContent {
}
export interface ExtraEditStory extends ExtraCaption, ExtraCaptionFormatting {
/**
* A list of clickable areas to be shown on the story
*/
areas: StoryArea[]
}
export interface ExtraGiftPremiumSubscription extends ExtraTextFormatting {
/**
* Text that will be shown along with the service message about the subscription; 0-128 characters
*/
text?: string
}
export interface ExtraChecklist extends ExtraDisableNotifications, ExtraProtectContent, ExtraEffectId, ExtraReplyMessage, ExtraReplyMarkup {
}
export interface ExtraEditChecklist extends ExtraReplyMarkup {
}
export interface ExtraCopyMessage extends ExtraCaption, ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraCaptionAboveMedia, ExtraPaidBroadcast, ExtraVideoStartTimestamp, ExtraDirectMessagesTopicId, ExtraSuggestedPostParameters {
}
export interface ExtraCopyMessages extends ExtraCaption, ExtraDisableNotifications, ExtraReplyMessage, ExtraReplyMarkup, ExtraProtectContent, ExtraMessageThread, ExtraCaptionAboveMedia, ExtraPaidBroadcast, ExtraVideoStartTimestamp, ExtraDirectMessagesTopicId {
}
export type Extra = ExtraSendMessage
| ExtraEditMessage
| ExtraEditMessageMedia
| ExtraUnpinMessage
| ExtraAudio
| ExtraDocument
| ExtraGame
| ExtraInvoice
| ExtraLocation
| ExtraEditLocation
| ExtraStopLiveLocation
| ExtraVenue
| ExtraContact
| ExtraPhoto
| ExtraMediaGroup
| ExtraAnimation
| ExtraSticker
| ExtraVideo
| ExtraVideoNote
| ExtraVoice
| ExtraDice
| ExtraPoll
| ExtraQuiz
| ExtraStopPoll
| ExtraEditCaption
| ExtraAnswerCallbackQuery
| ExtraCopyMessage
export interface ExtraUnban {
/**
* Do nothing if the user is not banned
*/
only_if_banned?: Boolean
}
export interface ExtraBan {
/**
* Date when the user will be unbanned, unix time.
* If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever.
* Applied for supergroups and channels only.
*/
until_date?: number,
/**
* Pass True to delete all messages from the chat for the user that is being removed.
* If False, the user will be able to see messages in the group that were sent before the user was removed.
* Always True for supergroups and channels.
*/
revoke_messages: boolean
}
interface ExtraChatIviteLink {
/**
* Invite link name; 0-32 characters
*/
name?: string
/**
* Point in time (Unix timestamp) when the link will expire
*/
expire_date?: number,
/**
* 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
/**
* True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified
*/
creates_join_request?: boolean
}
export interface ExtraCreateNewStickerSet {
/**
* Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created.
*/
sticker_type?: StickerType;
/**
* True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only
*/
needs_repainting?: boolean;
}
export interface ExtraCreateChatIviteLink extends ExtraChatIviteLink {
}
export interface ExtraEditChatIviteLink extends ExtraChatIviteLink {
}
export type MessageAudio = TT.Message.AudioMessage
export type MessageContact = TT.Message.ContactMessage
export type MessageDocument = TT.Message.DocumentMessage
export type MessageGame = TT.Message.GameMessage
export type MessageInvoice = TT.Message.InvoiceMessage
export type MessageLocation = TT.Message.LocationMessage
export type MessageVenue = TT.Message.VenueMessage
export type MessagePhoto = TT.Message.PhotoMessage
export type MessageAnimation = TT.Message.AnimationMessage
export type MessageSticker = TT.Message.StickerMessage
export type MessageVideo = TT.Message.VideoMessage
export type MessageVideoNote = TT.Message.VideoNoteMessage
export type MessageVoice = TT.Message.VoiceMessage
export type MessageDice = TT.Message.DiceMessage
export type MessagePoll = TT.Message.PollMessage
type ServiceMessageBundle = TT.Message.ChannelChatCreatedMessage
& TT.Message.ConnectedWebsiteMessage
& TT.Message.DeleteChatPhotoMessage
& TT.Message.GroupChatCreatedMessage
& TT.Message.InvoiceMessage
& TT.Message.LeftChatMemberMessage
& TT.Message.MigrateFromChatIdMessage
& TT.Message.MigrateToChatIdMessage
& TT.Message.NewChatMembersMessage
& TT.Message.NewChatPhotoMessage
& TT.Message.NewChatTitleMessage
& TT.Message.PassportDataMessage
& TT.Message.ProximityAlertTriggeredMessage
& TT.Message.PinnedMessageMessage
& TT.Message.SuccessfulPaymentMessage
& TT.Message.SupergroupChatCreated
& TT.Message.MessageAutoDeleteTimerChangedMessage
& TT.Message.VideoChatStartedMessage
& TT.Message.VideoChatEndedMessage
& TT.Message.VideoChatScheduledMessage
& TT.Message.VideoChatParticipantsInvitedMessage
& TT.Message.WebAppDataMessage
& TT.Message.ForumTopicCreatedMessage
& TT.Message.ForumTopicEditedMessage
& TT.Message.ForumTopicClosedMessage
& TT.Message.ForumTopicReopenedMessage
& TT.Message.WriteAccessAllowedMessage
& TT.Message.ChatBackgroundSetMessage
& TT.Message.RefundedPaymentMessage
type CommonMessageBundle = TT.Message.AnimationMessage
& TT.Message.AudioMessage
& TT.Message.ContactMessage
& TT.Message.DiceMessage
& TT.Message.DocumentMessage
& TT.Message.GameMessage
& TT.Message.LocationMessage
& TT.Message.PhotoMessage
& TT.Message.PollMessage
& TT.Message.StickerMessage
& (TT.Message.TextMessage & { entities?: TT.MessageEntity[]} )
& TT.Message.VenueMessage
& TT.Message.VideoMessage
& TT.Message.VideoNoteMessage
& TT.Message.VoiceMessage
& TT.Message.StoryMessage
export type Message = ServiceMessageBundle & CommonMessageBundle
export type Update = TT.Update;
export type CallbackQuery = TT.CallbackQuery
export interface ExtraPayload {
/**
* Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
*/
payload: string
}
export interface NewInvoiceParameters extends ExtraPayload {
/**
* Product name, 1-32 characters
*/
title: string
/**
* Product description, 1-255 characters
*/
description: string
/**
* Payments provider token, obtained via Botfather. Pass an empty string for payments in Telegram Stars.
*/
provider_token?: string
/**
* Unique deep-linking parameter.
* If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice.
* If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter
*/
start_parameter?: string
/**
* Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars.
*/
currency: string
/**
* Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
*/
prices: TT.LabeledPrice[]
/**
* The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double).
* For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145.
* Defaults to 0
*/
max_tip_amount: number
/**
* A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double).
* At most 4 suggested tip amounts can be specified.
* The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
*/
suggested_tip_amounts: number[]
/**
* URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.
*/
photo_url?: string
/**
* Photo size
*/
photo_size?: number
/**
* Photo width
*/
photo_width?: number
/**
* Photo height
*/
photo_height?: number
/**
* Pass True, if you require the user's full name to complete the order
*/
need_name?: true
/**
* Pass True, if you require the user's phone number to complete the order
*/
need_phone_number?: true
/**
* Pass True, if you require the user's email to complete the order
*/
need_email?: true
/**
* Pass True, if you require the user's shipping address to complete the order
*/
need_shipping_address?: true
/**
* Pass True, if the final price depends on the shipping method
*/
is_flexible?: true
}
export interface ExtraAnswerInlineQuery {
/**
* The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
*/
cache_time?: number
/**
* Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query
*/
is_personal?: boolean
/**
* Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes.
*/
next_offset?: string
/**
* A JSON-serialized object describing a button to be shown above inline query results
*/
button: TT