all repos — telegram-bot-api @ bd27dae5668234e3d6bc89e5256808efadd70dd4

Golang bindings for the Telegram Bot API

types.go (view raw)

   1package tgbotapi
   2
   3import (
   4	"encoding/json"
   5	"errors"
   6	"fmt"
   7	"net/url"
   8	"strings"
   9	"time"
  10)
  11
  12// APIResponse is a response from the Telegram API with the result
  13// stored raw.
  14type APIResponse struct {
  15	Ok          bool                `json:"ok"`
  16	Result      json.RawMessage     `json:"result,omitempty"`
  17	ErrorCode   int                 `json:"error_code,omitempty"`
  18	Description string              `json:"description,omitempty"`
  19	Parameters  *ResponseParameters `json:"parameters,omitempty"`
  20}
  21
  22// ResponseParameters are various errors that can be returned in APIResponse.
  23type ResponseParameters struct {
  24	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"` // optional
  25	RetryAfter      int   `json:"retry_after,omitempty"`        // optional
  26}
  27
  28// Update is an update response, from GetUpdates.
  29type Update struct {
  30	UpdateID           int                 `json:"update_id"`
  31	Message            *Message            `json:"message,omitempty"`
  32	EditedMessage      *Message            `json:"edited_message,omitempty"`
  33	ChannelPost        *Message            `json:"channel_post,omitempty"`
  34	EditedChannelPost  *Message            `json:"edited_channel_post,omitempty"`
  35	InlineQuery        *InlineQuery        `json:"inline_query,omitempty"`
  36	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
  37	CallbackQuery      *CallbackQuery      `json:"callback_query,omitempty"`
  38	ShippingQuery      *ShippingQuery      `json:"shipping_query,omitempty"`
  39	PreCheckoutQuery   *PreCheckoutQuery   `json:"pre_checkout_query,omitempty"`
  40	Poll               *Poll               `json:"poll,omitempty"`
  41	PollAnswer         *PollAnswer         `json:"poll_answer,omitempty"`
  42}
  43
  44// UpdatesChannel is the channel for getting updates.
  45type UpdatesChannel <-chan Update
  46
  47// Clear discards all unprocessed incoming updates.
  48func (ch UpdatesChannel) Clear() {
  49	for len(ch) != 0 {
  50		<-ch
  51	}
  52}
  53
  54// User is a user on Telegram.
  55type User struct {
  56	ID                      int    `json:"id"`
  57	FirstName               string `json:"first_name"`
  58	LastName                string `json:"last_name,omitempty"`                   // optional
  59	UserName                string `json:"username,omitempty"`                    // optional
  60	LanguageCode            string `json:"language_code,omitempty"`               // optional
  61	IsBot                   bool   `json:"is_bot,omitempty"`                      // optional
  62	CanJoinGroups           bool   `json:"can_join_groups,omitempty"`             // optional
  63	CanReadAllGroupMessages bool   `json:"can_read_all_group_messages,omitempty"` // optional
  64	SupportsInlineQueries   bool   `json:"supports_inline_queries,omitempty"`     // optional
  65}
  66
  67// String displays a simple text version of a user.
  68//
  69// It is normally a user's username, but falls back to a first/last
  70// name as available.
  71func (u *User) String() string {
  72	if u == nil {
  73		return ""
  74	}
  75	if u.UserName != "" {
  76		return u.UserName
  77	}
  78
  79	name := u.FirstName
  80	if u.LastName != "" {
  81		name += " " + u.LastName
  82	}
  83
  84	return name
  85}
  86
  87// GroupChat is a group chat.
  88type GroupChat struct {
  89	ID    int    `json:"id"`
  90	Title string `json:"title"`
  91}
  92
  93// ChatPhoto represents a chat photo.
  94type ChatPhoto struct {
  95	SmallFileID       string `json:"small_file_id"`
  96	SmallFileUniqueID string `json:"small_file_unique_id"`
  97	BigFileID         string `json:"big_file_id"`
  98	BigFileUniqueID   string `json:"big_file_unique_id"`
  99}
 100
 101// ChatPermissions describes actions that a non-administrator user is
 102// allowed to take in a chat. All fields are optional.
 103type ChatPermissions struct {
 104	CanSendMessages       bool `json:"can_send_messages"`
 105	CanSendMediaMessages  bool `json:"can_send_media_messages"`
 106	CanSendPolls          bool `json:"can_send_polls"`
 107	CanSendOtherMessages  bool `json:"can_send_other_messages"`
 108	CanAddWebPagePreviews bool `json:"can_add_web_page_previews"`
 109	CanChangeInfo         bool `json:"can_change_info"`
 110	CanInviteUsers        bool `json:"can_invite_users"`
 111	CanPinMessages        bool `json:"can_pin_messages"`
 112}
 113
 114// Chat contains information about the place a message was sent.
 115type Chat struct {
 116	ID                  int64            `json:"id"`
 117	Type                string           `json:"type"`
 118	Title               string           `json:"title,omitempty"`                          // optional
 119	UserName            string           `json:"username,omitempty"`                       // optional
 120	FirstName           string           `json:"first_name,omitempty"`                     // optional
 121	LastName            string           `json:"last_name,omitempty"`                      // optional
 122	AllMembersAreAdmins bool             `json:"all_members_are_administrators,omitempty"` // deprecated, optional
 123	Photo               *ChatPhoto       `json:"photo,omitempty"`                          // optional
 124	Description         string           `json:"description,omitempty"`                    // optional
 125	InviteLink          string           `json:"invite_link,omitempty"`                    // optional
 126	PinnedMessage       *Message         `json:"pinned_message,omitempty"`                 // optional
 127	Permissions         *ChatPermissions `json:"permissions,omitempty"`                    // optional
 128	SlowModeDelay       int              `json:"slow_mode_delay,omitempty"`                // optional
 129	StickerSetName      string           `json:"sticker_set_name,omitempty"`               // optional
 130	CanSetStickerSet    bool             `json:"can_set_sticker_set,omitempty"`            // optional
 131}
 132
 133// IsPrivate returns if the Chat is a private conversation.
 134func (c Chat) IsPrivate() bool {
 135	return c.Type == "private"
 136}
 137
 138// IsGroup returns if the Chat is a group.
 139func (c Chat) IsGroup() bool {
 140	return c.Type == "group"
 141}
 142
 143// IsSuperGroup returns if the Chat is a supergroup.
 144func (c Chat) IsSuperGroup() bool {
 145	return c.Type == "supergroup"
 146}
 147
 148// IsChannel returns if the Chat is a channel.
 149func (c Chat) IsChannel() bool {
 150	return c.Type == "channel"
 151}
 152
 153// ChatConfig returns a ChatConfig struct for chat related methods.
 154func (c Chat) ChatConfig() ChatConfig {
 155	return ChatConfig{ChatID: c.ID}
 156}
 157
 158// Message is returned by almost every request, and contains data about
 159// almost anything.
 160type Message struct {
 161	MessageID             int                   `json:"message_id"`
 162	From                  *User                 `json:"from,omitempty"` // optional
 163	Date                  int                   `json:"date"`
 164	Chat                  *Chat                 `json:"chat"`
 165	ForwardFrom           *User                 `json:"forward_from,omitempty"`            // optional
 166	ForwardFromChat       *Chat                 `json:"forward_from_chat,omitempty"`       // optional
 167	ForwardFromMessageID  int                   `json:"forward_from_message_id,omitempty"` // optional
 168	ForwardSignature      string                `json:"forward_signature,omitempty"`       // optional
 169	ForwardSenderName     string                `json:"forward_sender_name,omitempty"`     // optional
 170	ForwardDate           int                   `json:"forward_date,omitempty"`            // optional
 171	ReplyToMessage        *Message              `json:"reply_to_message,omitempty"`        // optional
 172	EditDate              int                   `json:"edit_date,omitempty"`               // optional
 173	MediaGroupID          string                `json:"media_group_id,omitempty"`          // optional
 174	AuthorSignature       string                `json:"author_signature,omitempty"`        // optional
 175	Text                  string                `json:"text,omitempty"`                    // optional
 176	Entities              []MessageEntity       `json:"entities,omitempty"`                // optional
 177	CaptionEntities       []MessageEntity       `json:"caption_entities,omitempty"`        // optional
 178	Audio                 *Audio                `json:"audio,omitempty"`                   // optional
 179	Document              *Document             `json:"document,omitempty"`                // optional
 180	Animation             *ChatAnimation        `json:"animation,omitempty"`               // optional
 181	Game                  *Game                 `json:"game,omitempty"`                    // optional
 182	Photo                 []PhotoSize           `json:"photo,omitempty"`                   // optional
 183	Sticker               *Sticker              `json:"sticker,omitempty"`                 // optional
 184	Video                 *Video                `json:"video,omitempty"`                   // optional
 185	VideoNote             *VideoNote            `json:"video_note,omitempty"`              // optional
 186	Voice                 *Voice                `json:"voice,omitempty"`                   // optional
 187	Caption               string                `json:"caption,omitempty"`                 // optional
 188	Contact               *Contact              `json:"contact,omitempty"`                 // optional
 189	Location              *Location             `json:"location,omitempty"`                // optional
 190	Venue                 *Venue                `json:"venue,omitempty"`                   // optional
 191	Poll                  *Poll                 `json:"poll,omitempty"`                    // optional
 192	Dice                  *Dice                 `json:"dice,omitempty"`                    // optional
 193	NewChatMembers        []User                `json:"new_chat_members,omitempty"`        // optional
 194	LeftChatMember        *User                 `json:"left_chat_member,omitempty"`        // optional
 195	NewChatTitle          string                `json:"new_chat_title,omitempty"`          // optional
 196	NewChatPhoto          []PhotoSize           `json:"new_chat_photo,omitempty"`          // optional
 197	DeleteChatPhoto       bool                  `json:"delete_chat_photo,omitempty"`       // optional
 198	GroupChatCreated      bool                  `json:"group_chat_created,omitempty"`      // optional
 199	SuperGroupChatCreated bool                  `json:"supergroup_chat_created,omitempty"` // optional
 200	ChannelChatCreated    bool                  `json:"channel_chat_created,omitempty"`    // optional
 201	MigrateToChatID       int64                 `json:"migrate_to_chat_id,omitempty"`      // optional
 202	MigrateFromChatID     int64                 `json:"migrate_from_chat_id,omitempty"`    // optional
 203	PinnedMessage         *Message              `json:"pinned_message,omitempty"`          // optional
 204	Invoice               *Invoice              `json:"invoice,omitempty"`                 // optional
 205	SuccessfulPayment     *SuccessfulPayment    `json:"successful_payment,omitempty"`      // optional
 206	ConnectedWebsite      string                `json:"connected_website,omitempty"`       // optional
 207	PassportData          *PassportData         `json:"passport_data,omitempty"`           // optional
 208	ReplyMarkup           *InlineKeyboardMarkup `json:"reply_markup,omitempty"`            // optional
 209}
 210
 211// Time converts the message timestamp into a Time.
 212func (m *Message) Time() time.Time {
 213	return time.Unix(int64(m.Date), 0)
 214}
 215
 216// IsCommand returns true if message starts with a "bot_command" entity.
 217func (m *Message) IsCommand() bool {
 218	if m.Entities == nil || len(m.Entities) == 0 {
 219		return false
 220	}
 221
 222	entity := m.Entities[0]
 223	return entity.Offset == 0 && entity.IsCommand()
 224}
 225
 226// Command checks if the message was a command and if it was, returns the
 227// command. If the Message was not a command, it returns an empty string.
 228//
 229// If the command contains the at name syntax, it is removed. Use
 230// CommandWithAt() if you do not want that.
 231func (m *Message) Command() string {
 232	command := m.CommandWithAt()
 233
 234	if i := strings.Index(command, "@"); i != -1 {
 235		command = command[:i]
 236	}
 237
 238	return command
 239}
 240
 241// CommandWithAt checks if the message was a command and if it was, returns the
 242// command. If the Message was not a command, it returns an empty string.
 243//
 244// If the command contains the at name syntax, it is not removed. Use Command()
 245// if you want that.
 246func (m *Message) CommandWithAt() string {
 247	if !m.IsCommand() {
 248		return ""
 249	}
 250
 251	// IsCommand() checks that the message begins with a bot_command entity
 252	entity := m.Entities[0]
 253	return m.Text[1:entity.Length]
 254}
 255
 256// CommandArguments checks if the message was a command and if it was,
 257// returns all text after the command name. If the Message was not a
 258// command, it returns an empty string.
 259//
 260// Note: The first character after the command name is omitted:
 261// - "/foo bar baz" yields "bar baz", not " bar baz"
 262// - "/foo-bar baz" yields "bar baz", too
 263// Even though the latter is not a command conforming to the spec, the API
 264// marks "/foo" as command entity.
 265func (m *Message) CommandArguments() string {
 266	if !m.IsCommand() {
 267		return ""
 268	}
 269
 270	// IsCommand() checks that the message begins with a bot_command entity
 271	entity := m.Entities[0]
 272
 273	if len(m.Text) == entity.Length {
 274		return "" // The command makes up the whole message
 275	}
 276
 277	return m.Text[entity.Length+1:]
 278}
 279
 280// MessageEntity contains information about data in a Message.
 281type MessageEntity struct {
 282	Type     string `json:"type"`
 283	Offset   int    `json:"offset"`
 284	Length   int    `json:"length"`
 285	URL      string `json:"url,omitempty"`      // optional
 286	User     *User  `json:"user,omitempty"`     // optional
 287	Language string `json:"language,omitempty"` // optional
 288}
 289
 290// ParseURL attempts to parse a URL contained within a MessageEntity.
 291func (e MessageEntity) ParseURL() (*url.URL, error) {
 292	if e.URL == "" {
 293		return nil, errors.New(ErrBadURL)
 294	}
 295
 296	return url.Parse(e.URL)
 297}
 298
 299// IsMention returns true if the type of the message entity is "mention" (@username).
 300func (e MessageEntity) IsMention() bool {
 301	return e.Type == "mention"
 302}
 303
 304// IsHashtag returns true if the type of the message entity is "hashtag".
 305func (e MessageEntity) IsHashtag() bool {
 306	return e.Type == "hashtag"
 307}
 308
 309// IsCommand returns true if the type of the message entity is "bot_command".
 310func (e MessageEntity) IsCommand() bool {
 311	return e.Type == "bot_command"
 312}
 313
 314// IsUrl returns true if the type of the message entity is "url".
 315func (e MessageEntity) IsUrl() bool {
 316	return e.Type == "url"
 317}
 318
 319// IsEmail returns true if the type of the message entity is "email".
 320func (e MessageEntity) IsEmail() bool {
 321	return e.Type == "email"
 322}
 323
 324// IsBold returns true if the type of the message entity is "bold" (bold text).
 325func (e MessageEntity) IsBold() bool {
 326	return e.Type == "bold"
 327}
 328
 329// IsItalic returns true if the type of the message entity is "italic" (italic text).
 330func (e MessageEntity) IsItalic() bool {
 331	return e.Type == "italic"
 332}
 333
 334// IsCode returns true if the type of the message entity is "code" (monowidth string).
 335func (e MessageEntity) IsCode() bool {
 336	return e.Type == "code"
 337}
 338
 339// IsPre returns true if the type of the message entity is "pre" (monowidth block).
 340func (e MessageEntity) IsPre() bool {
 341	return e.Type == "pre"
 342}
 343
 344// IsTextLink returns true if the type of the message entity is "text_link" (clickable text URL).
 345func (e MessageEntity) IsTextLink() bool {
 346	return e.Type == "text_link"
 347}
 348
 349// PhotoSize contains information about photos.
 350type PhotoSize struct {
 351	FileID       string `json:"file_id"`
 352	FileUniqueID string `json:"file_unique_id"`
 353	Width        int    `json:"width"`
 354	Height       int    `json:"height"`
 355	FileSize     int    `json:"file_size,omitempty"` // optional
 356}
 357
 358// Audio contains information about audio.
 359type Audio struct {
 360	FileID       string `json:"file_id"`
 361	FileUniqueID string `json:"file_unique_id"`
 362	Duration     int    `json:"duration"`
 363	Performer    string `json:"performer,omitempty"` // optional
 364	Title        string `json:"title,omitempty"`     // optional
 365	MimeType     string `json:"mime_type,omitempty"` // optional
 366	FileSize     int    `json:"file_size,omitempty"` // optional
 367}
 368
 369// Document contains information about a document.
 370type Document struct {
 371	FileID       string     `json:"file_id"`
 372	FileUniqueID string     `json:"file_unique_id"`
 373	Thumbnail    *PhotoSize `json:"thumb,omitempty"`     // optional
 374	FileName     string     `json:"file_name,omitempty"` // optional
 375	MimeType     string     `json:"mime_type,omitempty"` // optional
 376	FileSize     int        `json:"file_size,omitempty"` // optional
 377}
 378
 379// Sticker contains information about a sticker.
 380type Sticker struct {
 381	FileID       string       `json:"file_id"`
 382	FileUniqueID string       `json:"file_unique_id"`
 383	Width        int          `json:"width"`
 384	Height       int          `json:"height"`
 385	IsAnimated   bool         `json:"is_animated"`
 386	Thumbnail    *PhotoSize   `json:"thumb,omitempty"`         // optional
 387	Emoji        string       `json:"emoji,omitempty"`         // optional
 388	SetName      string       `json:"set_name,omitempty"`      // optional
 389	MaskPosition MaskPosition `json:"mask_position,omitempty"` //optional
 390	FileSize     int          `json:"file_size,omitempty"`     // optional
 391}
 392
 393// MaskPosition is the position of a mask.
 394type MaskPosition struct {
 395	Point     string     `json:"point"`
 396	XShift    float32    `json:"x_shift"`
 397	YShift    float32    `json:"y_shift"`
 398	Scale     float32    `json:"scale"`
 399	FileID    string     `json:"file_id"`
 400	Width     int        `json:"width"`
 401	Height    int        `json:"height"`
 402	Thumbnail *PhotoSize `json:"thumb,omitempty"`     // optional
 403	Emoji     string     `json:"emoji,omitempty"`     // optional
 404	FileSize  int        `json:"file_size,omitempty"` // optional
 405	SetName   string     `json:"set_name,omitempty"`  // optional
 406}
 407
 408// ChatAnimation contains information about an animation.
 409type ChatAnimation struct {
 410	FileID       string     `json:"file_id"`
 411	FileUniqueID string     `json:"file_unique_id"`
 412	Width        int        `json:"width"`
 413	Height       int        `json:"height"`
 414	Duration     int        `json:"duration"`
 415	Thumbnail    *PhotoSize `json:"thumb,omitempty"`     // optional
 416	FileName     string     `json:"file_name,omitempty"` // optional
 417	MimeType     string     `json:"mime_type,omitempty"` // optional
 418	FileSize     int        `json:"file_size,omitempty"` // optional
 419}
 420
 421// Video contains information about a video.
 422type Video struct {
 423	FileID       string     `json:"file_id"`
 424	FileUniqueID string     `json:"file_unique_id"`
 425	Width        int        `json:"width"`
 426	Height       int        `json:"height"`
 427	Duration     int        `json:"duration"`
 428	Thumbnail    *PhotoSize `json:"thumb,omitempty"`     // optional
 429	MimeType     string     `json:"mime_type,omitempty"` // optional
 430	FileSize     int        `json:"file_size,omitempty"` // optional
 431}
 432
 433// VideoNote contains information about a video.
 434type VideoNote struct {
 435	FileID       string     `json:"file_id"`
 436	FileUniqueID string     `json:"file_unique_id"`
 437	Length       int        `json:"length"`
 438	Duration     int        `json:"duration"`
 439	Thumbnail    *PhotoSize `json:"thumb,omitempty"`     // optional
 440	FileSize     int        `json:"file_size,omitempty"` // optional
 441}
 442
 443// Voice contains information about a voice.
 444type Voice struct {
 445	FileID       string `json:"file_id"`
 446	FileUniqueID string `json:"file_unique_id"`
 447	Duration     int    `json:"duration"`
 448	MimeType     string `json:"mime_type,omitempty"` // optional
 449	FileSize     int    `json:"file_size,omitempty"` // optional
 450}
 451
 452// Contact contains information about a contact.
 453//
 454// Note that LastName and UserID may be empty.
 455type Contact struct {
 456	PhoneNumber string `json:"phone_number"`
 457	FirstName   string `json:"first_name"`
 458	LastName    string `json:"last_name,omitempty"` // optional
 459	UserID      int    `json:"user_id,omitempty"`   // optional
 460	VCard       string `json:"vcard,omitempty"`     // optional
 461}
 462
 463// Location contains information about a place.
 464type Location struct {
 465	Longitude float64 `json:"longitude"`
 466	Latitude  float64 `json:"latitude"`
 467}
 468
 469// Venue contains information about a venue, including its Location.
 470type Venue struct {
 471	Location     Location `json:"location"`
 472	Title        string   `json:"title"`
 473	Address      string   `json:"address"`
 474	FoursquareID string   `json:"foursquare_id,omitempty"` // optional
 475}
 476
 477// PollOption contains information about one answer option in a poll.
 478type PollOption struct {
 479	Text       string `json:"text"`
 480	VoterCount int    `json:"voter_count"`
 481}
 482
 483// PollAnswer represents an answer of a user in a non-anonymous poll.
 484type PollAnswer struct {
 485	PollID    string `json:"poll_id"`
 486	User      User   `json:"user"`
 487	OptionIDs []int  `json:"option_ids"`
 488}
 489
 490// Poll contains information about a poll.
 491type Poll struct {
 492	ID                    string          `json:"id"`
 493	Question              string          `json:"question"`
 494	Options               []PollOption    `json:"options"`
 495	IsClosed              bool            `json:"is_closed"`
 496	IsAnonymous           bool            `json:"is_anonymous"`
 497	Type                  string          `json:"type"`
 498	AllowsMultipleAnswers bool            `json:"allows_multiple_answers"`
 499	CorrectOptionID       int             `json:"correct_option_id,omitempty"`    // optional
 500	Explanation           string          `json:"explanation,omitempty"`          // optional
 501	ExplanationEntities   []MessageEntity `json:"explanation_entities,omitempty"` // optional
 502	OpenPeriod            int             `json:"open_period,omitempty"`          // optional
 503	CloseDate             int             `json:"close_date,omitempty"`           // optional
 504}
 505
 506// Dice represents a single dice value.
 507type Dice struct {
 508	Emoji string `json:"emoji"`
 509	Value int    `json:"value"`
 510}
 511
 512// UserProfilePhotos contains a set of user profile photos.
 513type UserProfilePhotos struct {
 514	TotalCount int           `json:"total_count"`
 515	Photos     [][]PhotoSize `json:"photos"`
 516}
 517
 518// File contains information about a file to download from Telegram.
 519type File struct {
 520	FileID       string `json:"file_id"`
 521	FileUniqueID string `json:"file_unique_id"`
 522	FileSize     int    `json:"file_size,omitempty"` // optional
 523	FilePath     string `json:"file_path,omitempty"` // optional
 524}
 525
 526// Link returns a full path to the download URL for a File.
 527//
 528// It requires the Bot Token to create the link.
 529func (f *File) Link(token string) string {
 530	return fmt.Sprintf(FileEndpoint, token, f.FilePath)
 531}
 532
 533// ReplyKeyboardMarkup allows the Bot to set a custom keyboard.
 534type ReplyKeyboardMarkup struct {
 535	Keyboard        [][]KeyboardButton `json:"keyboard"`
 536	ResizeKeyboard  bool               `json:"resize_keyboard,omitempty"`   // optional
 537	OneTimeKeyboard bool               `json:"one_time_keyboard,omitempty"` // optional
 538	Selective       bool               `json:"selective,omitempty"`         // optional
 539}
 540
 541// KeyboardButton is a button within a custom keyboard.
 542type KeyboardButton struct {
 543	Text            string                  `json:"text"`
 544	RequestContact  bool                    `json:"request_contact"`
 545	RequestLocation bool                    `json:"request_location"`
 546	RequestPoll     *KeyboardButtonPollType `json:"request_poll,omitempty"`
 547}
 548
 549// KeyboardButtonPollType represents type of a poll, which is allowed to
 550// be created and sent when the corresponding button is pressed.
 551type KeyboardButtonPollType struct {
 552	Type string `json:"type"`
 553}
 554
 555// ReplyKeyboardHide allows the Bot to hide a custom keyboard.
 556type ReplyKeyboardHide struct {
 557	HideKeyboard bool `json:"hide_keyboard"`
 558	Selective    bool `json:"selective,omitempty"` // optional
 559}
 560
 561// ReplyKeyboardRemove allows the Bot to hide a custom keyboard.
 562type ReplyKeyboardRemove struct {
 563	RemoveKeyboard bool `json:"remove_keyboard"`
 564	Selective      bool `json:"selective"`
 565}
 566
 567// InlineKeyboardMarkup is a custom keyboard presented for an inline bot.
 568type InlineKeyboardMarkup struct {
 569	InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
 570}
 571
 572// InlineKeyboardButton is a button within a custom keyboard for
 573// inline query responses.
 574//
 575// Note that some values are references as even an empty string
 576// will change behavior.
 577//
 578// CallbackGame, if set, MUST be first button in first row.
 579type InlineKeyboardButton struct {
 580	Text                         string        `json:"text"`
 581	URL                          *string       `json:"url,omitempty"`                              // optional
 582	LoginURL                     *LoginURL     `json:"login_url,omitempty"`                        // optional
 583	CallbackData                 *string       `json:"callback_data,omitempty"`                    // optional
 584	SwitchInlineQuery            *string       `json:"switch_inline_query,omitempty"`              // optional
 585	SwitchInlineQueryCurrentChat *string       `json:"switch_inline_query_current_chat,omitempty"` // optional
 586	CallbackGame                 *CallbackGame `json:"callback_game,omitempty"`                    // optional
 587	Pay                          bool          `json:"pay,omitempty"`                              // optional
 588}
 589
 590// LoginURL is the parameters for the login inline keyboard button type.
 591type LoginURL struct {
 592	URL                string `json:"url"`
 593	ForwardText        string `json:"forward_text"`
 594	BotUsername        string `json:"bot_username"`
 595	RequestWriteAccess bool   `json:"request_write_access"`
 596}
 597
 598// CallbackQuery is data sent when a keyboard button with callback data
 599// is clicked.
 600type CallbackQuery struct {
 601	ID              string   `json:"id"`
 602	From            *User    `json:"from"`
 603	Message         *Message `json:"message,omitempty"`           // optional
 604	InlineMessageID string   `json:"inline_message_id,omitempty"` // optional
 605	ChatInstance    string   `json:"chat_instance"`
 606	Data            string   `json:"data,omitempty"`            // optional
 607	GameShortName   string   `json:"game_short_name,omitempty"` // optional
 608}
 609
 610// ForceReply allows the Bot to have users directly reply to it without
 611// additional interaction.
 612type ForceReply struct {
 613	ForceReply bool `json:"force_reply"`
 614	Selective  bool `json:"selective"` // optional
 615}
 616
 617// ChatMember is information about a member in a chat.
 618type ChatMember struct {
 619	User                  *User  `json:"user"`
 620	Status                string `json:"status"`
 621	CustomTitle           string `json:"custom_title,omitempty"`              // optional
 622	UntilDate             int64  `json:"until_date,omitempty"`                // optional
 623	CanBeEdited           bool   `json:"can_be_edited,omitempty"`             // optional
 624	CanPostMessages       bool   `json:"can_post_messages,omitempty"`         // optional
 625	CanEditMessages       bool   `json:"can_edit_messages,omitempty"`         // optional
 626	CanDeleteMessages     bool   `json:"can_delete_messages,omitempty"`       // optional
 627	CanRestrictMembers    bool   `json:"can_restrict_members,omitempty"`      // optional
 628	CanPromoteMembers     bool   `json:"can_promote_members,omitempty"`       // optional
 629	CanChangeInfo         bool   `json:"can_change_info,omitempty"`           // optional
 630	CanInviteUsers        bool   `json:"can_invite_users,omitempty"`          // optional
 631	CanPinMessages        bool   `json:"can_pin_messages,omitempty"`          // optional
 632	IsChatMember          bool   `json:"is_member,omitempty"`                 // optional
 633	CanSendMessages       bool   `json:"can_send_messages,omitempty"`         // optional
 634	CanSendMediaMessages  bool   `json:"can_send_media_messages,omitempty"`   // optional
 635	CanSendPolls          bool   `json:"can_send_polls,omitempty"`            // optional
 636	CanSendOtherMessages  bool   `json:"can_send_other_messages,omitempty"`   // optional
 637	CanAddWebPagePreviews bool   `json:"can_add_web_page_previews,omitempty"` // optional
 638}
 639
 640// IsCreator returns if the ChatMember was the creator of the chat.
 641func (chat ChatMember) IsCreator() bool { return chat.Status == "creator" }
 642
 643// IsAdministrator returns if the ChatMember is a chat administrator.
 644func (chat ChatMember) IsAdministrator() bool { return chat.Status == "administrator" }
 645
 646// IsMember returns if the ChatMember is a current member of the chat.
 647func (chat ChatMember) IsMember() bool { return chat.Status == "member" }
 648
 649// HasLeft returns if the ChatMember left the chat.
 650func (chat ChatMember) HasLeft() bool { return chat.Status == "left" }
 651
 652// WasKicked returns if the ChatMember was kicked from the chat.
 653func (chat ChatMember) WasKicked() bool { return chat.Status == "kicked" }
 654
 655// Game is a game within Telegram.
 656type Game struct {
 657	Title        string          `json:"title"`
 658	Description  string          `json:"description"`
 659	Photo        []PhotoSize     `json:"photo"`
 660	Text         string          `json:"text"`
 661	TextEntities []MessageEntity `json:"text_entities"`
 662	Animation    Animation       `json:"animation"`
 663}
 664
 665// Animation is a GIF animation demonstrating the game.
 666type Animation struct {
 667	FileID       string    `json:"file_id"`
 668	FileUniqueID string    `json:"file_unique_id"`
 669	Thumb        PhotoSize `json:"thumb"`
 670	FileName     string    `json:"file_name"`
 671	MimeType     string    `json:"mime_type"`
 672	FileSize     int       `json:"file_size"`
 673}
 674
 675// GameHighScore is a user's score and position on the leaderboard.
 676type GameHighScore struct {
 677	Position int  `json:"position"`
 678	User     User `json:"user"`
 679	Score    int  `json:"score"`
 680}
 681
 682// CallbackGame is for starting a game in an inline keyboard button.
 683type CallbackGame struct{}
 684
 685// WebhookInfo is information about a currently set webhook.
 686type WebhookInfo struct {
 687	URL                  string `json:"url"`
 688	HasCustomCertificate bool   `json:"has_custom_certificate"`
 689	PendingUpdateCount   int    `json:"pending_update_count"`
 690	LastErrorDate        int    `json:"last_error_date,omitempty"`    // optional
 691	LastErrorMessage     string `json:"last_error_message,omitempty"` // optional
 692}
 693
 694// IsSet returns true if a webhook is currently set.
 695func (info WebhookInfo) IsSet() bool {
 696	return info.URL != ""
 697}
 698
 699// InlineQuery is a Query from Telegram for an inline request.
 700type InlineQuery struct {
 701	ID       string    `json:"id"`
 702	From     *User     `json:"from"`
 703	Location *Location `json:"location,omitempty"` // optional
 704	Query    string    `json:"query"`
 705	Offset   string    `json:"offset"`
 706}
 707
 708// InlineQueryResultArticle is an inline query response article.
 709type InlineQueryResultArticle struct {
 710	Type                string                `json:"type"`                            // required
 711	ID                  string                `json:"id"`                              // required
 712	Title               string                `json:"title"`                           // required
 713	InputMessageContent interface{}           `json:"input_message_content,omitempty"` // required
 714	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 715	URL                 string                `json:"url"`
 716	HideURL             bool                  `json:"hide_url"`
 717	Description         string                `json:"description"`
 718	ThumbURL            string                `json:"thumb_url"`
 719	ThumbWidth          int                   `json:"thumb_width"`
 720	ThumbHeight         int                   `json:"thumb_height"`
 721}
 722
 723// InlineQueryResultPhoto is an inline query response photo.
 724type InlineQueryResultPhoto struct {
 725	Type                string                `json:"type"`      // required
 726	ID                  string                `json:"id"`        // required
 727	URL                 string                `json:"photo_url"` // required
 728	MimeType            string                `json:"mime_type"`
 729	Width               int                   `json:"photo_width"`
 730	Height              int                   `json:"photo_height"`
 731	ThumbURL            string                `json:"thumb_url"`
 732	Title               string                `json:"title"`
 733	Description         string                `json:"description"`
 734	Caption             string                `json:"caption"`
 735	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 736	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 737}
 738
 739// InlineQueryResultCachedPhoto is an inline query response with cached photo.
 740type InlineQueryResultCachedPhoto struct {
 741	Type                string                `json:"type"`          // required
 742	ID                  string                `json:"id"`            // required
 743	PhotoID             string                `json:"photo_file_id"` // required
 744	Title               string                `json:"title"`
 745	Description         string                `json:"description"`
 746	Caption             string                `json:"caption"`
 747	ParseMode           string                `json:"parse_mode"`
 748	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 749	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 750}
 751
 752// InlineQueryResultGIF is an inline query response GIF.
 753type InlineQueryResultGIF struct {
 754	Type                string                `json:"type"`      // required
 755	ID                  string                `json:"id"`        // required
 756	URL                 string                `json:"gif_url"`   // required
 757	ThumbURL            string                `json:"thumb_url"` // required
 758	Width               int                   `json:"gif_width,omitempty"`
 759	Height              int                   `json:"gif_height,omitempty"`
 760	Duration            int                   `json:"gif_duration,omitempty"`
 761	Title               string                `json:"title,omitempty"`
 762	Caption             string                `json:"caption,omitempty"`
 763	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 764	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 765}
 766
 767// InlineQueryResultCachedGIF is an inline query response with cached gif.
 768type InlineQueryResultCachedGIF struct {
 769	Type                string                `json:"type"`        // required
 770	ID                  string                `json:"id"`          // required
 771	GifID               string                `json:"gif_file_id"` // required
 772	Title               string                `json:"title"`
 773	Caption             string                `json:"caption"`
 774	ParseMode           string                `json:"parse_mode"`
 775	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 776	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 777}
 778
 779// InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.
 780type InlineQueryResultMPEG4GIF struct {
 781	Type                string                `json:"type"`      // required
 782	ID                  string                `json:"id"`        // required
 783	URL                 string                `json:"mpeg4_url"` // required
 784	Width               int                   `json:"mpeg4_width"`
 785	Height              int                   `json:"mpeg4_height"`
 786	Duration            int                   `json:"mpeg4_duration"`
 787	ThumbURL            string                `json:"thumb_url"`
 788	Title               string                `json:"title"`
 789	Caption             string                `json:"caption"`
 790	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 791	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 792}
 793
 794// InlineQueryResultCachedMpeg4Gif is an inline query response with cached
 795// H.264/MPEG-4 AVC video without sound gif.
 796type InlineQueryResultCachedMpeg4Gif struct {
 797	Type                string                `json:"type"`          // required
 798	ID                  string                `json:"id"`            // required
 799	MGifID              string                `json:"mpeg4_file_id"` // required
 800	Title               string                `json:"title"`
 801	Caption             string                `json:"caption"`
 802	ParseMode           string                `json:"parse_mode"`
 803	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 804	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 805}
 806
 807// InlineQueryResultVideo is an inline query response video.
 808type InlineQueryResultVideo struct {
 809	Type                string                `json:"type"`      // required
 810	ID                  string                `json:"id"`        // required
 811	URL                 string                `json:"video_url"` // required
 812	MimeType            string                `json:"mime_type"` // required
 813	ThumbURL            string                `json:"thumb_url"`
 814	Title               string                `json:"title"`
 815	Caption             string                `json:"caption"`
 816	Width               int                   `json:"video_width"`
 817	Height              int                   `json:"video_height"`
 818	Duration            int                   `json:"video_duration"`
 819	Description         string                `json:"description"`
 820	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 821	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 822}
 823
 824// InlineQueryResultCachedVideo is an inline query response with cached video.
 825type InlineQueryResultCachedVideo struct {
 826	Type                string                `json:"type"`          // required
 827	ID                  string                `json:"id"`            // required
 828	VideoID             string                `json:"video_file_id"` // required
 829	Title               string                `json:"title"`         // required
 830	Description         string                `json:"description"`
 831	Caption             string                `json:"caption"`
 832	ParseMode           string                `json:"parse_mode"`
 833	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 834	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 835}
 836
 837// InlineQueryResultAudio is an inline query response audio.
 838type InlineQueryResultAudio struct {
 839	Type                string                `json:"type"`      // required
 840	ID                  string                `json:"id"`        // required
 841	URL                 string                `json:"audio_url"` // required
 842	Title               string                `json:"title"`     // required
 843	Caption             string                `json:"caption"`
 844	Performer           string                `json:"performer"`
 845	Duration            int                   `json:"audio_duration"`
 846	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 847	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 848}
 849
 850// InlineQueryResultCachedAudio is an inline query response with cached audio.
 851type InlineQueryResultCachedAudio struct {
 852	Type                string                `json:"type"`          // required
 853	ID                  string                `json:"id"`            // required
 854	AudioID             string                `json:"audio_file_id"` // required
 855	Caption             string                `json:"caption"`
 856	ParseMode           string                `json:"parse_mode"`
 857	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 858	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 859}
 860
 861// InlineQueryResultVoice is an inline query response voice.
 862type InlineQueryResultVoice struct {
 863	Type                string                `json:"type"`      // required
 864	ID                  string                `json:"id"`        // required
 865	URL                 string                `json:"voice_url"` // required
 866	Title               string                `json:"title"`     // required
 867	Caption             string                `json:"caption"`
 868	Duration            int                   `json:"voice_duration"`
 869	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 870	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 871}
 872
 873// InlineQueryResultCachedVoice is an inline query response with cached voice.
 874type InlineQueryResultCachedVoice struct {
 875	Type                string                `json:"type"`          // required
 876	ID                  string                `json:"id"`            // required
 877	VoiceID             string                `json:"voice_file_id"` // required
 878	Title               string                `json:"title"`         // required
 879	Caption             string                `json:"caption"`
 880	ParseMode           string                `json:"parse_mode"`
 881	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 882	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 883}
 884
 885// InlineQueryResultDocument is an inline query response document.
 886type InlineQueryResultDocument struct {
 887	Type                string                `json:"type"`  // required
 888	ID                  string                `json:"id"`    // required
 889	Title               string                `json:"title"` // required
 890	Caption             string                `json:"caption"`
 891	URL                 string                `json:"document_url"` // required
 892	MimeType            string                `json:"mime_type"`    // required
 893	Description         string                `json:"description"`
 894	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 895	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 896	ThumbURL            string                `json:"thumb_url"`
 897	ThumbWidth          int                   `json:"thumb_width"`
 898	ThumbHeight         int                   `json:"thumb_height"`
 899}
 900
 901// InlineQueryResultCachedDocument is an inline query response with cached document.
 902type InlineQueryResultCachedDocument struct {
 903	Type                string                `json:"type"`             // required
 904	ID                  string                `json:"id"`               // required
 905	DocumentID          string                `json:"document_file_id"` // required
 906	Title               string                `json:"title"`            // required
 907	Caption             string                `json:"caption"`
 908	Description         string                `json:"description"`
 909	ParseMode           string                `json:"parse_mode"`
 910	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 911	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 912}
 913
 914// InlineQueryResultLocation is an inline query response location.
 915type InlineQueryResultLocation struct {
 916	Type                string                `json:"type"`        // required
 917	ID                  string                `json:"id"`          // required
 918	Latitude            float64               `json:"latitude"`    // required
 919	Longitude           float64               `json:"longitude"`   // required
 920	LivePeriod          int                   `json:"live_period"` // optional
 921	Title               string                `json:"title"`       // required
 922	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 923	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 924	ThumbURL            string                `json:"thumb_url"`
 925	ThumbWidth          int                   `json:"thumb_width"`
 926	ThumbHeight         int                   `json:"thumb_height"`
 927}
 928
 929// InlineQueryResultContact is an inline query response contact.
 930type InlineQueryResultContact struct {
 931	Type                string                `json:"type"`         // required
 932	ID                  string                `json:"id"`           // required
 933	PhoneNumber         string                `json:"phone_number"` // required
 934	FirstName           string                `json:"first_name"`   // required
 935	LastName            string                `json:"last_name"`
 936	VCard               string                `json:"vcard"`
 937	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 938	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 939	ThumbURL            string                `json:"thumb_url"`
 940	ThumbWidth          int                   `json:"thumb_width"`
 941	ThumbHeight         int                   `json:"thumb_height"`
 942}
 943
 944// InlineQueryResultVenue is an inline query response venue.
 945type InlineQueryResultVenue struct {
 946	Type                string                `json:"type"`      // required
 947	ID                  string                `json:"id"`        // required
 948	Latitude            float64               `json:"latitude"`  // required
 949	Longitude           float64               `json:"longitude"` // required
 950	Title               string                `json:"title"`     // required
 951	Address             string                `json:"address"`   // required
 952	FoursquareID        string                `json:"foursquare_id"`
 953	FoursquareType      string                `json:"foursquare_type"`
 954	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 955	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
 956	ThumbURL            string                `json:"thumb_url"`
 957	ThumbWidth          int                   `json:"thumb_width"`
 958	ThumbHeight         int                   `json:"thumb_height"`
 959}
 960
 961// InlineQueryResultGame is an inline query response game.
 962type InlineQueryResultGame struct {
 963	Type          string                `json:"type"`
 964	ID            string                `json:"id"`
 965	GameShortName string                `json:"game_short_name"`
 966	ReplyMarkup   *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 967}
 968
 969// ChosenInlineResult is an inline query result chosen by a User
 970type ChosenInlineResult struct {
 971	ResultID        string    `json:"result_id"`
 972	From            *User     `json:"from"`
 973	Location        *Location `json:"location"`
 974	InlineMessageID string    `json:"inline_message_id"`
 975	Query           string    `json:"query"`
 976}
 977
 978// InputTextMessageContent contains text for displaying
 979// as an inline query result.
 980type InputTextMessageContent struct {
 981	Text                  string `json:"message_text"`
 982	ParseMode             string `json:"parse_mode"`
 983	DisableWebPagePreview bool   `json:"disable_web_page_preview"`
 984}
 985
 986// InputLocationMessageContent contains a location for displaying
 987// as an inline query result.
 988type InputLocationMessageContent struct {
 989	Latitude  float64 `json:"latitude"`
 990	Longitude float64 `json:"longitude"`
 991}
 992
 993// InputVenueMessageContent contains a venue for displaying
 994// as an inline query result.
 995type InputVenueMessageContent struct {
 996	Latitude     float64 `json:"latitude"`
 997	Longitude    float64 `json:"longitude"`
 998	Title        string  `json:"title"`
 999	Address      string  `json:"address"`
1000	FoursquareID string  `json:"foursquare_id"`
1001}
1002
1003// InputContactMessageContent contains a contact for displaying
1004// as an inline query result.
1005type InputContactMessageContent struct {
1006	PhoneNumber string `json:"phone_number"`
1007	FirstName   string `json:"first_name"`
1008	LastName    string `json:"last_name"`
1009	VCard       string `json:"vcard"`
1010}
1011
1012// Invoice contains basic information about an invoice.
1013type Invoice struct {
1014	Title          string `json:"title"`
1015	Description    string `json:"description"`
1016	StartParameter string `json:"start_parameter"`
1017	Currency       string `json:"currency"`
1018	TotalAmount    int    `json:"total_amount"`
1019}
1020
1021// LabeledPrice represents a portion of the price for goods or services.
1022type LabeledPrice struct {
1023	Label  string `json:"label"`
1024	Amount int    `json:"amount"`
1025}
1026
1027// ShippingAddress represents a shipping address.
1028type ShippingAddress struct {
1029	CountryCode string `json:"country_code"`
1030	State       string `json:"state"`
1031	City        string `json:"city"`
1032	StreetLine1 string `json:"street_line1"`
1033	StreetLine2 string `json:"street_line2"`
1034	PostCode    string `json:"post_code"`
1035}
1036
1037// OrderInfo represents information about an order.
1038type OrderInfo struct {
1039	Name            string           `json:"name,omitempty"`
1040	PhoneNumber     string           `json:"phone_number,omitempty"`
1041	Email           string           `json:"email,omitempty"`
1042	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
1043}
1044
1045// ShippingOption represents one shipping option.
1046type ShippingOption struct {
1047	ID     string         `json:"id"`
1048	Title  string         `json:"title"`
1049	Prices []LabeledPrice `json:"prices"`
1050}
1051
1052// SuccessfulPayment contains basic information about a successful payment.
1053type SuccessfulPayment struct {
1054	Currency                string     `json:"currency"`
1055	TotalAmount             int        `json:"total_amount"`
1056	InvoicePayload          string     `json:"invoice_payload"`
1057	ShippingOptionID        string     `json:"shipping_option_id,omitempty"`
1058	OrderInfo               *OrderInfo `json:"order_info,omitempty"`
1059	TelegramPaymentChargeID string     `json:"telegram_payment_charge_id"`
1060	ProviderPaymentChargeID string     `json:"provider_payment_charge_id"`
1061}
1062
1063// ShippingQuery contains information about an incoming shipping query.
1064type ShippingQuery struct {
1065	ID              string           `json:"id"`
1066	From            *User            `json:"from"`
1067	InvoicePayload  string           `json:"invoice_payload"`
1068	ShippingAddress *ShippingAddress `json:"shipping_address"`
1069}
1070
1071// PreCheckoutQuery contains information about an incoming pre-checkout query.
1072type PreCheckoutQuery struct {
1073	ID               string     `json:"id"`
1074	From             *User      `json:"from"`
1075	Currency         string     `json:"currency"`
1076	TotalAmount      int        `json:"total_amount"`
1077	InvoicePayload   string     `json:"invoice_payload"`
1078	ShippingOptionID string     `json:"shipping_option_id,omitempty"`
1079	OrderInfo        *OrderInfo `json:"order_info,omitempty"`
1080}
1081
1082// StickerSet is a collection of stickers.
1083type StickerSet struct {
1084	Name          string     `json:"name"`
1085	Title         string     `json:"title"`
1086	IsAnimated    bool       `json:"is_animated"`
1087	ContainsMasks bool       `json:"contains_masks"`
1088	Stickers      []Sticker  `json:"stickers"`
1089	Thumb         *PhotoSize `json:"thumb"`
1090}
1091
1092// BotCommand represents Telegram's understanding of a command.
1093type BotCommand struct {
1094	Command     string `json:"command"`
1095	Description string `json:"description"`
1096}
1097
1098// BaseInputMedia is a base type for the InputMedia types.
1099type BaseInputMedia struct {
1100	Type      string `json:"type"`
1101	Media     string `json:"media"`
1102	Caption   string `json:"caption"`
1103	ParseMode string `json:"parse_mode"`
1104}
1105
1106// InputMediaPhoto is a photo to send as part of a media group.
1107type InputMediaPhoto struct {
1108	BaseInputMedia
1109}
1110
1111// InputMediaVideo is a video to send as part of a media group.
1112type InputMediaVideo struct {
1113	BaseInputMedia
1114	Width             int  `json:"width"`
1115	Height            int  `json:"height"`
1116	Duration          int  `json:"duration"`
1117	SupportsStreaming bool `json:"supports_streaming"`
1118}
1119
1120// InputMediaAnimation is an animation to send as part of a media group.
1121type InputMediaAnimation struct {
1122	BaseInputMedia
1123	Width    int `json:"width"`
1124	Height   int `json:"height"`
1125	Duration int `json:"duration"`
1126}
1127
1128// InputMediaAudio is a audio to send as part of a media group.
1129type InputMediaAudio struct {
1130	BaseInputMedia
1131	Duration  int    `json:"duration"`
1132	Performer string `json:"performer"`
1133	Title     string `json:"title"`
1134}
1135
1136// InputMediaDocument is a audio to send as part of a media group.
1137type InputMediaDocument struct {
1138	BaseInputMedia
1139}
1140
1141// Error is an error containing extra information returned by the Telegram API.
1142type Error struct {
1143	Code    int
1144	Message string
1145	ResponseParameters
1146}
1147
1148// Error message string.
1149func (e Error) Error() string {
1150	return e.Message
1151}