telegram

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2020 License: MIT Imports: 6 Imported by: 0

README

Go Telegram Bot SDK

PkgGoDev Build Status codecov

A Telegram Bot SDK for Go.

Documentation

Index

Constants

View Source
const TelegramURL = "https://api.telegram.org"

TelegramURL is a Telegram Host URL.

Variables

This section is empty.

Functions

This section is empty.

Types

type Animation

type Animation struct {
	FileID       string     `json:"file_id"`
	FileUniqueID string     `json:"file_unique_id"`
	Width        int        `json:"width"`
	Height       int        `json:"height"`
	Duration     int        `json:"duration"`
	Thumb        *PhotoSize `json:"thumb,omitempty"`     // Optional.
	FileName     string     `json:"file_name,omitempty"` // Optional.
	MIMEType     string     `json:"mime_type,omitempty"` // Optional.
	FileSize     int        `json:"file_size,omitempty"` // Optional.
}

Animation represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).

https://core.telegram.org/bots/api#animation

type Audio

type Audio struct {
	FileID       string     `json:"file_id"`
	FileUniqueID string     `json:"file_unique_id"`
	Duration     int        `json:"duration"`
	Performer    string     `json:"performer,omitempty"` // Optional.
	Title        string     `json:"title,omitempty"`     // Optional.
	FileName     string     `json:"file_name,omitempty"` // Optional.
	MIMEType     string     `json:"mime_type,omitempty"` // Optional.
	FileSize     int        `json:"file_size,omitempty"` // Optional.
	Thumb        *PhotoSize `json:"thumb,omitempty"`     // Optional.
}

Audio represents an audio file to be treated as music by the Telegram clients.

https://core.telegram.org/bots/api#audio

type Bot

type Bot struct {
	User User // Bot info.
	// contains filtered or unexported fields
}

Bot is a Telegram bot.

https://core.telegram.org/bots

func NewBot

func NewBot(token string, options ...Option) (*Bot, error)

NewBot returns a new bot given a token and other optional options.

func (*Bot) DeleteWebhook

func (bot *Bot) DeleteWebhook(params ...Param) (bool, error)

DeleteWebhook removes webhook integration if you decide to switch back to GetUpdates. Returns True on success.

Params: SetDropPendingUpdates.

https://core.telegram.org/bots/api#deletewebhook

func (*Bot) GetMe

func (bot *Bot) GetMe() (User, error)

GetMe returns basic information about the bot. It's a simple method for testing your bot's auth token. GetMe also update bot User info.

https://core.telegram.org/bots/api#getme.

func (*Bot) GetUpdates

func (bot *Bot) GetUpdates(params ...Param) ([]Update, error)

GetUpdates returns a slice of Update. Use this method to receive incoming updates using long polling.

Params: SetOffset, SetLimit, SetTimeout, SetAllowedUpdates.

https://core.telegram.org/bots/api#getupdates

func (*Bot) GetWebhookInfo

func (bot *Bot) GetWebhookInfo() (WebhookInfo, error)

GetWebhookInfo returns 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.

https://core.telegram.org/bots/api#getwebhookinfo

func (*Bot) MakeRequest

func (bot *Bot) MakeRequest(methodName string, params url.Values) (*Response, error)

MakeRequest is a raw method to make a request to the Telegram API. Generally other bot method like GetMe or GetUpdates is used instead unless there's a new method in Telegram API that doesn't handle yet by the bot.

All request are passed to Telegram Bot API in the form:

https://api.telegram.org/bot<token>/METHOD_NAME

Like this for example:

https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/getMe

https://core.telegram.org/bots/api#making-requests

func (*Bot) SendMessage

func (bot *Bot) SendMessage(chatID int, text string, params ...Param) (Message, error)

SendMessage sends text messages. On success, the sent Message is returned.

TODO: Params: SetParseMode, SetEntities, SetDisableWebPagePreview, SetDisableNotification, SetReplyToMessageID, SetAllowSendingWithoutReply, SetReplyMarkup

https://core.telegram.org/bots/api#sendmessage

func (*Bot) SetWebhook

func (bot *Bot) SetWebhook(url string, params ...Param) (bool, error)

SetWebhook 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.

Params: SetCertificate (TODO), SetIPAddress, SetMaxConnections, SetAllowedUpdates, SetDropPendingUpdates.

https://core.telegram.org/bots/api#setwebhook

type BotCommand

type BotCommand struct {
	Command     string `json:"command"`
	Description string `json:"description"`
}

BotCommand represents a bot command.

https://core.telegram.org/bots/api#botcommand

type BotError

type BotError struct {
	Code        int
	Description string
}

BotError records an error code (http status code) and the description.

func (*BotError) Error

func (e *BotError) Error() string

type CallbackGame

type CallbackGame struct{}

CallbackGame is a placeholder, currently holds no information. Use BotFather to set up your game.

type CallbackQuery

type CallbackQuery struct {
	ID              string   `json:"id"`
	From            *User    `json:"from"`
	Message         *Message `json:"message,omitempty"`           // Optional.
	InlineMessageID string   `json:"inline_message_id,omitempty"` // Optional.
	ChatInstance    string   `json:"chat_instance"`
	Data            string   `json:"data,omitempty"`            // Optional.
	GameShortName   string   `json:"game_short_name,omitempty"` // Optional.
}

CallbackQuery represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.

https://core.telegram.org/bots/api#callbackquery

type Chat

type Chat struct {
	ID               int              `json:"id"`
	Type             string           `json:"type"`
	Title            string           `json:"title,omitempty"`               // Optional.
	Username         string           `json:"username,omitempty"`            // Optional.
	FirstName        string           `json:"first_name,omitempty"`          // Optional.
	LastName         string           `json:"last_name,omitempty"`           // Optional.
	Photo            *ChatPhoto       `json:"photo,omitempty"`               // Optional.
	Bio              string           `json:"bio,omitempty"`                 // Optional.
	Description      string           `json:"description,omitempty"`         // Optional.
	InviteLink       string           `json:"invite_link,omitempty"`         // Optional.
	PinnedMessage    *Message         `json:"pinned_message,omitempty"`      // Optional.
	Permissions      *ChatPermissions `json:"permissions,omitempty"`         // Optional.
	SlowModeDelay    int              `json:"slow_mode_delay,omitempty"`     // Optional.
	StickerSetName   string           `json:"sticker_set_name,omitempty"`    // Optional.
	CanSetStickerSet bool             `json:"can_set_sticker_set,omitempty"` // Optional.
	LinkedChatID     int              `json:"linked_chat_id,omitempty"`      // Optional.
	Location         *ChatLocation    `json:"location,omitempty"`            // Optional.
}

Chat represents a chat.

https://core.telegram.org/bots/api#chat

type ChatLocation

type ChatLocation struct {
	Location *Location `json:"location"`
	Address  string    `json:"address"`
}

ChatLocation represents a location to which a chat is connected.

https://core.telegram.org/bots/api#chatlocation

type ChatMember

type ChatMember struct {
	User                  *User  `json:"user"`
	Status                string `json:"status"`
	CustomTitle           string `json:"custom_title,omitempty"`              // Optional.
	IsAnonymous           bool   `json:"is_anonymous,omitempty"`              // Optional.
	CanBeEdited           bool   `json:"can_be_edited,omitempty"`             // Optional.
	CanPostMessages       bool   `json:"can_post_messages,omitempty"`         // Optional.
	CanEditMessages       bool   `json:"can_edit_messages,omitempty"`         // Optional.
	CanDeleteMessages     bool   `json:"can_delete_messages,omitempty"`       // Optional.
	CanRestrictMembers    bool   `json:"can_restrict_members,omitempty"`      // Optional.
	CanPromoteMembers     bool   `json:"can_promote_members,omitempty"`       // Optional.
	CahChangeInfo         bool   `json:"can_change_info,omitempty"`           // Optional.
	CanInviteUsers        bool   `json:"can_invite_users,omitempty"`          // Optional.
	CanPinMessages        bool   `json:"can_pin_messages,omitempty"`          // Optional.
	IsMember              bool   `json:"is_member,omitempty"`                 // Optional.
	CanSendMessages       bool   `json:"can_send_messages,omitempty"`         // Optional.
	CanSendMediaMessages  bool   `json:"can_send_media_messages,omitempty"`   // Optional.
	CanSendPolls          bool   `json:"can_send_polls,omitempty"`            // Optional.
	CanSendOtherMessages  bool   `json:"can_send_other_messages,omitempty"`   // Optional.
	CanAddWebPagePreviews bool   `json:"can_add_web_page_previews,omitempty"` // Optional.
	UntilDate             int    `json:"until_date,omitempty"`                // Optional.
}

ChatMember contains information about one member of a chat.

https://core.telegram.org/bots/api#chatmember

type ChatPermissions

type ChatPermissions struct {
	CanSendMessages       bool `json:"can_send_messages,omitempty"`         // Optional.
	CanSendMediaMessages  bool `json:"can_send_media_messages,omitempty"`   // Optional.
	CanSendPolls          bool `json:"can_send_polls,omitempty"`            // Optional.
	CanSendOtherMessages  bool `json:"can_send_other_messages,omitempty"`   // Optional.
	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"` // Optional.
	CanChangeInfo         bool `json:"can_change_info,omitempty"`           // Optional.
	CanInviteUsers        bool `json:"can_invite_users,omitempty"`          // Optional.
	CanPinMessages        bool `json:"can_pin_messages,omitempty"`          // Optional.
}

ChatPermissions describes actions that a non-administrator user is allowed to take in a chat.

https://core.telegram.org/bots/api#chatpermissions

type ChatPhoto

type ChatPhoto struct {
	SmallFileID       string `json:"small_file_id"`
	SmallFileUniqueID string `json:"small_file_unique_id"`
	BigFileID         string `json:"big_file_id"`
	BigFileUniqueID   string `json:"big_file_unique_id"`
}

ChatPhoto represents a chat photo.

https://core.telegram.org/bots/api#chatphoto

type ChosenInlineResult

type ChosenInlineResult struct {
	ResultID        string    `json:"result_id"`
	From            *User     `json:"from"`
	Location        *Location `json:"location,omitempty"`          // Optional.
	InlineMessageID string    `json:"inline_message_id,omitempty"` // Optional.
	Query           string    `json:"query"`
}

ChosenInlineResult represents a result of an inline query that was chosen by the user and sent to their chat partner.

https://core.telegram.org/bots/api#choseninlineresult

type Contact

type Contact struct {
	PhoneNumber string `json:"phone_number"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name,omitempty"` // Optional.
	UserID      int    `json:"user_id,omitempty"`   // Optional.
	VCard       string `json:"vcard,omitempty"`     // Optional.
}

Contact represents a phone contact.

https://core.telegram.org/bots/api#contact

type Dice

type Dice struct {
	Emoji string `json:"emoji"`
	Value int    `json:"value"`
}

Dice represents an animated emoji that displays a random value.

https://core.telegram.org/bots/api#dice

type Document

type Document struct {
	FileID       string     `json:"file_id"`
	FileUniqueID string     `json:"file_unique_id"`
	Thumb        *PhotoSize `json:"thumb,omitempty"`     // Optional.
	FileName     string     `json:"file_name,omitempty"` // Optional.
	MIMEType     string     `json:"mime_type,omitempty"` // Optional.
	FileSize     int        `json:"file_size,omitempty"` // Optional.
}

Document represents a general file (as opposed to photos, voice messages and audio files).

https://core.telegram.org/bots/api#document

type EncryptedCredentials

type EncryptedCredentials struct {
	Data   string `json:"data"`
	Hash   string `json:"hash"`
	Secret string `json:"secret"`
}

EncryptedCredentials contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.

https://core.telegram.org/bots/api#encryptedcredentials

type EncryptedPassportElement

type EncryptedPassportElement struct {
	Type        string          `json:"type"`
	Data        string          `json:"data,omitempty"`         // Optional.
	PhoneNumber string          `json:"phone_number,omitempty"` // Optional.
	Email       string          `json:"email,omitempty"`        // Optional.
	Files       []*PassportFile `json:"files,omitempty"`        // Optional.
	FrontSide   *PassportFile   `json:"front_side,omitempty"`   // Optional.
	ReverseSide *PassportFile   `json:"reverse_side,omitempty"` // Optional.
	Selfie      *PassportFile   `json:"selfie,omitempty"`       // Optional.
	Translation []*PassportFile `json:"translation,omitempty"`  // Optional.
	Hash        string          `json:"hash"`
}

EncryptedPassportElement contains information about documents or other Telegram Passport elements shared with the bot by the user.

https://core.telegram.org/bots/api#encryptedpassportelement

type File

type File struct {
	FileID       string `json:"file_id"`
	FileUniqueID string `json:"file_unique_id"`
	FileSize     string `json:"file_size,omitempty"` // Optional.
	FilePath     string `json:"file_path,omitempty"` // Optional.
}

File 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

https://core.telegram.org/bots/api#file

type ForceReply

type ForceReply struct {
	ForceReply bool `json:"force_reply"`
	Selective  bool `json:"selective,omitempty"` // Optional.
}

ForceReply, 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

type Game

type Game struct {
	Title        string           `json:"title"`
	Description  string           `json:"description"`
	Photo        []*PhotoSize     `json:"photo"`
	Text         string           `json:"text,omitempty"`          // Optional.
	TextEntities []*MessageEntity `json:"text_entities,omitempty"` // Optional.
	Animation    *Animation       `json:"animation,omitempty"`     // Optional.
}

Game represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.

https://core.telegram.org/bots/api#game

type GameHighScore

type GameHighScore struct {
	Position int   `json:"position"`
	User     *User `json:"user"`
	Score    int   `json:"score"`
}

GameHighScore represents one row of the high scores table for a game.

https://core.telegram.org/bots/api#gamehighscore

type InlineKeyboardButton

type InlineKeyboardButton struct {
	Text                         string        `json:"text"`
	URL                          string        `json:"url,omitempty"`                              // Optional.
	LoginURL                     *LoginURL     `json:"login_url,omitempty"`                        // Optional.
	CallbackData                 string        `json:"callback_data,omitempty"`                    // Optional.
	SwitchInlineQuery            string        `json:"switch_inline_query,omitempty"`              // Optional.
	SwitchInlineQueryCurrentChat string        `json:"switch_inline_query_current_chat,omitempty"` // Optional.
	CallbackGame                 *CallbackGame `json:"callback_game,omitempty"`                    // Optional.
	Pay                          bool          `json:"pay,omitempty"`                              // Optional.
}

InlineKeyboardButton represents one button of an inline keyboard. You must use exactly one of the optional fields.

https://core.telegram.org/bots/api#inlinekeyboardbutton

type InlineKeyboardMarkup

type InlineKeyboardMarkup struct {
	InlineKeyboard [][]*InlineKeyboardButton `json:"inline_keyboard"`
}

InlineKeyboardMarkup represents an inline keyboard that appears right next to the message it belongs to.

https://core.telegram.org/bots/api#inlinekeyboardmarkup

type InlineQuery

type InlineQuery struct {
	ID       string    `json:"id"`
	From     *User     `json:"from"`
	Location *Location `json:"location,omitempty"` // Optional.
	Query    string    `json:"query"`
	Offset   string    `json:"offset"`
}

InlineQuery represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.

https://core.telegram.org/bots/api#inlinequery

type InlineQueryResultArticle

type InlineQueryResultArticle struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	Title               string                `json:"title"`
	InputMessageContent interface{}           `json:"input_message_content"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Optional.
	URL                 string                `json:"url,omitempty"`          // Optional.
	HideURL             bool                  `json:"hide_url,omitempty"`     // Optional.
	Description         string                `json:"description,omitempty"`  // Optional.
	ThumbURL            string                `json:"thumb_url,omitempty"`    // Optional.
	ThumbWidth          int                   `json:"thumb_width,omitempty"`  // Optional.
	ThumbHeight         int                   `json:"thumb_height,omitempty"` // Optional.
}

InlineQueryResultArticle represents a link to an article or web page.

https://core.telegram.org/bots/api#inlinequeryresult

type InlineQueryResultAudio

type InlineQueryResultAudio struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	AudioURL            string                `json:"audio_url"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	Performer           string                `json:"performer,omitempty"`             // Optional.
	AudioDuration       int                   `json:"audio_duration,omitempty"`        // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultAudio represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.

https://core.telegram.org/bots/api#inlinequeryresultaudio

type InlineQueryResultCachedAudio

type InlineQueryResultCachedAudio struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	AudioFileID         string                `json:"audio_file_id"`
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultCachedAudio represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.

https://core.telegram.org/bots/api#inlinequeryresultcachedaudio

type InlineQueryResultCachedDocument

type InlineQueryResultCachedDocument struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	Title               string                `json:"title"`
	DocumentFileID      string                `json:"document_file_id"`
	Description         string                `json:"description,omitempty"`           // Optional.
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultCachedDocument represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.

https://core.telegram.org/bots/api#inlinequeryresultcacheddocument

type InlineQueryResultCachedGIF

type InlineQueryResultCachedGIF struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	GIFFileID           string                `json:"gif_file_id"`
	Title               string                `json:"title,omitempty"`                 // Optional.
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultCachedGIF represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.

https://core.telegram.org/bots/api#inlinequeryresultcachedgif

type InlineQueryResultCachedMPEG4GIF

type InlineQueryResultCachedMPEG4GIF struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	MPEG4FileID         string                `json:"mpeg4_file_id"`
	Title               string                `json:"title,omitempty"`                 // Optional.
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultCachedMPEG4GIF represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.

https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif

type InlineQueryResultCachedPhoto

type InlineQueryResultCachedPhoto struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	PhotoFileID         string                `json:"photo_file_id"`
	Title               string                `json:"title,omitempty"`                 // Optional.
	Description         string                `json:"description,omitempty"`           // Optional.
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultCachedPhoto represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.

https://core.telegram.org/bots/api#inlinequeryresultcachedphoto

type InlineQueryResultCachedSticker

type InlineQueryResultCachedSticker struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	StickerFileID       string                `json:"sticker_file_id"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultCachedSticker represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.

https://core.telegram.org/bots/api#inlinequeryresultcachedsticker

type InlineQueryResultCachedVideo

type InlineQueryResultCachedVideo struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	VideoFileID         string                `json:"video_file_id"`
	Title               string                `json:"title"`
	Description         string                `json:"description,omitempty"`           // Optional.
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultCachedVideo represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.

https://core.telegram.org/bots/api#inlinequeryresultcachedvideo

type InlineQueryResultCachedVoice

type InlineQueryResultCachedVoice struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	VoiceFileID         string                `json:"voice_file_id"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultCachedVoice represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.

https://core.telegram.org/bots/api#inlinequeryresultcachedvoice

type InlineQueryResultContact

type InlineQueryResultContact struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	PhoneNumber         string                `json:"phone_number"`
	FirstName           string                `json:"first_name"`
	LastName            string                `json:"last_name,omitempty"`             // Optional.
	VCard               string                `json:"vcard,omitempty"`                 // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
	ThumbURL            string                `json:"thumb_url,omitempty"`             // Optional.
	ThumbWidth          int                   `json:"thumb_width,omitempty"`           // Optional.
	ThumbHeight         int                   `json:"thumb_height,omitempty"`          // Optional.
}

InlineQueryResultContact represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.

https://core.telegram.org/bots/api#inlinequeryresultcontact

type InlineQueryResultDocument

type InlineQueryResultDocument struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption,omitempty"`          // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`       // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"` // Optional.
	DocumentURL         string                `json:"document_url"`
	MIMEType            string                `json:"mime_type"`
	Description         string                `json:"description,omitempty"`           // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
	ThumbURL            string                `json:"thumb_url,omitempty"`             // Optional.
	ThumbWidth          int                   `json:"thumb_width,omitempty"`           // Optional.
	ThumbHeight         int                   `json:"thumb_height,omitempty"`          // Optional.
}

InlineQueryResultDocument represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.

https://core.telegram.org/bots/api#inlinequeryresultdocument

type InlineQueryResultGIF

type InlineQueryResultGIF struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	GIFURL              string                `json:"gif_url"`
	GIFWidth            int                   `json:"gif_width,omitempty"`    // Optional.
	GIFHeight           int                   `json:"gif_height,omitempty"`   // Optional.
	GIFDuration         int                   `json:"gif_duration,omitempty"` // Optional.
	ThumbURL            string                `json:"thumb_url"`
	ThumbMIMEType       string                `json:"thumb_mime_type,omitempty"`       // Optional.
	Title               string                `json:"title,omitempty"`                 // Optional.
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultGIF represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.

https://core.telegram.org/bots/api#inlinequeryresultgif

type InlineQueryResultGame

type InlineQueryResultGame struct {
	Type          string                `json:"type"`
	ID            string                `json:"id"`
	GameShortName string                `json:"game_short_name"`
	ReplyMarkup   *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Optional.
}

InlineQueryResultGame represents a Game.

https://core.telegram.org/bots/api#inlinequeryresultgame

type InlineQueryResultLocation

type InlineQueryResultLocation struct {
	Type                 string                `json:"type"`
	ID                   string                `json:"id"`
	Latitude             float64               `json:"latitude"`
	Longitude            float64               `json:"longitude"`
	Title                string                `json:"title"`
	HorizontalAccuracy   float64               `json:"horizontal_accuracy,omitempty"`    // Optional.
	LivePeriod           int                   `json:"live_period,omitempty"`            // Optional.
	Heading              int                   `json:"heading,omitempty"`                // Optional.
	ProximityAlertRadius int                   `json:"proximity_alert_radius,omitempty"` // Optional.
	ReplyMarkup          *InlineKeyboardMarkup `json:"reply_markup,omitempty"`           // Optional.
	InputMessageContent  interface{}           `json:"input_message_content,omitempty"`  // Optional.
	ThumbURL             string                `json:"thumb_url,omitempty"`              // Optional.
	ThumbWidth           int                   `json:"thumb_width,omitempty"`            // Optional.
	ThumbHeight          int                   `json:"thumb_height,omitempty"`           // Optional.
}

InlineQueryResultLocation represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.

https://core.telegram.org/bots/api#inlinequeryresultlocation

type InlineQueryResultMPEG4GIF

type InlineQueryResultMPEG4GIF struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	MPEG4URL            string                `json:"mpeg4_url"`
	MPEG4Width          int                   `json:"mpeg4_width,omitempty"`    // Optional.
	MPEG4Height         int                   `json:"mpeg4_height,omitempty"`   // Optional.
	MPEG4Duration       int                   `json:"mpeg4_duration,omitempty"` // Optional.
	ThumbURL            string                `json:"thumb_url"`
	ThumbMIMEType       string                `json:"thumb_mime_type,omitempty"`       // Optional.
	Title               string                `json:"title,omitempty"`                 // Optional.
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultMPEG4GIF represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.

https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif

type InlineQueryResultPhoto

type InlineQueryResultPhoto struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	PhotoURL            string                `json:"photo_url"`
	ThumbURL            string                `json:"thumb_url"`
	PhotoWidth          int                   `json:"photo_width,omitempty"`           // Optional.
	PhotoHeight         int                   `json:"photo_height,omitempty"`          // Optional.
	Title               string                `json:"title,omitempty"`                 // Optional.
	Description         string                `json:"description,omitempty"`           // Optional.
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultPhoto represents a link to a photo. By default,this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.

https://core.telegram.org/bots/api#inlinequeryresultphoto

type InlineQueryResultVenue

type InlineQueryResultVenue struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	Latitude            float64               `json:"latitude"`
	Longitude           float64               `json:"longitude"`
	Title               string                `json:"title"`
	Address             string                `json:"address"`
	FoursquareID        string                `json:"foursquare_id,omitempty"`         // Optional.
	FoursquareType      string                `json:"foursquare_type,omitempty"`       // Optional.
	GooglePlaceID       string                `json:"google_place_id,omitempty"`       // Optional.
	GooglePlaceType     string                `json:"google_place_type,omitempty"`     // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
	ThumbURL            string                `json:"thumb_url,omitempty"`             // Optional.
	ThumbWidth          int                   `json:"thumb_width,omitempty"`           // Optional.
	ThumbHeight         int                   `json:"thumb_height,omitempty"`          // Optional.
}

InlineQueryResultVenue represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.

https://core.telegram.org/bots/api#inlinequeryresultvenue

type InlineQueryResultVideo

type InlineQueryResultVideo struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	VideoURL            string                `json:"video_url"`
	MIMEType            string                `json:"mime_type"`
	ThumbURL            string                `json:"thumb_url"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	VideoWidth          int                   `json:"video_width,omitempty"`           // Optional.
	VideoHeight         int                   `json:"video_height,omitempty"`          // Optional.
	VideoDuration       int                   `json:"video_duration,omitempty"`        // Optional.
	Description         string                `json:"description,omitempty"`           // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultVideo represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.

https://core.telegram.org/bots/api#inlinequeryresultvideo

type InlineQueryResultVoice

type InlineQueryResultVoice struct {
	Type                string                `json:"type"`
	ID                  string                `json:"id"`
	VoiceURL            string                `json:"voice_url"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption,omitempty"`               // Optional.
	ParseMode           string                `json:"parse_mode,omitempty"`            // Optional.
	CaptionEntities     []*MessageEntity      `json:"caption_entities,omitempty"`      // Optional.
	VoiceDuration       int                   `json:"voice_duration,omitempty"`        // Optional.
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`          // Optional.
	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // Optional.
}

InlineQueryResultVoice represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.

https://core.telegram.org/bots/api#inlinequeryresultvoice

type InputContactMessageContent

type InputContactMessageContent struct {
	PhoneNumber float64 `json:"phone_number"`
	FirstName   float64 `json:"first_name"`
	LastName    string  `json:"last_name,omitempty"` // Optional.
	VCard       string  `json:"vcard,omitempty"`     // Optional.
}

InputContactMessageContent represents the content of a contact message to be sent as the result of an inline query.

https://core.telegram.org/bots/api#inputcontactmessagecontent

type InputLocationMessageContent

type InputLocationMessageContent struct {
	Latitude             float64 `json:"latitude"`
	Longitude            float64 `json:"longitude"`
	HorizontalAccuracy   float64 `json:"horizontal_accuracy,omitempty"`    // Optional.
	LivePeriod           int     `json:"live_period,omitempty"`            // Optional.
	Heading              int     `json:"heading,omitempty"`                // Optional.
	ProximityAlertRadius int     `json:"proximity_alert_radius,omitempty"` // Optional.
}

InputLocationMessageContent represents the content of a location message to be sent as the result of an inline query.

https://core.telegram.org/bots/api#inputlocationmessagecontent

type InputMediaAnimation

type InputMediaAnimation struct {
	Type  string `json:"type"`
	Media string `json:"media"`
	// Thumb *InputFile or string `json:"thumb,omitempty"` // TODO: handle the inconsistent type
	Caption         string           `json:"caption,omitempty"`          // Optional.
	ParseMode       string           `json:"parse_mode,omitempty"`       // Optional.
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Optional.
	Width           int              `json:"width,omitempty"`            // Optional.
	Height          int              `json:"height,omitempty"`           // Optional.
	Duration        int              `json:"duration,omitempty"`         // Optional.
}

InputMediaAnimation represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.

https://core.telegram.org/bots/api#inputmediaanimation

type InputMediaAudio

type InputMediaAudio struct {
	Type  string `json:"type"`
	Media string `json:"media"`
	// Thumb *InputFile or string `json:"thumb,omitempty"` // TODO: handle the inconsistent type
	Caption         string           `json:"caption,omitempty"`          // Optional.
	ParseMode       string           `json:"parse_mode,omitempty"`       // Optional.
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Optional.
	Duration        int              `json:"duration,omitempty"`         // Optional.
	Performer       string           `json:"performer,omitempty"`        // Optional.
	Title           string           `json:"title,omitempty"`            // Optional.
}

InputMediaAudio represents an audio file to be treated as music to be sent.

https://core.telegram.org/bots/api#inputmediaaudio

type InputMediaDocument

type InputMediaDocument struct {
	Type  string `json:"type"`
	Media string `json:"media"`
	// Thumb *InputFile or string `json:"thumb,omitempty"` // TODO: handle the inconsistent type
	Caption                     string           `json:"caption,omitempty"`                        // Optional.
	ParseMode                   string           `json:"parse_mode,omitempty"`                     // Optional.
	CaptionEntities             []*MessageEntity `json:"caption_entities,omitempty"`               // Optional.
	DisableContentTypeDetection bool             `json:"disable_content_type_detection,omitempty"` // Optional.
}

InputMediaDocument represents a general file to be sent.

https://core.telegram.org/bots/api#inputmediadocument

type InputMediaPhoto

type InputMediaPhoto struct {
	Type            string           `json:"type"`
	Media           string           `json:"media"`
	Caption         string           `json:"caption,omitempty"`          // Optional.
	ParseMode       string           `json:"parse_mode,omitempty"`       // Optional.
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Optional.
}

InputMediaPhoto represents a photo to be sent.

https://core.telegram.org/bots/api#inputmediaphoto

type InputMediaVideo

type InputMediaVideo struct {
	Type  string `json:"type"`
	Media string `json:"media"`
	// Thumb *InputFile or string `json:"thumb,omitempty"` // TODO: handle the inconsistent type
	Caption           string           `json:"caption,omitempty"`            // Optional.
	ParseMode         string           `json:"parse_mode,omitempty"`         // Optional.
	CaptionEntities   []*MessageEntity `json:"caption_entities,omitempty"`   // Optional.
	Width             int              `json:"width,omitempty"`              // Optional.
	Height            int              `json:"height,omitempty"`             // Optional.
	Duration          int              `json:"duration,omitempty"`           // Optional.
	SupportsStreaming bool             `json:"supports_streaming,omitempty"` // Optional.
}

InputMediaVideo represents a video to be sent.

https://core.telegram.org/bots/api#inputmediavideo

type InputTextMessageContent

type InputTextMessageContent struct {
	MessageText           string           `json:"message_text"`
	ParseMode             string           `json:"parse_mode,omitempty"`               // Optional.
	Entities              []*MessageEntity `json:"entities,omitempty"`                 // Optional.
	DisableWebPagePreview bool             `json:"disable_web_page_preview,omitempty"` // Optional.
}

InputTextMessageContent represents the content of a text message to be sent as the result of an inline query.

https://core.telegram.org/bots/api#inputtextmessagecontent

type InputVenueMessageContent

type InputVenueMessageContent struct {
	Latitude        float64 `json:"latitude"`
	Longitude       float64 `json:"longitude"`
	Title           string  `json:"title"`
	Address         string  `json:"address"`
	FoursquareID    string  `json:"foursquare_id,omitempty"`     // Optional.
	FoursquareType  string  `json:"foursquare_type,omitempty"`   // Optional.
	GooglePlaceID   string  `json:"google_place_id,omitempty"`   // Optional.
	GooglePlaceType string  `json:"google_place_type,omitempty"` // Optional.
}

InputVenueMessageContent represents the content of a venue message to be sent as the result of an inline query.

https://core.telegram.org/bots/api#inputvenuemessagecontent

type Invoice

type Invoice struct {
	Title          string `json:"title"`
	Description    string `json:"description"`
	StartParameter string `json:"start_parameter"`
	Currency       string `json:"currency"`
	TotalAmount    int    `json:"total_amount"`
}

Invoice contains basic information about an invoice.

https://core.telegram.org/bots/api#invoice

type KeyboardButton

type KeyboardButton struct {
	Text            string                  `json:"text"`
	RequestContact  bool                    `json:"request_contact,omitempty"`  // Optional.
	RequestLocation bool                    `json:"request_location,omitempty"` // Optional.
	RequestPoll     *KeyboardButtonPollType `json:"request_poll,omitempty"`     // Optional.
}

KeyboardButton 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 request_contact, request_location, and request_poll are mutually exclusive.

https://core.telegram.org/bots/api#keyboardbutton

type KeyboardButtonPollType

type KeyboardButtonPollType struct {
	Type string `json:"type,omitempty"` // Optional.
}

KeyboardButtonPollType represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.

https://core.telegram.org/bots/api#keyboardbuttonpolltype

type LabeledPrice

type LabeledPrice struct {
	Label  string `json:"label"`
	Amount int    `json:"amount"`
}

LabeledPrice represents a portion of the price for goods or services.

https://core.telegram.org/bots/api#labeledprice

type Location

type Location struct {
	Longitude            float64 `json:"longitude"`
	Latitude             float64 `json:"latitude"`
	HorizontalAccuracy   float64 `json:"horizontal_accuracy,omitempty"`    // Optional.
	LivePeriod           int     `json:"live_period,omitempty"`            // Optional.
	Heading              int     `json:"heading,omitempty"`                // Optional.
	ProximityAlertRadius int     `json:"proximity_alert_radius,omitempty"` // Optional.
}

Location represents a point on the map.

https://core.telegram.org/bots/api#location

type LoginURL

type LoginURL struct {
	URL                string `json:"url"`
	ForwardText        string `json:"forward_text,omitempty"`         // Optional.
	BotUsername        string `json:"bot_username,omitempty"`         // Optional.
	RequestWriteAccess bool   `json:"request_write_access,omitempty"` // Optional.
}

LoginURL 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

type MaskPosition

type MaskPosition struct {
	Point  string  `json:"point"`
	XShift float64 `json:"x_shift"`
	YShift float64 `json:"y_shift"`
	Scale  float64 `json:"scale"`
}

MaskPosition describes the position on faces where a mask should be placed by default.

https://core.telegram.org/bots/api#maskposition

type Message

type Message struct {
	MessageID               int                      `json:"message_id"`
	From                    *User                    `json:"from,omitempty"`        // Optional.
	SenderChat              *Chat                    `json:"sender_chat,omitempty"` // Optional.
	Date                    int                      `json:"date"`
	Chat                    *Chat                    `json:"chat"`
	ForwardFrom             *User                    `json:"forward_from,omitempty"`              // Optional.
	ForwardFromChat         *Chat                    `json:"forward_from_chat,omitempty"`         // Optional.
	ForwardFromMessageID    int                      `json:"forward_from_message_id,omitempty"`   // Optional.
	ForwardSignature        string                   `json:"forward_signature,omitempty"`         // Optional.
	ForwardSenderName       string                   `json:"forward_sender_name,omitempty"`       // Optional.
	ForwardDate             int                      `json:"forward_date,omitempty"`              // Optional.
	ReplyToMessage          *Message                 `json:"reply_to_message,omitempty"`          // Optional.
	ViaBot                  *User                    `json:"via_bot,omitempty"`                   // Optional.
	EditDate                int                      `json:"edit_date,omitempty"`                 // Optional.
	MediaGroupID            string                   `json:"media_group_id,omitempty"`            // Optional.
	AuthorSignature         string                   `json:"author_signature,omitempty"`          // Optional.
	Text                    string                   `json:"text,omitempty"`                      // Optional.
	Entities                []*MessageEntity         `json:"entities,omitempty"`                  // Optional.
	Animation               *Animation               `json:"animation,omitempty"`                 // Optional.
	Audio                   *Audio                   `json:"audio,omitempty"`                     // Optional.
	Document                *Document                `json:"document,omitempty"`                  // Optional.
	Photo                   []*PhotoSize             `json:"photo,omitempty"`                     // Optional.
	Sticker                 *Sticker                 `json:"sticker,omitempty"`                   // Optional.
	Video                   *Video                   `json:"video,omitempty"`                     // Optional.
	VideoNote               *VideoNote               `json:"video_note,omitempty"`                // Optional.
	Voice                   *Voice                   `json:"voice,omitempty"`                     // Optional.
	Caption                 string                   `json:"caption,omitempty"`                   // Optional.
	CaptionEntities         []*MessageEntity         `json:"caption_entities,omitempty"`          // Optional.
	Contact                 *Contact                 `json:"contact,omitempty"`                   // Optional.
	Dice                    *Dice                    `json:"dice,omitempty"`                      // Optional.
	Game                    *Game                    `json:"game,omitempty"`                      // Optional.
	Poll                    *Poll                    `json:"poll,omitempty"`                      // Optional.
	Venue                   *Venue                   `json:"venue,omitempty"`                     // Optional.
	Location                *Location                `json:"location,omitempty"`                  // Optional.
	NewChatMembers          []*User                  `json:"new_chat_members,omitempty"`          // Optional.
	LeftChatMember          *User                    `json:"left_chat_member,omitempty"`          // Optional.
	NewChatTitle            string                   `json:"new_chat_title,omitempty"`            // Optional.
	NewChatPhoto            []*PhotoSize             `json:"new_chat_photo,omitempty"`            // Optional.
	DeleteChatPhoto         bool                     `json:"delete_chat_photo,omitempty"`         // Optional.
	GroupChatCreated        bool                     `json:"group_chat_created,omitempty"`        // Optional.
	SupergroupChatCreated   bool                     `json:"supergroup_chat_created,omitempty"`   // Optional.
	ChannelChatCreated      bool                     `json:"channel_chat_created,omitempty"`      // Optional.
	MigrateToChatID         int                      `json:"migrate_to_chat_id,omitempty"`        // Optional.
	MigrateFromChatID       int                      `json:"migrate_from_chat_id,omitempty"`      // Optional.
	PinnedMessage           *Message                 `json:"pinned_message,omitempty"`            // Optional.
	Invoice                 *Invoice                 `json:"invoice,omitempty"`                   // Optional.
	SuccessfulPayment       *SuccessfulPayment       `json:"successful_payment,omitempty"`        // Optional.
	ConnectedWebsite        string                   `json:"connected_website,omitempty"`         // Optional.
	PassportData            *PassportData            `json:"passport_data,omitempty"`             // Optional.
	ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"` // Optional.
	ReplyMarkup             *InlineKeyboardMarkup    `json:"reply_markup,omitempty"`              // Optional.
}

Message represents a message.

https://core.telegram.org/bots/api#message

type MessageEntity

type MessageEntity struct {
	Type     string `json:"type"`
	Offset   int    `json:"offset"`
	Length   int    `json:"length"`
	URL      string `json:"url,omitempty"`      // Optional.
	User     *User  `json:"user,omitempty"`     // Optional.
	Language string `json:"language,omitempty"` // Optional.
}

MessageEntity represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.

https://core.telegram.org/bots/api#messageentity

type MessageID

type MessageID struct {
	MessageID int `json:"message_id"`
}

MessageID represents a unique message identifier.

https://core.telegram.org/bots/api#messageid

type Option

type Option func(*Bot)

The Option is used for tweaking the bot settings.

func SetClient

func SetClient(c *http.Client) Option

SetClient returns an option to set bot client.

func SetHostURL

func SetHostURL(hostURL string) Option

SetHostURL returns an option to set bot host URL.

type OrderInfo

type OrderInfo struct {
	Name            string           `json:"name"`
	PhoneNumber     string           `json:"phone_number"`
	Email           string           `json:"email"`
	ShippingAddress *ShippingAddress `json:"shipping_address"`
}

OrderInfo represents information about an order.

https://core.telegram.org/bots/api#orderinfo

type Param

type Param func(params url.Values)

Param set the parameter when calling bot's methods.

func SetAllowedUpdates

func SetAllowedUpdates(allowedUpdates ...string) Param

SetAllowedUpdates set allowed_updates param.

func SetDropPendingUpdates

func SetDropPendingUpdates(b bool) Param

SetDropPendingUpdates sets drop_pending_updates param.

func SetIPAddress

func SetIPAddress(address string) Param

SetIPAddress sets ip_address param.

func SetLimit

func SetLimit(limit int) Param

SetLimit sets limit param.

func SetMaxConnections

func SetMaxConnections(count int) Param

SetMaxConnections sets max_connections param.

func SetOffset

func SetOffset(offset int) Param

SetOffset sets offset param.

func SetTimeout

func SetTimeout(timeout int) Param

SetTimeout set timeout param.

type PassportData

type PassportData struct {
	Data        []*EncryptedPassportElement `json:"data"`
	Credentials *EncryptedCredentials       `json:"credentials"`
}

PassportData contains information about Telegram Passport data shared with the bot by the user.

https://core.telegram.org/bots/api#passportdata

type PassportElementErrorDataField

type PassportElementErrorDataField struct {
	Source    string `json:"source"`
	Type      string `json:"type"`
	FieldName string `json:"field_name"`
	DataHash  string `json:"data_hash"`
	Message   string `json:"message"`
}

PassportElementErrorDataField represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes.

https://core.telegram.org/bots/api#passportelementerrordatafield

type PassportElementErrorFile

type PassportElementErrorFile struct {
	Source   string `json:"source"`
	Type     string `json:"type"`
	FileHash string `json:"file_hash"`
	Message  string `json:"message"`
}

PassportElementErrorFile represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.

https://core.telegram.org/bots/api#passportelementerrorfile

type PassportElementErrorFiles

type PassportElementErrorFiles struct {
	Source     string   `json:"source"`
	Type       string   `json:"type"`
	FileHashes []string `json:"file_hashes"`
	Message    string   `json:"message"`
}

PassportElementErrorFiles represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.

https://core.telegram.org/bots/api#passportelementerrorfiles

type PassportElementErrorFrontSide

type PassportElementErrorFrontSide struct {
	Source   string `json:"source"`
	Type     string `json:"type"`
	FileHash string `json:"file_hash"`
	Message  string `json:"message"`
}

PassportElementErrorFrontSide represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes.

https://core.telegram.org/bots/api#passportelementerrorfrontside

type PassportElementErrorReverseSide

type PassportElementErrorReverseSide struct {
	Source   string `json:"source"`
	Type     string `json:"type"`
	FileHash string `json:"file_hash"`
	Message  string `json:"message"`
}

PassportElementErrorReverseSide represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes.

https://core.telegram.org/bots/api#passportelementerrorreverseside

type PassportElementErrorSelfie

type PassportElementErrorSelfie struct {
	Source   string `json:"source"`
	Type     string `json:"type"`
	FileHash string `json:"file_hash"`
	Message  string `json:"message"`
}

PassportElementErrorSelfie represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.

https://core.telegram.org/bots/api#passportelementerrorselfie

type PassportElementErrorTranslationFile

type PassportElementErrorTranslationFile struct {
	Source   string `json:"source"`
	Type     string `json:"type"`
	FileHash string `json:"file_hash"`
	Message  string `json:"message"`
}

PassportElementErrorTranslationFile represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.

https://core.telegram.org/bots/api#passportelementerrortranslationfile

type PassportElementErrorTranslationFiles

type PassportElementErrorTranslationFiles struct {
	Source     string   `json:"source"`
	Type       string   `json:"type"`
	FileHashes []string `json:"file_hashes"`
	Message    string   `json:"message"`
}

PassportElementErrorTranslationFiles represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.

https://core.telegram.org/bots/api#passportelementerrortranslationfiles

type PassportElementErrorUnspecified

type PassportElementErrorUnspecified struct {
	Source      string `json:"source"`
	Type        string `json:"type"`
	ElementHash string `json:"element_hash"`
	Message     string `json:"message"`
}

PassportElementErrorUnspecified represents an issue in an unspecified place. The error is considered resolved when new data is added.

https://core.telegram.org/bots/api#passportelementerrorunspecified

type PassportFile

type PassportFile struct {
	FileID       string `json:"file_id"`
	FileUniqueID string `json:"file_unique_id"`
	FileSize     int    `json:"file_size"`
	FileDate     int    `json:"file_date"`
}

PassportFile represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.

https://core.telegram.org/bots/api#passportfile

type PhotoSize

type PhotoSize struct {
	FileID       string `json:"file_id"`
	FileUniqueID string `json:"file_unique_id"`
	Width        int    `json:"width"`
	Height       int    `json:"height"`
	FileSize     int    `json:"file_size,omitempty"` // Optional.
}

PhotoSize represents one size of a photo or a file / sticker thumbnail.

https://core.telegram.org/bots/api#photosize

type Poll

type Poll struct {
	ID                    string           `json:"id"`
	Question              string           `json:"question"`
	Options               []*PollOption    `json:"options"`
	TotalVoterCount       int              `json:"total_voter_count"`
	IsClosed              bool             `json:"is_closed"`
	IsAnonymous           bool             `json:"is_anonymous"`
	Type                  string           `json:"type"`
	AllowsMultipleAnswers bool             `json:"allows_multiple_answers"`
	CorrectOptionID       int              `json:"correct_option_id,omitempty"`    // Optional.
	Explanation           string           `json:"explanation,omitempty"`          // Optional.
	ExplanationEntities   []*MessageEntity `json:"explanation_entities,omitempty"` // Optional.
	OpenPeriod            int              `json:"open_period,omitempty"`          // Optional.
	CloseDate             int              `json:"close_date,omitempty"`           // Optional.
}

Poll contains information about a poll.

https://core.telegram.org/bots/api#poll

type PollAnswer

type PollAnswer struct {
	PollID    string `json:"poll_id"`
	User      *User  `json:"user"`
	OptionIDs []int  `json:"option_ids"`
}

PollAnswer represents an answer of a user in a non-anonymous poll.

https://core.telegram.org/bots/api#pollanswer

type PollOption

type PollOption struct {
	Text       string `json:"text"`
	VoterCount int    `json:"voter_count"`
}

PollOption contains information about one answer option in a poll.

https://core.telegram.org/bots/api#polloption

type PreCheckoutQuery

type PreCheckoutQuery struct {
	ID               string     `json:"id"`
	From             *User      `json:"from"`
	Currency         string     `json:"currency"`
	TotalAmount      int        `json:"total_amount"`
	InvoicePayload   string     `json:"invoice_payload"`
	ShippingOptionID string     `json:"shipping_option_id"`
	OrderInfo        *OrderInfo `json:"order_info"`
}

PreCheckoutQuery contains information about an incoming pre-checkout query.

https://core.telegram.org/bots/api#precheckoutquery

type ProximityAlertTriggered

type ProximityAlertTriggered struct {
	Traveler *User `json:"traveler"`
	Watcher  *User `json:"watcher"`
	Distance int   `json:"distance"`
}

ProximityAlertTriggered represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.

https://core.telegram.org/bots/api#proximityalerttriggered

type ReplyKeyboardMarkup

type ReplyKeyboardMarkup struct {
	Keyboard        [][]*KeyboardButton `json:"keyboard"`
	ResizeKeyboard  bool                `json:"resize_keyboard,omitempty"`   // Optional.
	OneTimeKeyboard bool                `json:"one_time_keyboard,omitempty"` // Optional.
	Selective       bool                `json:"selective,omitempty"`         // Optional.
}

ReplyKeyboardMarkup represents a custom keyboard with reply options (see Introduction to bots for details and examples).

https://core.telegram.org/bots/api#replykeyboardmarkup

type ReplyKeyboardRemove

type ReplyKeyboardRemove struct {
	RemoveKeyboard bool `json:"remove_keyboard"`
	Selective      bool `json:"selective,omitempty"` // Optional.
}

ReplyKeyboardRemove, 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

type Response

type Response struct {
	OK          bool                `json:"ok"`
	Description string              `json:"description,omitempty"` // Optional.
	Result      json.RawMessage     `json:"result,omitempty"`      // Optional.
	ErrorCode   int                 `json:"error_code,omitempty"`  // Optional.
	Parameters  *ResponseParameters `json:"parameters,omitempty"`  // Optional.
	// contains filtered or unexported fields
}

Response represents a general response from Telegram.

https://core.telegram.org/bots/api#making-requests

func (*Response) Read

func (r *Response) Read(b []byte) (n int, err error)

type ResponseParameters

type ResponseParameters struct {
	MigrateToChatID int `json:"migrate_to_chat_id,omitempty"` // Optional.
	RetryAfter      int `json:"retry_after,omitempty"`        // Optional.
}

ResponseParameters contains information about why a request was unsuccessful.

https://core.telegram.org/bots/api#responseparameters

type ShippingAddress

type ShippingAddress struct {
	CountryCode string `json:"country_code"`
	State       string `json:"state"`
	City        string `json:"city"`
	StreetLine1 string `json:"street_line1"`
	StreetLine2 string `json:"street_line2"`
	PostCode    string `json:"post_code"`
}

ShippingAddress represents a shipping address.

https://core.telegram.org/bots/api#shippingaddress

type ShippingOption

type ShippingOption struct {
	ID     string          `json:"id"`
	Title  string          `json:"title"`
	Prices []*LabeledPrice `json:"prices"`
}

ShippingOption represents one shipping option.

https://core.telegram.org/bots/api#shippingoption

type ShippingQuery

type ShippingQuery struct {
	ID              string           `json:"id"`
	From            *User            `json:"from"`
	InvoicePayload  string           `json:"invoice_payload"`
	ShippingAddress *ShippingAddress `json:"shipping_address"`
}

ShippingQuery contains information about an incoming shipping query.

https://core.telegram.org/bots/api#shippingquery

type Sticker

type Sticker struct {
	FileID       string        `json:"file_id"`
	FileUniqueID string        `json:"file_unique_id"`
	Width        int           `json:"width"`
	Height       int           `json:"height"`
	IsAnimated   bool          `json:"is_animated"`
	Thumb        *PhotoSize    `json:"thumb,omitempty"`         // Optional.
	Emoji        string        `json:"emoji,omitempty"`         // Optional.
	SetName      string        `json:"set_name,omitempty"`      // Optional.
	MaskPosition *MaskPosition `json:"mask_position,omitempty"` // Optional.
	FileSize     int           `json:"file_size,omitempty"`     // Optional.
}

Sticker represents a sticker.

https://core.telegram.org/bots/api#sticker

type StickerSet

type StickerSet struct {
	Name          string     `json:"name"`
	Title         string     `json:"title"`
	IsAnimated    bool       `json:"is_animated"`
	ContainsMasks bool       `json:"contains_masks"`
	Stickers      []*Sticker `json:"stickers"`
	Thumb         *PhotoSize `json:"thumb,omitempty"` // Optional.
}

StickerSet represents a sticker set.

https://core.telegram.org/bots/api#stickerset

type SuccessfulPayment

type SuccessfulPayment struct {
	Currency                string     `json:"currency"`
	TotalAmount             int        `json:"total_amount"`
	InvoicePayload          string     `json:"invoice_payload"`
	ShippingOptionID        string     `json:"shipping_option_id"`
	OrderInfo               *OrderInfo `json:"order_info"`
	TelegramPaymentChargeID string     `json:"telegram_payment_charge_id"`
	ProviderPaymentChargeID string     `json:"provider_payment_charge_id"`
}

SuccessfulPayment contains basic information about a successful payment.

https://core.telegram.org/bots/api#successfulpayment

type Update

type Update struct {
	UpdateID           int                 `json:"update_id"`
	Message            *Message            `json:"message,omitempty"`              // Optional.
	EditedMessage      *Message            `json:"edited_message,omitempty"`       // Optional.
	ChannelPost        *Message            `json:"channel_post,omitempty"`         // Optional.
	EditedChannelPost  *Message            `json:"edited_channel_post,omitempty"`  // Optional.
	InlineQuery        *InlineQuery        `json:"inline_query,omitempty"`         // Optional.
	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"` // Optional.
	CallbackQuery      *CallbackQuery      `json:"callback_query,omitempty"`       // Optional.
	ShippingQuery      *ShippingQuery      `json:"shipping_query,omitempty"`       // Optional.
	PreCheckoutQuery   *PreCheckoutQuery   `json:"pre_checkout_query,omitempty"`   // Optional.
	Poll               *Poll               `json:"poll,omitempty"`                 // Optional.
	PollAnswer         *PollAnswer         `json:"poll_answer,omitempty"`          // Optional.
}

Update represents an incoming update. At most one of the optional parameters can be present in any given update.

https://core.telegram.org/bots/api#update

type User

type User struct {
	ID                      int    `json:"id"`
	IsBot                   bool   `json:"is_bot"`
	FirstName               string `json:"first_name"`
	LastName                string `json:"last_name,omitempty"`                   // Optional.
	Username                string `json:"username,omitempty"`                    // Optional.
	LanguageCode            string `json:"language_code,omitempty"`               // Optional.
	CanJoinGroups           bool   `json:"can_join_groups,omitempty"`             // Optional.
	CanReadAllGroupMessages bool   `json:"can_read_all_group_messages,omitempty"` // Optional.
	SupportsInlineQueries   bool   `json:"supports_inline_queries,omitempty"`     // Optional.
}

User represents a Telegram user or bot.

https://core.telegram.org/bots/api#user.

type UserProfilePhotos

type UserProfilePhotos struct {
	TotalCount int            `json:"total_count"`
	Photos     [][]*PhotoSize `json:"photos"`
}

UserProfilePhotos represent a user's profile pictures.

https://core.telegram.org/bots/api#userprofilephotos

type Venue

type Venue struct {
	Location        *Location `json:"location"`
	Title           string    `json:"title"`
	Address         string    `json:"address"`
	FoursquareID    string    `json:"foursquare_id,omitempty"`     // Optional.
	FoursquareType  string    `json:"foursquare_type,omitempty"`   // Optional.
	GooglePlaceID   string    `json:"google_place_id,omitempty"`   // Optional.
	GooglePlaceType string    `json:"google_place_type,omitempty"` // Optional.
}

Venue represents a venue.

https://core.telegram.org/bots/api#venue

type Video

type Video struct {
	FileID       string     `json:"file_id"`
	FileUniqueID string     `json:"file_unique_id"`
	Width        int        `json:"width"`
	Height       int        `json:"height"`
	Duration     int        `json:"duration"`
	Thumb        *PhotoSize `json:"thumb,omitempty"`     // Optional.
	FileName     string     `json:"file_name,omitempty"` // Optional.
	MIMEType     string     `json:"mime_type,omitempty"` // Optional.
	FileSize     int        `json:"file_size,omitempty"` // Optional.
}

Video represents a video file.

https://core.telegram.org/bots/api#video

type VideoNote

type VideoNote struct {
	FileID       string     `json:"file_id"`
	FileUniqueID string     `json:"file_unique_id"`
	Length       int        `json:"length"`
	Duration     int        `json:"duration"`
	Thumb        *PhotoSize `json:"thumb,omitempty"`     // Optional.
	FileSize     int        `json:"file_size,omitempty"` // Optional.
}

VideoNote represents a video message.

https://core.telegram.org/bots/api#videonote

type Voice

type Voice struct {
	FileID       string `json:"file_id"`
	FileUniqueID string `json:"file_unique_id"`
	Duration     string `json:"duration"`
	MIMEType     string `json:"mime_type,omitempty"` // Optional.
	FileSize     string `json:"file_size,omitempty"` // Optional.
}

Voice represents a voice note.

https://core.telegram.org/bots/api#voice

type WebhookInfo

type WebhookInfo struct {
	URL                  string   `json:"url"`
	HasCustomCertificate bool     `json:"has_custom_certificate"`
	PendingUpdateCount   int      `json:"pending_update_count"`
	IPAddress            string   `json:"ip_address,omitempty"`         // Optional.
	LastErrorDate        int      `json:"last_error_date,omitempty"`    // Optional.
	LastErrorMessage     string   `json:"last_error_message,omitempty"` // Optional.
	MaxConnections       int      `json:"max_connections,omitempty"`    // Optional.
	AllowedUpdates       []string `json:"allowed_updates,omitempty"`    // Optional.
}

WebhookInfo contains information about the current status of a webhook.

https://core.telegram.org/bots/api#webhookinfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL