all repos — telegram-bot-api @ 19e61c78efbe41f0a4aeea0fcd943c495ef733b3

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"`
  17	ErrorCode   int                 `json:"error_code"`
  18	Description string              `json:"description"`
  19	Parameters  *ResponseParameters `json:"parameters"`
  20}
  21
  22// ResponseParameters are various errors that can be returned in APIResponse.
  23type ResponseParameters struct {
  24	MigrateToChatID int64 `json:"migrate_to_chat_id"` // optional
  25	RetryAfter      int   `json:"retry_after"`        // optional
  26}
  27
  28// Update is an update response, from GetUpdates.
  29type Update struct {
  30	// UpdateID is the update's unique identifier.
  31	// Update identifiers start from a certain positive number and increase sequentially.
  32	// This ID becomes especially handy if you're using Webhooks,
  33	// since it allows you to ignore repeated updates or to restore
  34	// the correct update sequence, should they get out of order.
  35	// If there are no new updates for at least a week, then identifier
  36	// of the next update will be chosen randomly instead of sequentially.
  37	UpdateID int `json:"update_id"`
  38	// Message new incoming message of any kind — text, photo, sticker, etc.
  39	//
  40	// optional
  41	Message *Message `json:"message"`
  42	// EditedMessage
  43	//
  44	// optional
  45	EditedMessage *Message `json:"edited_message"`
  46	// ChannelPost new version of a message that is known to the bot and was edited
  47	//
  48	// optional
  49	ChannelPost *Message `json:"channel_post"`
  50	// EditedChannelPost new incoming channel post of any kind — text, photo, sticker, etc.
  51	//
  52	// optional
  53	EditedChannelPost *Message `json:"edited_channel_post"`
  54	// InlineQuery new incoming inline query
  55	//
  56	// optional
  57	InlineQuery *InlineQuery `json:"inline_query"`
  58	// ChosenInlineResult is the result of an inline query
  59	// that was chosen by a user and sent to their chat partner.
  60	// Please see our documentation on the feedback collecting
  61	// for details on how to enable these updates for your bot.
  62	//
  63	// optional
  64	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result"`
  65	// CallbackQuery new incoming callback query
  66	//
  67	// optional
  68	CallbackQuery *CallbackQuery `json:"callback_query"`
  69	// ShippingQuery new incoming shipping query. Only for invoices with flexible price
  70	//
  71	// optional
  72	ShippingQuery *ShippingQuery `json:"shipping_query"`
  73	// PreCheckoutQuery new incoming pre-checkout query. Contains full information about checkout
  74	//
  75	// optional
  76	PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query"`
  77}
  78
  79// UpdatesChannel is the channel for getting updates.
  80type UpdatesChannel <-chan Update
  81
  82// Clear discards all unprocessed incoming updates.
  83func (ch UpdatesChannel) Clear() {
  84	for len(ch) != 0 {
  85		<-ch
  86	}
  87}
  88
  89// User represents a Telegram user or bot.
  90type User struct {
  91	// ID is a unique identifier for this user or bot
  92	ID int `json:"id"`
  93	// FirstName user's or bot's first name
  94	FirstName string `json:"first_name"`
  95	// LastName user's or bot's last name
  96	//
  97	// optional
  98	LastName string `json:"last_name"`
  99	// UserName user's or bot's username
 100	//
 101	// optional
 102	UserName string `json:"username"`
 103	// LanguageCode IETF language tag of the user's language
 104	// more info: https://en.wikipedia.org/wiki/IETF_language_tag
 105	//
 106	// optional
 107	LanguageCode string `json:"language_code"`
 108	// IsBot true, if this user is a bot
 109	//
 110	// optional
 111	IsBot bool `json:"is_bot"`
 112}
 113
 114// String displays a simple text version of a user.
 115//
 116// It is normally a user's username, but falls back to a first/last
 117// name as available.
 118func (u *User) String() string {
 119	if u == nil {
 120		return ""
 121	}
 122	if u.UserName != "" {
 123		return u.UserName
 124	}
 125
 126	name := u.FirstName
 127	if u.LastName != "" {
 128		name += " " + u.LastName
 129	}
 130
 131	return name
 132}
 133
 134// GroupChat is a group chat.
 135type GroupChat struct {
 136	ID    int    `json:"id"`
 137	Title string `json:"title"`
 138}
 139
 140// ChatPhoto represents a chat photo.
 141type ChatPhoto struct {
 142	// SmallFileID is a file identifier of small (160x160) chat photo.
 143	// This file_id can be used only for photo download and
 144	// only for as long as the photo is not changed.
 145	SmallFileID string `json:"small_file_id"`
 146	// BigFileID is a file identifier of big (640x640) chat photo.
 147	// This file_id can be used only for photo download and
 148	// only for as long as the photo is not changed.
 149	BigFileID string `json:"big_file_id"`
 150}
 151
 152// Chat contains information about the place a message was sent.
 153type Chat struct {
 154	// ID is a unique identifier for this chat
 155	ID int64 `json:"id"`
 156	// Type of chat, can be either “private”, “group”, “supergroup” or “channel”
 157	Type string `json:"type"`
 158	// Title for supergroups, channels and group chats
 159	//
 160	// optional
 161	Title string `json:"title"`
 162	// UserName for private chats, supergroups and channels if available
 163	//
 164	// optional
 165	UserName string `json:"username"`
 166	// FirstName of the other party in a private chat
 167	//
 168	// optional
 169	FirstName string `json:"first_name"`
 170	// LastName of the other party in a private chat
 171	//
 172	// optional
 173	LastName string `json:"last_name"`
 174	// AllMembersAreAdmins
 175	//
 176	// optional
 177	AllMembersAreAdmins bool `json:"all_members_are_administrators"`
 178	// Photo is a chat photo
 179	Photo *ChatPhoto `json:"photo"`
 180	// Description for groups, supergroups and channel chats
 181	//
 182	// optional
 183	Description string `json:"description,omitempty"`
 184	// InviteLink is a chat invite link, for groups, supergroups and channel chats.
 185	// Each administrator in a chat generates their own invite links,
 186	// so the bot must first generate the link using exportChatInviteLink
 187	//
 188	// optional
 189	InviteLink string `json:"invite_link,omitempty"`
 190	// PinnedMessage Pinned message, for groups, supergroups and channels
 191	//
 192	// optional
 193	PinnedMessage *Message `json:"pinned_message"`
 194}
 195
 196// IsPrivate returns if the Chat is a private conversation.
 197func (c Chat) IsPrivate() bool {
 198	return c.Type == "private"
 199}
 200
 201// IsGroup returns if the Chat is a group.
 202func (c Chat) IsGroup() bool {
 203	return c.Type == "group"
 204}
 205
 206// IsSuperGroup returns if the Chat is a supergroup.
 207func (c Chat) IsSuperGroup() bool {
 208	return c.Type == "supergroup"
 209}
 210
 211// IsChannel returns if the Chat is a channel.
 212func (c Chat) IsChannel() bool {
 213	return c.Type == "channel"
 214}
 215
 216// ChatConfig returns a ChatConfig struct for chat related methods.
 217func (c Chat) ChatConfig() ChatConfig {
 218	return ChatConfig{ChatID: c.ID}
 219}
 220
 221// Message is returned by almost every request, and contains data about
 222// almost anything.
 223type Message struct {
 224	// MessageID is a unique message identifier inside this chat
 225	MessageID int `json:"message_id"`
 226	// From is a sender, empty for messages sent to channels;
 227	//
 228	// optional
 229	From *User `json:"from"`
 230	// Date of the message was sent in Unix time
 231	Date int `json:"date"`
 232	// Chat is the conversation the message belongs to
 233	Chat *Chat `json:"chat"`
 234	// ForwardFrom for forwarded messages, sender of the original message;
 235	//
 236	// optional
 237	ForwardFrom *User `json:"forward_from"`
 238	// ForwardFromChat for messages forwarded from channels,
 239	// information about the original channel;
 240	//
 241	// optional
 242	ForwardFromChat *Chat `json:"forward_from_chat"`
 243	// ForwardFromMessageID for messages forwarded from channels,
 244	// identifier of the original message in the channel;
 245	//
 246	// optional
 247	ForwardFromMessageID int `json:"forward_from_message_id"`
 248	// ForwardDate for forwarded messages, date the original message was sent in Unix time;
 249	//
 250	// optional
 251	ForwardDate int `json:"forward_date"`
 252	// ReplyToMessage for replies, the original message.
 253	// Note that the Message object in this field will not contain further ReplyToMessage fields
 254	// even if it itself is a reply;
 255	//
 256	// optional
 257	ReplyToMessage *Message `json:"reply_to_message"`
 258	// ViaBot through which the message was sent;
 259	//
 260	// optional
 261	ViaBot *User `json:"via_bot"`
 262	// EditDate of the message was last edited in Unix time;
 263	//
 264	// optional
 265	EditDate int `json:"edit_date"`
 266	// MediaGroupID is the unique identifier of a media message group this message belongs to;
 267	//
 268	// optional
 269	MediaGroupID string `json:"media_group_id"`
 270	// AuthorSignature is the signature of the post author for messages in channels;
 271	//
 272	// optional
 273	AuthorSignature string `json:"author_signature"`
 274	// Text is for text messages, the actual UTF-8 text of the message, 0-4096 characters;
 275	//
 276	// optional
 277	Text string `json:"text"`
 278	// Entities is for text messages, special entities like usernames,
 279	// URLs, bot commands, etc. that appear in the text;
 280	//
 281	// optional
 282	Entities *[]MessageEntity `json:"entities"`
 283	// CaptionEntities;
 284	//
 285	// optional
 286	CaptionEntities *[]MessageEntity `json:"caption_entities"`
 287	// Audio message is an audio file, information about the file;
 288	//
 289	// optional
 290	Audio *Audio `json:"audio"`
 291	// Document message is a general file, information about the file;
 292	//
 293	// optional
 294	Document *Document `json:"document"`
 295	// Animation message is an animation, information about the animation.
 296	// For backward compatibility, when this field is set, the document field will also be set;
 297	//
 298	// optional
 299	Animation *ChatAnimation `json:"animation"`
 300	// Game message is a game, information about the game;
 301	//
 302	// optional
 303	Game *Game `json:"game"`
 304	// Photo message is a photo, available sizes of the photo;
 305	//
 306	// optional
 307	Photo *[]PhotoSize `json:"photo"`
 308	// Sticker message is a sticker, information about the sticker;
 309	//
 310	// optional
 311	Sticker *Sticker `json:"sticker"`
 312	// Video message is a video, information about the video;
 313	//
 314	// optional
 315	Video *Video `json:"video"`
 316	// VideoNote message is a video note, information about the video message;
 317	//
 318	// optional
 319	VideoNote *VideoNote `json:"video_note"`
 320	// Voice message is a voice message, information about the file;
 321	//
 322	// optional
 323	Voice *Voice `json:"voice"`
 324	// Caption for the animation, audio, document, photo, video or voice, 0-1024 characters;
 325	//
 326	// optional
 327	Caption string `json:"caption"`
 328	// Contact message is a shared contact, information about the contact;
 329	//
 330	// optional
 331	Contact *Contact `json:"contact"`
 332	// Location message is a shared location, information about the location;
 333	//
 334	// optional
 335	Location *Location `json:"location"`
 336	// Venue message is a venue, information about the venue.
 337	// For backward compatibility, when this field is set, the location field will also be set;
 338	//
 339	// optional
 340	Venue *Venue `json:"venue"`
 341	// NewChatMembers that were added to the group or supergroup
 342	// and information about them (the bot itself may be one of these members);
 343	//
 344	// optional
 345	NewChatMembers *[]User `json:"new_chat_members"`
 346	// LeftChatMember is a member was removed from the group,
 347	// information about them (this member may be the bot itself);
 348	//
 349	// optional
 350	LeftChatMember *User `json:"left_chat_member"`
 351	// NewChatTitle is a chat title was changed to this value;
 352	//
 353	// optional
 354	NewChatTitle string `json:"new_chat_title"`
 355	// NewChatPhoto is a chat photo was change to this value;
 356	//
 357	// optional
 358	NewChatPhoto *[]PhotoSize `json:"new_chat_photo"`
 359	// DeleteChatPhoto is a service message: the chat photo was deleted;
 360	//
 361	// optional
 362	DeleteChatPhoto bool `json:"delete_chat_photo"`
 363	// GroupChatCreated is a service message: the group has been created;
 364	//
 365	// optional
 366	GroupChatCreated bool `json:"group_chat_created"`
 367	// SuperGroupChatCreated is a service message: the supergroup has been created.
 368	// This field can't be received in a message coming through updates,
 369	// because bot can't be a member of a supergroup when it is created.
 370	// It can only be found in ReplyToMessage if someone replies to a very first message
 371	// in a directly created supergroup;
 372	//
 373	// optional
 374	SuperGroupChatCreated bool `json:"supergroup_chat_created"`
 375	// ChannelChatCreated is a service message: the channel has been created.
 376	// This field can't be received in a message coming through updates,
 377	// because bot can't be a member of a channel when it is created.
 378	// It can only be found in ReplyToMessage
 379	// if someone replies to a very first message in a channel;
 380	//
 381	// optional
 382	ChannelChatCreated bool `json:"channel_chat_created"`
 383	// MigrateToChatID is the group has been migrated to a supergroup with the specified identifier.
 384	// This number may be greater than 32 bits and some programming languages
 385	// may have difficulty/silent defects in interpreting it.
 386	// But it is smaller than 52 bits, so a signed 64 bit integer
 387	// or double-precision float type are safe for storing this identifier;
 388	//
 389	// optional
 390	MigrateToChatID int64 `json:"migrate_to_chat_id"`
 391	// MigrateFromChatID is the supergroup has been migrated from a group with the specified identifier.
 392	// This number may be greater than 32 bits and some programming languages
 393	// may have difficulty/silent defects in interpreting it.
 394	// But it is smaller than 52 bits, so a signed 64 bit integer
 395	// or double-precision float type are safe for storing this identifier;
 396	//
 397	// optional
 398	MigrateFromChatID int64 `json:"migrate_from_chat_id"`
 399	// PinnedMessage is a specified message was pinned.
 400	// Note that the Message object in this field will not contain further ReplyToMessage
 401	// fields even if it is itself a reply;
 402	//
 403	// optional
 404	PinnedMessage *Message `json:"pinned_message"`
 405	// Invoice message is an invoice for a payment;
 406	//
 407	// optional
 408	Invoice *Invoice `json:"invoice"`
 409	// SuccessfulPayment message is a service message about a successful payment,
 410	// information about the payment;
 411	//
 412	// optional
 413	SuccessfulPayment *SuccessfulPayment `json:"successful_payment"`
 414	// PassportData is a Telegram Passport data;
 415	//
 416	// optional
 417	PassportData *PassportData `json:"passport_data,omitempty"`
 418}
 419
 420// Time converts the message timestamp into a Time.
 421func (m *Message) Time() time.Time {
 422	return time.Unix(int64(m.Date), 0)
 423}
 424
 425// IsCommand returns true if message starts with a "bot_command" entity.
 426func (m *Message) IsCommand() bool {
 427	if m.Entities == nil || len(*m.Entities) == 0 {
 428		return false
 429	}
 430
 431	entity := (*m.Entities)[0]
 432	return entity.Offset == 0 && entity.IsCommand()
 433}
 434
 435// Command checks if the message was a command and if it was, returns the
 436// command. If the Message was not a command, it returns an empty string.
 437//
 438// If the command contains the at name syntax, it is removed. Use
 439// CommandWithAt() if you do not want that.
 440func (m *Message) Command() string {
 441	command := m.CommandWithAt()
 442
 443	if i := strings.Index(command, "@"); i != -1 {
 444		command = command[:i]
 445	}
 446
 447	return command
 448}
 449
 450// CommandWithAt checks if the message was a command and if it was, returns the
 451// command. If the Message was not a command, it returns an empty string.
 452//
 453// If the command contains the at name syntax, it is not removed. Use Command()
 454// if you want that.
 455func (m *Message) CommandWithAt() string {
 456	if !m.IsCommand() {
 457		return ""
 458	}
 459
 460	// IsCommand() checks that the message begins with a bot_command entity
 461	entity := (*m.Entities)[0]
 462	return m.Text[1:entity.Length]
 463}
 464
 465// CommandArguments checks if the message was a command and if it was,
 466// returns all text after the command name. If the Message was not a
 467// command, it returns an empty string.
 468//
 469// Note: The first character after the command name is omitted:
 470// - "/foo bar baz" yields "bar baz", not " bar baz"
 471// - "/foo-bar baz" yields "bar baz", too
 472// Even though the latter is not a command conforming to the spec, the API
 473// marks "/foo" as command entity.
 474func (m *Message) CommandArguments() string {
 475	if !m.IsCommand() {
 476		return ""
 477	}
 478
 479	// IsCommand() checks that the message begins with a bot_command entity
 480	entity := (*m.Entities)[0]
 481	if len(m.Text) == entity.Length {
 482		return "" // The command makes up the whole message
 483	}
 484
 485	return m.Text[entity.Length+1:]
 486}
 487
 488// MessageEntity contains information about data in a Message.
 489type MessageEntity struct {
 490	// Type of the entity.
 491	// Can be:
 492	//  “mention” (@username),
 493	//  “hashtag” (#hashtag),
 494	//  “cashtag” ($USD),
 495	//  “bot_command” (/start@jobs_bot),
 496	//  “url” (https://telegram.org),
 497	//  “email” (do-not-reply@telegram.org),
 498	//  “phone_number” (+1-212-555-0123),
 499	//  “bold” (bold text),
 500	//  “italic” (italic text),
 501	//  “underline” (underlined text),
 502	//  “strikethrough” (strikethrough text),
 503	//  “code” (monowidth string),
 504	//  “pre” (monowidth block),
 505	//  “text_link” (for clickable text URLs),
 506	//  “text_mention” (for users without usernames)
 507	Type string `json:"type"`
 508	// Offset in UTF-16 code units to the start of the entity
 509	Offset int `json:"offset"`
 510	// Length
 511	Length int `json:"length"`
 512	// URL for “text_link” only, url that will be opened after user taps on the text
 513	//
 514	// optional
 515	URL string `json:"url"`
 516	// User for “text_mention” only, the mentioned user
 517	//
 518	// optional
 519	User *User `json:"user"`
 520}
 521
 522// ParseURL attempts to parse a URL contained within a MessageEntity.
 523func (e MessageEntity) ParseURL() (*url.URL, error) {
 524	if e.URL == "" {
 525		return nil, errors.New(ErrBadURL)
 526	}
 527
 528	return url.Parse(e.URL)
 529}
 530
 531// IsMention returns true if the type of the message entity is "mention" (@username).
 532func (e MessageEntity) IsMention() bool {
 533	return e.Type == "mention"
 534}
 535
 536// IsHashtag returns true if the type of the message entity is "hashtag".
 537func (e MessageEntity) IsHashtag() bool {
 538	return e.Type == "hashtag"
 539}
 540
 541// IsCommand returns true if the type of the message entity is "bot_command".
 542func (e MessageEntity) IsCommand() bool {
 543	return e.Type == "bot_command"
 544}
 545
 546// IsUrl returns true if the type of the message entity is "url".
 547func (e MessageEntity) IsUrl() bool {
 548	return e.Type == "url"
 549}
 550
 551// IsEmail returns true if the type of the message entity is "email".
 552func (e MessageEntity) IsEmail() bool {
 553	return e.Type == "email"
 554}
 555
 556// IsBold returns true if the type of the message entity is "bold" (bold text).
 557func (e MessageEntity) IsBold() bool {
 558	return e.Type == "bold"
 559}
 560
 561// IsItalic returns true if the type of the message entity is "italic" (italic text).
 562func (e MessageEntity) IsItalic() bool {
 563	return e.Type == "italic"
 564}
 565
 566// IsCode returns true if the type of the message entity is "code" (monowidth string).
 567func (e MessageEntity) IsCode() bool {
 568	return e.Type == "code"
 569}
 570
 571// IsPre returns true if the type of the message entity is "pre" (monowidth block).
 572func (e MessageEntity) IsPre() bool {
 573	return e.Type == "pre"
 574}
 575
 576// IsTextLink returns true if the type of the message entity is "text_link" (clickable text URL).
 577func (e MessageEntity) IsTextLink() bool {
 578	return e.Type == "text_link"
 579}
 580
 581// PhotoSize contains information about photos.
 582type PhotoSize struct {
 583	// FileID identifier for this file, which can be used to download or reuse the file
 584	FileID string `json:"file_id"`
 585	// Width photo width
 586	Width int `json:"width"`
 587	// Height photo height
 588	Height int `json:"height"`
 589	// FileSize file size
 590	//
 591	// optional
 592	FileSize int `json:"file_size"`
 593}
 594
 595// Audio contains information about audio.
 596type Audio struct {
 597	// FileID is an identifier for this file, which can be used to download or reuse the file
 598	FileID string `json:"file_id"`
 599	// Duration of the audio in seconds as defined by sender
 600	Duration int `json:"duration"`
 601	// Performer of the audio as defined by sender or by audio tags
 602	//
 603	// optional
 604	Performer string `json:"performer"`
 605	// Title of the audio as defined by sender or by audio tags
 606	//
 607	// optional
 608	Title string `json:"title"`
 609	// MimeType of the file as defined by sender
 610	//
 611	// optional
 612	MimeType string `json:"mime_type"`
 613	// FileSize file size
 614	//
 615	// optional
 616	FileSize int `json:"file_size"`
 617}
 618
 619// Document contains information about a document.
 620type Document struct {
 621	// FileID is a identifier for this file, which can be used to download or reuse the file
 622	FileID string `json:"file_id"`
 623	// Thumbnail document thumbnail as defined by sender
 624	//
 625	// optional
 626	Thumbnail *PhotoSize `json:"thumb"`
 627	// FileName original filename as defined by sender
 628	//
 629	// optional
 630	FileName string `json:"file_name"`
 631	// MimeType  of the file as defined by sender
 632	//
 633	// optional
 634	MimeType string `json:"mime_type"`
 635	// FileSize file size
 636	//
 637	// optional
 638	FileSize int `json:"file_size"`
 639}
 640
 641// Sticker contains information about a sticker.
 642type Sticker struct {
 643	// FileUniqueID is an unique identifier for this file,
 644	// which is supposed to be the same over time and for different bots.
 645	// Can't be used to download or reuse the file.
 646	FileUniqueID string `json:"file_unique_id"`
 647	// FileID is an identifier for this file, which can be used to download or reuse the file
 648	FileID string `json:"file_id"`
 649	// Width sticker width
 650	Width int `json:"width"`
 651	// Height sticker height
 652	Height int `json:"height"`
 653	// Thumbnail sticker thumbnail in the .WEBP or .JPG format
 654	//
 655	// optional
 656	Thumbnail *PhotoSize `json:"thumb"`
 657	// Emoji associated with the sticker
 658	//
 659	// optional
 660	Emoji string `json:"emoji"`
 661	// FileSize
 662	//
 663	// optional
 664	FileSize int `json:"file_size"`
 665	// SetName of the sticker set to which the sticker belongs
 666	//
 667	// optional
 668	SetName string `json:"set_name"`
 669	// IsAnimated true, if the sticker is animated
 670	//
 671	// optional
 672	IsAnimated bool `json:"is_animated"`
 673}
 674
 675// StickerSet contains information about an sticker set.
 676type StickerSet struct {
 677	// Name sticker set name
 678	Name string `json:"name"`
 679	// Title sticker set title
 680	Title string `json:"title"`
 681	// IsAnimated true, if the sticker set contains animated stickers
 682	IsAnimated bool `json:"is_animated"`
 683	// ContainsMasks true, if the sticker set contains masks
 684	ContainsMasks bool `json:"contains_masks"`
 685	// Stickers list of all set stickers
 686	Stickers []Sticker `json:"stickers"`
 687}
 688
 689// ChatAnimation contains information about an animation.
 690type ChatAnimation struct {
 691	// FileID odentifier for this file, which can be used to download or reuse the file
 692	FileID string `json:"file_id"`
 693	// Width video width as defined by sender
 694	Width int `json:"width"`
 695	// Height video height as defined by sender
 696	Height int `json:"height"`
 697	// Duration of the video in seconds as defined by sender
 698	Duration int `json:"duration"`
 699	// Thumbnail animation thumbnail as defined by sender
 700	//
 701	// optional
 702	Thumbnail *PhotoSize `json:"thumb"`
 703	// FileName original animation filename as defined by sender
 704	//
 705	// optional
 706	FileName string `json:"file_name"`
 707	// MimeType of the file as defined by sender
 708	//
 709	// optional
 710	MimeType string `json:"mime_type"`
 711	// FileSize file size
 712	//
 713	// optional
 714	FileSize int `json:"file_size"`
 715}
 716
 717// Video contains information about a video.
 718type Video struct {
 719	// FileID identifier for this file, which can be used to download or reuse the file
 720	FileID string `json:"file_id"`
 721	// Width video width as defined by sender
 722	Width int `json:"width"`
 723	// Height video height as defined by sender
 724	Height int `json:"height"`
 725	// Duration of the video in seconds as defined by sender
 726	Duration int `json:"duration"`
 727	// Thumbnail video thumbnail
 728	//
 729	// optional
 730	Thumbnail *PhotoSize `json:"thumb"`
 731	// MimeType of a file as defined by sender
 732	//
 733	// optional
 734	MimeType string `json:"mime_type"`
 735	// FileSize file size
 736	//
 737	// optional
 738	FileSize int `json:"file_size"`
 739}
 740
 741// VideoNote contains information about a video.
 742type VideoNote struct {
 743	// FileID identifier for this file, which can be used to download or reuse the file
 744	FileID string `json:"file_id"`
 745	// Length video width and height (diameter of the video message) as defined by sender
 746	Length int `json:"length"`
 747	// Duration of the video in seconds as defined by sender
 748	Duration int `json:"duration"`
 749	// Thumbnail video thumbnail
 750	//
 751	// optional
 752	Thumbnail *PhotoSize `json:"thumb"`
 753	// FileSize file size
 754	//
 755	// optional
 756	FileSize int `json:"file_size"`
 757}
 758
 759// Voice contains information about a voice.
 760type Voice struct {
 761	// FileID identifier for this file, which can be used to download or reuse the file
 762	FileID string `json:"file_id"`
 763	// Duration of the audio in seconds as defined by sender
 764	Duration int `json:"duration"`
 765	// MimeType of the file as defined by sender
 766	//
 767	// optional
 768	MimeType string `json:"mime_type"`
 769	// FileSize file size
 770	//
 771	// optional
 772	FileSize int `json:"file_size"`
 773}
 774
 775// Contact contains information about a contact.
 776//
 777// Note that LastName and UserID may be empty.
 778type Contact struct {
 779	// PhoneNumber contact's phone number
 780	PhoneNumber string `json:"phone_number"`
 781	// FirstName contact's first name
 782	FirstName string `json:"first_name"`
 783	// LastName contact's last name
 784	//
 785	// optional
 786	LastName string `json:"last_name"`
 787	// UserID contact's user identifier in Telegram
 788	//
 789	// optional
 790	UserID int `json:"user_id"`
 791}
 792
 793// Location contains information about a place.
 794type Location struct {
 795	// Longitude as defined by sender
 796	Longitude float64 `json:"longitude"`
 797	// Latitude as defined by sender
 798	Latitude float64 `json:"latitude"`
 799}
 800
 801// Venue contains information about a venue, including its Location.
 802type Venue struct {
 803	// Location venue location
 804	Location Location `json:"location"`
 805	// Title name of the venue
 806	Title string `json:"title"`
 807	// Address of the venue
 808	Address string `json:"address"`
 809	// FoursquareID foursquare identifier of the venue
 810	//
 811	// optional
 812	FoursquareID string `json:"foursquare_id"`
 813}
 814
 815// UserProfilePhotos contains a set of user profile photos.
 816type UserProfilePhotos struct {
 817	// TotalCount total number of profile pictures the target user has
 818	TotalCount int `json:"total_count"`
 819	// Photos requested profile pictures (in up to 4 sizes each)
 820	Photos [][]PhotoSize `json:"photos"`
 821}
 822
 823// File contains information about a file to download from Telegram.
 824type File struct {
 825	// FileID identifier for this file, which can be used to download or reuse the file
 826	FileID string `json:"file_id"`
 827	// FileSize file size, if known
 828	//
 829	// optional
 830	FileSize int `json:"file_size"`
 831	// FilePath file path
 832	//
 833	// optional
 834	FilePath string `json:"file_path"`
 835}
 836
 837// Link returns a full path to the download URL for a File.
 838//
 839// It requires the Bot Token to create the link.
 840func (f *File) Link(token string) string {
 841	return fmt.Sprintf(FileEndpoint, token, f.FilePath)
 842}
 843
 844// ReplyKeyboardMarkup allows the Bot to set a custom keyboard.
 845type ReplyKeyboardMarkup struct {
 846	// Keyboard is an array of button rows, each represented by an Array of KeyboardButton objects
 847	Keyboard [][]KeyboardButton `json:"keyboard"`
 848	// ResizeKeyboard requests clients to resize the keyboard vertically for optimal fit
 849	// (e.g., make the keyboard smaller if there are just two rows of buttons).
 850	// Defaults to false, in which case the custom keyboard
 851	// is always of the same height as the app's standard keyboard.
 852	//
 853	// optional
 854	ResizeKeyboard bool `json:"resize_keyboard"`
 855	// OneTimeKeyboard requests clients to hide the keyboard as soon as it's been used.
 856	// The keyboard will still be available, but clients will automatically display
 857	// the usual letter-keyboard in the chat – the user can press a special button
 858	// in the input field to see the custom keyboard again.
 859	// Defaults to false.
 860	//
 861	// optional
 862	OneTimeKeyboard bool `json:"one_time_keyboard"`
 863	// Selective use this parameter if you want to show the keyboard to specific users only.
 864	// Targets:
 865	//  1) users that are @mentioned in the text of the Message object;
 866	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
 867	//
 868	// Example: A user requests to change the bot's language,
 869	// bot replies to the request with a keyboard to select the new language.
 870	// Other users in the group don't see the keyboard.
 871	//
 872	// optional
 873	Selective bool `json:"selective"`
 874}
 875
 876// KeyboardButton is a button within a custom keyboard.
 877type KeyboardButton struct {
 878	// Text of the button. If none of the optional fields are used,
 879	// it will be sent as a message when the button is pressed.
 880	Text string `json:"text"`
 881	// RequestContact if True, the user's phone number will be sent
 882	// as a contact when the button is pressed.
 883	// Available in private chats only.
 884	//
 885	// optional
 886	RequestContact bool `json:"request_contact"`
 887	// RequestLocation if True, the user's current location will be sent when the button is pressed.
 888	// Available in private chats only.
 889	//
 890	// optional
 891	RequestLocation bool `json:"request_location"`
 892}
 893
 894// ReplyKeyboardHide allows the Bot to hide a custom keyboard.
 895type ReplyKeyboardHide struct {
 896	HideKeyboard bool `json:"hide_keyboard"`
 897	Selective    bool `json:"selective"` // optional
 898}
 899
 900// ReplyKeyboardRemove allows the Bot to hide a custom keyboard.
 901type ReplyKeyboardRemove struct {
 902	// RemoveKeyboard requests clients to remove the custom keyboard
 903	// (user will not be able to summon this keyboard;
 904	// if you want to hide the keyboard from sight but keep it accessible,
 905	// use one_time_keyboard in ReplyKeyboardMarkup).
 906	RemoveKeyboard bool `json:"remove_keyboard"`
 907	// Selective use this parameter if you want to remove the keyboard for specific users only.
 908	// Targets:
 909	//  1) users that are @mentioned in the text of the Message object;
 910	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
 911	//
 912	// Example: A user votes in a poll, bot returns confirmation message
 913	// in reply to the vote and removes the keyboard for that user,
 914	// while still showing the keyboard with poll options to users who haven't voted yet.
 915	//
 916	// optional
 917	Selective bool `json:"selective"`
 918}
 919
 920// InlineKeyboardMarkup is a custom keyboard presented for an inline bot.
 921type InlineKeyboardMarkup struct {
 922	// InlineKeyboard array of button rows, each represented by an Array of InlineKeyboardButton objects
 923	InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
 924}
 925
 926// InlineKeyboardButton is a button within a custom keyboard for
 927// inline query responses.
 928//
 929// Note that some values are references as even an empty string
 930// will change behavior.
 931//
 932// CallbackGame, if set, MUST be first button in first row.
 933type InlineKeyboardButton struct {
 934	// Text label text on the button
 935	Text string `json:"text"`
 936	// URL HTTP or tg:// url to be opened when button is pressed.
 937	//
 938	// optional
 939	URL *string `json:"url,omitempty"`
 940	// CallbackData data to be sent in a callback query to the bot when button is pressed, 1-64 bytes.
 941	//
 942	// optional
 943	CallbackData *string `json:"callback_data,omitempty"`
 944	// SwitchInlineQuery if set, pressing the button will prompt the user to select one of their chats,
 945	// open that chat and insert the bot's username and the specified inline query in the input field.
 946	// Can be empty, in which case just the bot's username will be inserted.
 947	//
 948	// This offers an easy way for users to start using your bot
 949	// in inline mode when they are currently in a private chat with it.
 950	// Especially useful when combined with switch_pm… actions – in this case
 951	// the user will be automatically returned to the chat they switched from,
 952	// skipping the chat selection screen.
 953	//
 954	// optional
 955	SwitchInlineQuery *string `json:"switch_inline_query,omitempty"`
 956	// SwitchInlineQueryCurrentChat if set, pressing the button will insert the bot's username
 957	// and the specified inline query in the current chat's input field.
 958	// Can be empty, in which case only the bot's username will be inserted.
 959	//
 960	// This offers a quick way for the user to open your bot in inline mode
 961	// in the same chat – good for selecting something from multiple options.
 962	//
 963	// optional
 964	SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"`
 965	// CallbackGame description of the game that will be launched when the user presses the button.
 966	//
 967	// optional
 968	CallbackGame *CallbackGame `json:"callback_game,omitempty"`
 969	// Pay specify True, to send a Pay button.
 970	//
 971	// NOTE: This type of button must always be the first button in the first row.
 972	//
 973	// optional
 974	Pay bool `json:"pay,omitempty"`
 975}
 976
 977// CallbackQuery is data sent when a keyboard button with callback data
 978// is clicked.
 979type CallbackQuery struct {
 980	// ID unique identifier for this query
 981	ID string `json:"id"`
 982	// From sender
 983	From *User `json:"from"`
 984	// Message with the callback button that originated the query.
 985	// Note that message content and message date will not be available if the message is too old.
 986	//
 987	// optional
 988	Message *Message `json:"message"`
 989	// InlineMessageID identifier of the message sent via the bot in inline mode, that originated the query.
 990	//
 991	// optional
 992	//
 993	InlineMessageID string `json:"inline_message_id"`
 994	// ChatInstance global identifier, uniquely corresponding to the chat to which
 995	// the message with the callback button was sent. Useful for high scores in games.
 996	//
 997	ChatInstance string `json:"chat_instance"`
 998	// Data associated with the callback button. Be aware that
 999	// a bad client can send arbitrary data in this field.
1000	//
1001	// optional
1002	Data string `json:"data"`
1003	// GameShortName short name of a Game to be returned, serves as the unique identifier for the game.
1004	//
1005	// optional
1006	GameShortName string `json:"game_short_name"`
1007}
1008
1009// ForceReply allows the Bot to have users directly reply to it without
1010// additional interaction.
1011type ForceReply struct {
1012	// ForceReply shows reply interface to the user,
1013	// as if they manually selected the bot's message and tapped 'Reply'.
1014	ForceReply bool `json:"force_reply"`
1015	// Selective use this parameter if you want to force reply from specific users only.
1016	// Targets:
1017	//  1) users that are @mentioned in the text of the Message object;
1018	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
1019	//
1020	// optional
1021	Selective bool `json:"selective"`
1022}
1023
1024// ChatMember is information about a member in a chat.
1025type ChatMember struct {
1026	// User information about the user
1027	User *User `json:"user"`
1028	// Status the member's status in the chat.
1029	// Can be
1030	//  “creator”,
1031	//  “administrator”,
1032	//  “member”,
1033	//  “restricted”,
1034	//  “left” or
1035	//  “kicked”
1036	Status string `json:"status"`
1037	// CustomTitle owner and administrators only. Custom title for this user
1038	//
1039	// optional
1040	CustomTitle string `json:"custom_title,omitempty"`
1041	// UntilDate restricted and kicked only.
1042	// Date when restrictions will be lifted for this user;
1043	// unix time.
1044	//
1045	// optional
1046	UntilDate int64 `json:"until_date,omitempty"`
1047	// CanBeEdited administrators only.
1048	// True, if the bot is allowed to edit administrator privileges of that user.
1049	//
1050	// optional
1051	CanBeEdited bool `json:"can_be_edited,omitempty"`
1052	// CanChangeInfo administrators and restricted only.
1053	// True, if the user is allowed to change the chat title, photo and other settings.
1054	//
1055	// optional
1056	CanChangeInfo bool `json:"can_change_info,omitempty"`
1057	// CanChangeInfo administrators only.
1058	// True, if the administrator can post in the channel;
1059	// channels only.
1060	//
1061	// optional
1062	CanPostMessages bool `json:"can_post_messages,omitempty"`
1063	// CanEditMessages administrators only.
1064	// True, if the administrator can edit messages of other users and can pin messages;
1065	// channels only.
1066	//
1067	// optional
1068	CanEditMessages bool `json:"can_edit_messages,omitempty"`
1069	// CanDeleteMessages administrators only.
1070	// True, if the administrator can delete messages of other users.
1071	//
1072	// optional
1073	CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
1074	// CanInviteUsers administrators and restricted only.
1075	// True, if the user is allowed to invite new users to the chat.
1076	//
1077	// optional
1078	CanInviteUsers bool `json:"can_invite_users,omitempty"`
1079	// CanRestrictMembers administrators only.
1080	// True, if the administrator can restrict, ban or unban chat members.
1081	//
1082	// optional
1083	CanRestrictMembers bool `json:"can_restrict_members,omitempty"`
1084	// CanPinMessages
1085	//
1086	// optional
1087	CanPinMessages bool `json:"can_pin_messages,omitempty"`
1088	// CanPromoteMembers administrators only.
1089	// True, if the administrator can add new administrators
1090	// with a subset of their own privileges or demote administrators that he has promoted,
1091	// directly or indirectly (promoted by administrators that were appointed by the user).
1092	//
1093	// optional
1094	CanPromoteMembers bool `json:"can_promote_members,omitempty"`
1095	// CanSendMessages
1096	//
1097	// optional
1098	CanSendMessages bool `json:"can_send_messages,omitempty"`
1099	// CanSendMediaMessages restricted only.
1100	// True, if the user is allowed to send text messages, contacts, locations and venues
1101	//
1102	// optional
1103	CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"`
1104	// CanSendOtherMessages restricted only.
1105	// True, if the user is allowed to send audios, documents,
1106	// photos, videos, video notes and voice notes.
1107	//
1108	// optional
1109	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
1110	// CanAddWebPagePreviews restricted only.
1111	// True, if the user is allowed to add web page previews to their messages.
1112	//
1113	// optional
1114	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
1115}
1116
1117// IsCreator returns if the ChatMember was the creator of the chat.
1118func (chat ChatMember) IsCreator() bool { return chat.Status == "creator" }
1119
1120// IsAdministrator returns if the ChatMember is a chat administrator.
1121func (chat ChatMember) IsAdministrator() bool { return chat.Status == "administrator" }
1122
1123// IsMember returns if the ChatMember is a current member of the chat.
1124func (chat ChatMember) IsMember() bool { return chat.Status == "member" }
1125
1126// HasLeft returns if the ChatMember left the chat.
1127func (chat ChatMember) HasLeft() bool { return chat.Status == "left" }
1128
1129// WasKicked returns if the ChatMember was kicked from the chat.
1130func (chat ChatMember) WasKicked() bool { return chat.Status == "kicked" }
1131
1132// Game is a game within Telegram.
1133type Game struct {
1134	// Title of the game
1135	Title string `json:"title"`
1136	// Description of the game
1137	Description string `json:"description"`
1138	// Photo that will be displayed in the game message in chats.
1139	Photo []PhotoSize `json:"photo"`
1140	// Text a brief description of the game or high scores included in the game message.
1141	// Can be automatically edited to include current high scores for the game
1142	// when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
1143	//
1144	// optional
1145	Text string `json:"text"`
1146	// TextEntities special entities that appear in text, such as usernames, URLs, bot commands, etc.
1147	//
1148	// optional
1149	TextEntities []MessageEntity `json:"text_entities"`
1150	// Animation animation that will be displayed in the game message in chats.
1151	// Upload via BotFather (https://t.me/botfather).
1152	//
1153	// optional
1154	Animation Animation `json:"animation"`
1155}
1156
1157// Animation is a GIF animation demonstrating the game.
1158type Animation struct {
1159	// FileID identifier for this file, which can be used to download or reuse the file.
1160	FileID string `json:"file_id"`
1161	// Thumb animation thumbnail as defined by sender.
1162	//
1163	// optional
1164	Thumb PhotoSize `json:"thumb"`
1165	// FileName original animation filename as defined by sender.
1166	//
1167	// optional
1168	FileName string `json:"file_name"`
1169	// MimeType of the file as defined by sender.
1170	//
1171	// optional
1172	MimeType string `json:"mime_type"`
1173	// FileSize ile size
1174	//
1175	// optional
1176	FileSize int `json:"file_size"`
1177}
1178
1179// GameHighScore is a user's score and position on the leaderboard.
1180type GameHighScore struct {
1181	// Position in high score table for the game
1182	Position int `json:"position"`
1183	// User user
1184	User User `json:"user"`
1185	// Score score
1186	Score int `json:"score"`
1187}
1188
1189// CallbackGame is for starting a game in an inline keyboard button.
1190type CallbackGame struct{}
1191
1192// WebhookInfo is information about a currently set webhook.
1193type WebhookInfo struct {
1194	// URL webhook URL, may be empty if webhook is not set up.
1195	URL string `json:"url"`
1196	// HasCustomCertificate true, if a custom certificate was provided for webhook certificate checks.
1197	HasCustomCertificate bool `json:"has_custom_certificate"`
1198	// PendingUpdateCount number of updates awaiting delivery.
1199	PendingUpdateCount int `json:"pending_update_count"`
1200	// LastErrorDate unix time for the most recent error
1201	// that happened when trying to deliver an update via webhook.
1202	//
1203	// optional
1204	LastErrorDate int `json:"last_error_date"`
1205	// LastErrorMessage error message in human-readable format for the most recent error
1206	// that happened when trying to deliver an update via webhook.
1207	//
1208	// optional
1209	LastErrorMessage string `json:"last_error_message"`
1210	// MaxConnections maximum allowed number of simultaneous
1211	// HTTPS connections to the webhook for update delivery.
1212	//
1213	// optional
1214	MaxConnections int `json:"max_connections"`
1215}
1216
1217// IsSet returns true if a webhook is currently set.
1218func (info WebhookInfo) IsSet() bool {
1219	return info.URL != ""
1220}
1221
1222// InputMediaPhoto contains a photo for displaying as part of a media group.
1223type InputMediaPhoto struct {
1224	// Type of the result, must be photo.
1225	Type string `json:"type"`
1226	// Media file to send. Pass a file_id to send a file that
1227	// exists on the Telegram servers (recommended),
1228	// pass an HTTP URL for Telegram to get a file from the Internet,
1229	// or pass “attach://<file_attach_name>” to upload a new one
1230	// using multipart/form-data under <file_attach_name> name.
1231	Media string `json:"media"`
1232	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
1233	//
1234	// optional
1235	Caption string `json:"caption"`
1236	// ParseMode mode for parsing entities in the photo caption.
1237	// See formatting options for more details
1238	// (https://core.telegram.org/bots/api#formatting-options).
1239	//
1240	// optional
1241	ParseMode string `json:"parse_mode"`
1242}
1243
1244// InputMediaVideo contains a video for displaying as part of a media group.
1245type InputMediaVideo struct {
1246	// Type of the result, must be video.
1247	Type string `json:"type"`
1248	// Media file to send. Pass a file_id to send a file
1249	// that exists on the Telegram servers (recommended),
1250	// pass an HTTP URL for Telegram to get a file from the Internet,
1251	// or pass “attach://<file_attach_name>” to upload a new one
1252	// using multipart/form-data under <file_attach_name> name.
1253	Media string `json:"media"`
1254	// thumb intentionally missing as it is not currently compatible
1255
1256	// Caption of the video to be sent, 0-1024 characters after entities parsing.
1257	//
1258	// optional
1259	Caption string `json:"caption"`
1260	// ParseMode mode for parsing entities in the video caption.
1261	// See formatting options for more details
1262	// (https://core.telegram.org/bots/api#formatting-options).
1263	//
1264	// optional
1265	ParseMode string `json:"parse_mode"`
1266	// Width video width
1267	//
1268	// optional
1269	Width int `json:"width"`
1270	// Height video height
1271	//
1272	// optional
1273	Height int `json:"height"`
1274	// Duration video duration
1275	//
1276	// optional
1277	Duration int `json:"duration"`
1278	// SupportsStreaming pass True, if the uploaded video is suitable for streaming.
1279	//
1280	// optional
1281	SupportsStreaming bool `json:"supports_streaming"`
1282}
1283
1284// InlineQuery is a Query from Telegram for an inline request.
1285type InlineQuery struct {
1286	// ID unique identifier for this query
1287	ID string `json:"id"`
1288	// From sender
1289	From *User `json:"from"`
1290	// Location sender location, only for bots that request user location.
1291	//
1292	// optional
1293	Location *Location `json:"location"`
1294	// Query text of the query (up to 256 characters).
1295	Query string `json:"query"`
1296	// Offset of the results to be returned, can be controlled by the bot.
1297	Offset string `json:"offset"`
1298}
1299
1300// InlineQueryResultArticle is an inline query response article.
1301type InlineQueryResultArticle struct {
1302	// Type of the result, must be article.
1303	//
1304	// required
1305	Type string `json:"type"`
1306	// ID unique identifier for this result, 1-64 Bytes.
1307	//
1308	// required
1309	ID string `json:"id"`
1310	// Title of the result
1311	//
1312	// required
1313	Title string `json:"title"`
1314	// InputMessageContent content of the message to be sent.
1315	//
1316	// required
1317	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1318	// ReplyMarkup Inline keyboard attached to the message.
1319	//
1320	// optional
1321	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1322	// URL of the result.
1323	//
1324	// optional
1325	URL string `json:"url"`
1326	// HideURL pass True, if you don't want the URL to be shown in the message.
1327	//
1328	// optional
1329	HideURL bool `json:"hide_url"`
1330	// Description short description of the result.
1331	//
1332	// optional
1333	Description string `json:"description"`
1334	// ThumbURL url of the thumbnail for the result
1335	//
1336	// optional
1337	ThumbURL string `json:"thumb_url"`
1338	// ThumbWidth thumbnail width
1339	//
1340	// optional
1341	ThumbWidth int `json:"thumb_width"`
1342	// ThumbHeight thumbnail height
1343	//
1344	// optional
1345	ThumbHeight int `json:"thumb_height"`
1346}
1347
1348// InlineQueryResultPhoto is an inline query response photo.
1349type InlineQueryResultPhoto struct {
1350	// Type of the result, must be article.
1351	//
1352	// required
1353	Type string `json:"type"`
1354	// ID unique identifier for this result, 1-64 Bytes.
1355	//
1356	// required
1357	ID string `json:"id"`
1358	// URL a valid URL of the photo. Photo must be in jpeg format.
1359	// Photo size must not exceed 5MB.
1360	URL string `json:"photo_url"`
1361	// MimeType
1362	MimeType string `json:"mime_type"`
1363	// Width of the photo
1364	//
1365	// optional
1366	Width int `json:"photo_width"`
1367	// Height of the photo
1368	//
1369	// optional
1370	Height int `json:"photo_height"`
1371	// ThumbURL url of the thumbnail for the photo.
1372	//
1373	// optional
1374	ThumbURL string `json:"thumb_url"`
1375	// Title for the result
1376	//
1377	// optional
1378	Title string `json:"title"`
1379	// Description short description of the result
1380	//
1381	// optional
1382	Description string `json:"description"`
1383	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
1384	//
1385	// optional
1386	Caption string `json:"caption"`
1387	// ParseMode mode for parsing entities in the photo caption.
1388	// See formatting options for more details
1389	// (https://core.telegram.org/bots/api#formatting-options).
1390	//
1391	// optional
1392	ParseMode string `json:"parse_mode"`
1393	// ReplyMarkup inline keyboard attached to the message.
1394	//
1395	// optional
1396	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1397	// InputMessageContent content of the message to be sent instead of the photo.
1398	//
1399	// optional
1400	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1401}
1402
1403// InlineQueryResultCachedPhoto is an inline query response with cached photo.
1404type InlineQueryResultCachedPhoto struct {
1405	// Type of the result, must be photo.
1406	//
1407	// required
1408	Type string `json:"type"`
1409	// ID unique identifier for this result, 1-64 bytes.
1410	//
1411	// required
1412	ID string `json:"id"`
1413	// PhotoID a valid file identifier of the photo.
1414	//
1415	// required
1416	PhotoID string `json:"photo_file_id"`
1417	// Title for the result.
1418	//
1419	// optional
1420	Title string `json:"title"`
1421	// Description short description of the result.
1422	//
1423	// optional
1424	Description string `json:"description"`
1425	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
1426	//
1427	// optional
1428	Caption string `json:"caption"`
1429	// ParseMode mode for parsing entities in the photo caption.
1430	// See formatting options for more details
1431	// (https://core.telegram.org/bots/api#formatting-options).
1432	//
1433	// optional
1434	ParseMode string `json:"parse_mode"`
1435	// ReplyMarkup inline keyboard attached to the message.
1436	//
1437	// optional
1438	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1439	// InputMessageContent content of the message to be sent instead of the photo.
1440	//
1441	// optional
1442	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1443}
1444
1445// InlineQueryResultGIF is an inline query response GIF.
1446type InlineQueryResultGIF struct {
1447	// Type of the result, must be gif.
1448	//
1449	// required
1450	Type string `json:"type"`
1451	// ID unique identifier for this result, 1-64 bytes.
1452	//
1453	// required
1454	ID string `json:"id"`
1455	// URL a valid URL for the GIF file. File size must not exceed 1MB.
1456	//
1457	// required
1458	URL string `json:"gif_url"`
1459	// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
1460	//
1461	// required
1462	ThumbURL string `json:"thumb_url"`
1463	// Width of the GIF
1464	//
1465	// optional
1466	Width int `json:"gif_width,omitempty"`
1467	// Height of the GIF
1468	//
1469	// optional
1470	Height int `json:"gif_height,omitempty"`
1471	// Duration of the GIF
1472	//
1473	// optional
1474	Duration int `json:"gif_duration,omitempty"`
1475	// Title for the result
1476	//
1477	// optional
1478	Title string `json:"title,omitempty"`
1479	// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
1480	//
1481	// optional
1482	Caption string `json:"caption,omitempty"`
1483	// ReplyMarkup inline keyboard attached to the message
1484	//
1485	// optional
1486	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1487	// InputMessageContent content of the message to be sent instead of the GIF animation.
1488	//
1489	// optional
1490	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1491}
1492
1493// InlineQueryResultCachedGIF is an inline query response with cached gif.
1494type InlineQueryResultCachedGIF struct {
1495	// Type of the result, must be gif.
1496	//
1497	// required
1498	Type string `json:"type"`
1499	// ID unique identifier for this result, 1-64 bytes.
1500	//
1501	// required
1502	ID string `json:"id"`
1503	// GifID a valid file identifier for the GIF file.
1504	//
1505	// required
1506	GifID string `json:"gif_file_id"`
1507	// Title for the result
1508	//
1509	// optional
1510	Title string `json:"title"`
1511	// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
1512	//
1513	// optional
1514	Caption string `json:"caption"`
1515	// ParseMode mode for parsing entities in the caption.
1516	// See formatting options for more details
1517	// (https://core.telegram.org/bots/api#formatting-options).
1518	//
1519	// optional
1520	ParseMode string `json:"parse_mode"`
1521	// ReplyMarkup inline keyboard attached to the message.
1522	//
1523	// optional
1524	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1525	// InputMessageContent content of the message to be sent instead of the GIF animation.
1526	//
1527	// optional
1528	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1529}
1530
1531// InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.
1532type InlineQueryResultMPEG4GIF struct {
1533	// Type of the result, must be mpeg4_gif
1534	//
1535	// required
1536	Type string `json:"type"`
1537	// ID unique identifier for this result, 1-64 bytes
1538	//
1539	// required
1540	ID string `json:"id"`
1541	// URL a valid URL for the MP4 file. File size must not exceed 1MB
1542	//
1543	// required
1544	URL string `json:"mpeg4_url"`
1545	// Width video width
1546	//
1547	// optional
1548	Width int `json:"mpeg4_width"`
1549	// Height vVideo height
1550	//
1551	// optional
1552	Height int `json:"mpeg4_height"`
1553	// Duration video duration
1554	//
1555	// optional
1556	Duration int `json:"mpeg4_duration"`
1557	// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
1558	ThumbURL string `json:"thumb_url"`
1559	// Title for the result
1560	//
1561	// optional
1562	Title string `json:"title"`
1563	// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
1564	//
1565	// optional
1566	Caption string `json:"caption"`
1567	// ReplyMarkup inline keyboard attached to the message
1568	//
1569	// optional
1570	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1571	// InputMessageContent content of the message to be sent instead of the video animation
1572	//
1573	// optional
1574	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1575}
1576
1577// InlineQueryResultCachedMpeg4Gif is an inline query response with cached
1578// H.264/MPEG-4 AVC video without sound gif.
1579type InlineQueryResultCachedMpeg4Gif struct {
1580	// Type of the result, must be mpeg4_gif
1581	//
1582	// required
1583	Type string `json:"type"`
1584	// ID unique identifier for this result, 1-64 bytes
1585	//
1586	// required
1587	ID string `json:"id"`
1588	// MGifID a valid file identifier for the MP4 file
1589	//
1590	// required
1591	MGifID string `json:"mpeg4_file_id"`
1592	// Title for the result
1593	//
1594	// optional
1595	Title string `json:"title"`
1596	// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
1597	//
1598	// optional
1599	Caption string `json:"caption"`
1600	// ParseMode mode for parsing entities in the caption.
1601	// See formatting options for more details
1602	// (https://core.telegram.org/bots/api#formatting-options).
1603	//
1604	// optional
1605	ParseMode string `json:"parse_mode"`
1606	// ReplyMarkup inline keyboard attached to the message.
1607	//
1608	// optional
1609	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1610	// InputMessageContent content of the message to be sent instead of the video animation.
1611	//
1612	// optional
1613	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1614}
1615
1616// InlineQueryResultVideo is an inline query response video.
1617type InlineQueryResultVideo struct {
1618	// Type of the result, must be video
1619	//
1620	// required
1621	Type string `json:"type"`
1622	// ID unique identifier for this result, 1-64 bytes
1623	//
1624	// required
1625	ID string `json:"id"`
1626	// URL a valid url for the embedded video player or video file
1627	//
1628	// required
1629	URL string `json:"video_url"`
1630	// MimeType of the content of video url, “text/html” or “video/mp4”
1631	//
1632	// required
1633	MimeType string `json:"mime_type"`
1634	//
1635	// ThumbURL url of the thumbnail (jpeg only) for the video
1636	// optional
1637	ThumbURL string `json:"thumb_url"`
1638	// Title for the result
1639	//
1640	// required
1641	Title string `json:"title"`
1642	// Caption of the video to be sent, 0-1024 characters after entities parsing
1643	//
1644	// optional
1645	Caption string `json:"caption"`
1646	// Width video width
1647	//
1648	// optional
1649	Width int `json:"video_width"`
1650	// Height video height
1651	//
1652	// optional
1653	Height int `json:"video_height"`
1654	// Duration video duration in seconds
1655	//
1656	// optional
1657	Duration int `json:"video_duration"`
1658	// Description short description of the result
1659	//
1660	// optional
1661	Description string `json:"description"`
1662	// ReplyMarkup inline keyboard attached to the message
1663	//
1664	// optional
1665	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1666	// InputMessageContent content of the message to be sent instead of the video.
1667	// This field is required if InlineQueryResultVideo is used to send
1668	// an HTML-page as a result (e.g., a YouTube video).
1669	//
1670	// optional
1671	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1672}
1673
1674// InlineQueryResultCachedVideo is an inline query response with cached video.
1675type InlineQueryResultCachedVideo struct {
1676	// Type of the result, must be video
1677	//
1678	// required
1679	Type string `json:"type"`
1680	// ID unique identifier for this result, 1-64 bytes
1681	//
1682	// required
1683	ID string `json:"id"`
1684	// VideoID a valid file identifier for the video file
1685	//
1686	// required
1687	VideoID string `json:"video_file_id"`
1688	// Title for the result
1689	//
1690	// required
1691	Title string `json:"title"`
1692	// Description short description of the result
1693	//
1694	// optional
1695	Description string `json:"description"`
1696	// Caption of the video to be sent, 0-1024 characters after entities parsing
1697	//
1698	// optional
1699	Caption string `json:"caption"`
1700	// ParseMode mode for parsing entities in the video caption.
1701	// See formatting options for more details
1702	// (https://core.telegram.org/bots/api#formatting-options).
1703	//
1704	// optional
1705	ParseMode string `json:"parse_mode"`
1706	// ReplyMarkup inline keyboard attached to the message
1707	//
1708	// optional
1709	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1710	// InputMessageContent content of the message to be sent instead of the video
1711	//
1712	// optional
1713	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1714}
1715
1716// InlineQueryResultCachedSticker is an inline query response with cached sticker.
1717type InlineQueryResultCachedSticker struct {
1718	// Type of the result, must be sticker
1719	//
1720	// required
1721	Type string `json:"type"`
1722	// ID unique identifier for this result, 1-64 bytes
1723	//
1724	// required
1725	ID string `json:"id"`
1726	// StickerID a valid file identifier of the sticker
1727	//
1728	// required
1729	StickerID string `json:"sticker_file_id"`
1730	// Title is a title
1731	Title string `json:"title"`
1732	// ParseMode mode for parsing entities in the video caption.
1733	// See formatting options for more details
1734	// (https://core.telegram.org/bots/api#formatting-options).
1735	//
1736	// optional
1737	ParseMode string `json:"parse_mode"`
1738	// ReplyMarkup inline keyboard attached to the message
1739	//
1740	// optional
1741	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1742	// InputMessageContent content of the message to be sent instead of the sticker
1743	//
1744	// optional
1745	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1746}
1747
1748// InlineQueryResultAudio is an inline query response audio.
1749type InlineQueryResultAudio struct {
1750	// Type of the result, must be audio
1751	//
1752	// required
1753	Type string `json:"type"`
1754	// ID unique identifier for this result, 1-64 bytes
1755	//
1756	// required
1757	ID string `json:"id"`
1758	// URL a valid url for the audio file
1759	//
1760	// required
1761	URL string `json:"audio_url"`
1762	// Title is a title
1763	//
1764	// required
1765	Title string `json:"title"`
1766	// Caption 0-1024 characters after entities parsing
1767	//
1768	// optional
1769	Caption string `json:"caption"`
1770	// Performer is a performer
1771	//
1772	// optional
1773	Performer string `json:"performer"`
1774	// Duration audio duration in seconds
1775	//
1776	// optional
1777	Duration int `json:"audio_duration"`
1778	// ReplyMarkup inline keyboard attached to the message
1779	//
1780	// optional
1781	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1782	// InputMessageContent content of the message to be sent instead of the audio
1783	//
1784	// optional
1785	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1786}
1787
1788// InlineQueryResultCachedAudio is an inline query response with cached audio.
1789type InlineQueryResultCachedAudio struct {
1790	// Type of the result, must be audio
1791	//
1792	// required
1793	Type string `json:"type"`
1794	// ID unique identifier for this result, 1-64 bytes
1795	//
1796	// required
1797	ID string `json:"id"`
1798	// AudioID a valid file identifier for the audio file
1799	//
1800	// required
1801	AudioID string `json:"audio_file_id"`
1802	// Caption 0-1024 characters after entities parsing
1803	//
1804	// optional
1805	Caption string `json:"caption"`
1806	// ParseMode mode for parsing entities in the video caption.
1807	// See formatting options for more details
1808	// (https://core.telegram.org/bots/api#formatting-options).
1809	//
1810	// optional
1811	ParseMode string `json:"parse_mode"`
1812	// ReplyMarkup inline keyboard attached to the message
1813	//
1814	// optional
1815	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1816	// InputMessageContent content of the message to be sent instead of the audio
1817	//
1818	// optional
1819	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1820}
1821
1822// InlineQueryResultVoice is an inline query response voice.
1823type InlineQueryResultVoice struct {
1824	// Type of the result, must be voice
1825	//
1826	// required
1827	Type string `json:"type"`
1828	// ID unique identifier for this result, 1-64 bytes
1829	//
1830	// required
1831	ID string `json:"id"`
1832	// URL a valid URL for the voice recording
1833	//
1834	// required
1835	URL string `json:"voice_url"`
1836	// Title recording title
1837	//
1838	// required
1839	Title string `json:"title"`
1840	// Caption 0-1024 characters after entities parsing
1841	//
1842	// optional
1843	Caption string `json:"caption"`
1844	// Duration recording duration in seconds
1845	//
1846	// optional
1847	Duration int `json:"voice_duration"`
1848	// ReplyMarkup inline keyboard attached to the message
1849	//
1850	// optional
1851	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1852	// InputMessageContent content of the message to be sent instead of the voice recording
1853	//
1854	// optional
1855	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1856}
1857
1858// InlineQueryResultCachedVoice is an inline query response with cached voice.
1859type InlineQueryResultCachedVoice struct {
1860	// Type of the result, must be voice
1861	//
1862	// required
1863	Type string `json:"type"`
1864	// ID unique identifier for this result, 1-64 bytes
1865	//
1866	// required
1867	ID string `json:"id"`
1868	// VoiceID a valid file identifier for the voice message
1869	//
1870	// required
1871	VoiceID string `json:"voice_file_id"`
1872	// Title voice message title
1873	//
1874	// required
1875	Title string `json:"title"`
1876	// Caption 0-1024 characters after entities parsing
1877	//
1878	// optional
1879	Caption string `json:"caption"`
1880	// ParseMode mode for parsing entities in the video caption.
1881	// See formatting options for more details
1882	// (https://core.telegram.org/bots/api#formatting-options).
1883	//
1884	// optional
1885	ParseMode string `json:"parse_mode"`
1886	// ReplyMarkup inline keyboard attached to the message
1887	//
1888	// optional
1889	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1890	// InputMessageContent content of the message to be sent instead of the voice message
1891	//
1892	// optional
1893	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1894}
1895
1896// InlineQueryResultDocument is an inline query response document.
1897type InlineQueryResultDocument struct {
1898	// Type of the result, must be document
1899	//
1900	// required
1901	Type string `json:"type"`
1902	// ID unique identifier for this result, 1-64 bytes
1903	//
1904	// required
1905	ID string `json:"id"`
1906	// Title for the result
1907	//
1908	// required
1909	Title string `json:"title"`
1910	// Caption of the document to be sent, 0-1024 characters after entities parsing
1911	//
1912	// optional
1913	Caption string `json:"caption"`
1914	// URL a valid url for the file
1915	//
1916	// required
1917	URL string `json:"document_url"`
1918	// MimeType of the content of the file, either “application/pdf” or “application/zip”
1919	//
1920	// required
1921	MimeType string `json:"mime_type"`
1922	// Description short description of the result
1923	//
1924	// optional
1925	Description string `json:"description"`
1926	// ReplyMarkup nline keyboard attached to the message
1927	//
1928	// optional
1929	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1930	// InputMessageContent content of the message to be sent instead of the file
1931	//
1932	// optional
1933	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1934	// ThumbURL url of the thumbnail (jpeg only) for the file
1935	//
1936	// optional
1937	ThumbURL string `json:"thumb_url"`
1938	// ThumbWidth thumbnail width
1939	//
1940	// optional
1941	ThumbWidth int `json:"thumb_width"`
1942	// ThumbHeight thumbnail height
1943	//
1944	// optional
1945	ThumbHeight int `json:"thumb_height"`
1946}
1947
1948// InlineQueryResultCachedDocument is an inline query response with cached document.
1949type InlineQueryResultCachedDocument struct {
1950	// Type of the result, must be document
1951	//
1952	// required
1953	Type string `json:"type"`
1954	// ID unique identifier for this result, 1-64 bytes
1955	//
1956	// required
1957	ID string `json:"id"`
1958	// DocumentID a valid file identifier for the file
1959	//
1960	// required
1961	DocumentID string `json:"document_file_id"`
1962	// Title for the result
1963	//
1964	// optional
1965	Title string `json:"title"` // required
1966	// Caption of the document to be sent, 0-1024 characters after entities parsing
1967	//
1968	// optional
1969	Caption string `json:"caption"`
1970	// Description short description of the result
1971	//
1972	// optional
1973	Description string `json:"description"`
1974	// ParseMode mode for parsing entities in the video caption.
1975	//	// See formatting options for more details
1976	//	// (https://core.telegram.org/bots/api#formatting-options).
1977	//
1978	// optional
1979	ParseMode string `json:"parse_mode"`
1980	// ReplyMarkup inline keyboard attached to the message
1981	//
1982	// optional
1983	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1984	// InputMessageContent content of the message to be sent instead of the file
1985	//
1986	// optional
1987	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1988}
1989
1990// InlineQueryResultLocation is an inline query response location.
1991type InlineQueryResultLocation struct {
1992	// Type of the result, must be location
1993	//
1994	// required
1995	Type string `json:"type"`
1996	// ID unique identifier for this result, 1-64 Bytes
1997	//
1998	// required
1999	ID string `json:"id"`
2000	// Latitude  of the location in degrees
2001	//
2002	// required
2003	Latitude float64 `json:"latitude"`
2004	// Longitude of the location in degrees
2005	//
2006	// required
2007	Longitude float64 `json:"longitude"`
2008	// Title of the location
2009	//
2010	// required
2011	Title string `json:"title"`
2012	// ReplyMarkup inline keyboard attached to the message
2013	//
2014	// optional
2015	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2016	// InputMessageContent content of the message to be sent instead of the location
2017	//
2018	// optional
2019	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2020	// ThumbURL url of the thumbnail for the result
2021	//
2022	// optional
2023	ThumbURL string `json:"thumb_url"`
2024	// ThumbWidth thumbnail width
2025	//
2026	// optional
2027	ThumbWidth int `json:"thumb_width"`
2028	// ThumbHeight thumbnail height
2029	//
2030	// optional
2031	ThumbHeight int `json:"thumb_height"`
2032}
2033
2034// InlineQueryResultVenue is an inline query response venue.
2035type InlineQueryResultVenue struct {
2036	// Type of the result, must be venue
2037	//
2038	// required
2039	Type string `json:"type"`
2040	// ID unique identifier for this result, 1-64 Bytes
2041	//
2042	// required
2043	ID string `json:"id"`
2044	// Latitude of the venue location in degrees
2045	//
2046	// required
2047	Latitude float64 `json:"latitude"`
2048	// Longitude of the venue location in degrees
2049	//
2050	// required
2051	Longitude float64 `json:"longitude"`
2052	// Title of the venue
2053	//
2054	// required
2055	Title string `json:"title"`
2056	// Address of the venue
2057	//
2058	// required
2059	Address string `json:"address"`
2060	// FoursquareID foursquare identifier of the venue if known
2061	//
2062	// optional
2063	FoursquareID string `json:"foursquare_id"`
2064	// FoursquareType foursquare type of the venue, if known.
2065	// (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
2066	//
2067	// optional
2068	FoursquareType string `json:"foursquare_type"`
2069	// ReplyMarkup inline keyboard attached to the message
2070	//
2071	// optional
2072	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2073	// InputMessageContent content of the message to be sent instead of the venue
2074	//
2075	// optional
2076	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2077	// ThumbURL url of the thumbnail for the result
2078	//
2079	// optional
2080	ThumbURL string `json:"thumb_url"`
2081	// ThumbWidth thumbnail width
2082	//
2083	// optional
2084	ThumbWidth int `json:"thumb_width"`
2085	// ThumbHeight thumbnail height
2086	//
2087	// optional
2088	ThumbHeight int `json:"thumb_height"`
2089}
2090
2091// InlineQueryResultGame is an inline query response game.
2092type InlineQueryResultGame struct {
2093	// Type of the result, must be game
2094	//
2095	// required
2096	Type string `json:"type"`
2097	// ID unique identifier for this result, 1-64 bytes
2098	//
2099	// required
2100	ID string `json:"id"`
2101	// GameShortName short name of the game
2102	//
2103	// required
2104	GameShortName string `json:"game_short_name"`
2105	// ReplyMarkup inline keyboard attached to the message
2106	//
2107	// optional
2108	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2109}
2110
2111// ChosenInlineResult is an inline query result chosen by a User
2112type ChosenInlineResult struct {
2113	// ResultID the unique identifier for the result that was chosen
2114	ResultID string `json:"result_id"`
2115	// From the user that chose the result
2116	From *User `json:"from"`
2117	// Location sender location, only for bots that require user location
2118	//
2119	// optional
2120	Location *Location `json:"location"`
2121	// InlineMessageID identifier of the sent inline message.
2122	// Available only if there is an inline keyboard attached to the message.
2123	// Will be also received in callback queries and can be used to edit the message.
2124	//
2125	// optional
2126	InlineMessageID string `json:"inline_message_id"`
2127	// Query the query that was used to obtain the result
2128	Query string `json:"query"`
2129}
2130
2131// InputTextMessageContent contains text for displaying
2132// as an inline query result.
2133type InputTextMessageContent struct {
2134	// Text of the message to be sent, 1-4096 characters
2135	Text string `json:"message_text"`
2136	// ParseMode mode for parsing entities in the message text.
2137	// See formatting options for more details
2138	// (https://core.telegram.org/bots/api#formatting-options).
2139	//
2140	// optional
2141	ParseMode string `json:"parse_mode"`
2142	// DisableWebPagePreview disables link previews for links in the sent message
2143	//
2144	// optional
2145	DisableWebPagePreview bool `json:"disable_web_page_preview"`
2146}
2147
2148// InputLocationMessageContent contains a location for displaying
2149// as an inline query result.
2150type InputLocationMessageContent struct {
2151	// Latitude of the location in degrees
2152	Latitude float64 `json:"latitude"`
2153	// Longitude of the location in degrees
2154	Longitude float64 `json:"longitude"`
2155}
2156
2157// InputVenueMessageContent contains a venue for displaying
2158// as an inline query result.
2159type InputVenueMessageContent struct {
2160	// Latitude of the venue in degrees
2161	Latitude float64 `json:"latitude"`
2162	// Longitude of the venue in degrees
2163	Longitude float64 `json:"longitude"`
2164	// Title name of the venue
2165	Title string `json:"title"`
2166	// Address of the venue
2167	Address string `json:"address"`
2168	// FoursquareID foursquare identifier of the venue, if known
2169	//
2170	// optional
2171	FoursquareID string `json:"foursquare_id"`
2172}
2173
2174// InputContactMessageContent contains a contact for displaying
2175// as an inline query result.
2176type InputContactMessageContent struct {
2177	// 	PhoneNumber contact's phone number
2178	PhoneNumber string `json:"phone_number"`
2179	// FirstName contact's first name
2180	FirstName string `json:"first_name"`
2181	// LastName contact's last name
2182	//
2183	// optional
2184	LastName string `json:"last_name"`
2185}
2186
2187// Invoice contains basic information about an invoice.
2188type Invoice struct {
2189	// Title product name
2190	Title string `json:"title"`
2191	// Description product description
2192	Description string `json:"description"`
2193	// StartParameter unique bot deep-linking parameter that can be used to generate this invoice
2194	StartParameter string `json:"start_parameter"`
2195	// Currency three-letter ISO 4217 currency code
2196	// (see https://core.telegram.org/bots/payments#supported-currencies)
2197	Currency string `json:"currency"`
2198	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
2199	// For example, for a price of US$ 1.45 pass amount = 145.
2200	// See the exp parameter in currencies.json
2201	// (https://core.telegram.org/bots/payments/currencies.json),
2202	// it shows the number of digits past the decimal point
2203	// for each currency (2 for the majority of currencies).
2204	TotalAmount int `json:"total_amount"`
2205}
2206
2207// LabeledPrice represents a portion of the price for goods or services.
2208type LabeledPrice struct {
2209	// Label portion label
2210	Label string `json:"label"`
2211	// Amount price of the product in the smallest units of the currency (integer, not float/double).
2212	// For example, for a price of US$ 1.45 pass amount = 145.
2213	// See the exp parameter in currencies.json
2214	// (https://core.telegram.org/bots/payments/currencies.json),
2215	// it shows the number of digits past the decimal point
2216	// for each currency (2 for the majority of currencies).
2217	Amount int `json:"amount"`
2218}
2219
2220// ShippingAddress represents a shipping address.
2221type ShippingAddress struct {
2222	// CountryCode ISO 3166-1 alpha-2 country code
2223	CountryCode string `json:"country_code"`
2224	// State if applicable
2225	State string `json:"state"`
2226	// City city
2227	City string `json:"city"`
2228	// StreetLine1 first line for the address
2229	StreetLine1 string `json:"street_line1"`
2230	// StreetLine2 second line for the address
2231	StreetLine2 string `json:"street_line2"`
2232	// PostCode address post code
2233	PostCode string `json:"post_code"`
2234}
2235
2236// OrderInfo represents information about an order.
2237type OrderInfo struct {
2238	// Name user name
2239	//
2240	// optional
2241	Name string `json:"name,omitempty"`
2242	// PhoneNumber user's phone number
2243	//
2244	// optional
2245	PhoneNumber string `json:"phone_number,omitempty"`
2246	// Email user email
2247	//
2248	// optional
2249	Email string `json:"email,omitempty"`
2250	// ShippingAddress user shipping address
2251	//
2252	// optional
2253	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
2254}
2255
2256// ShippingOption represents one shipping option.
2257type ShippingOption struct {
2258	// ID shipping option identifier
2259	ID string `json:"id"`
2260	// Title option title
2261	Title string `json:"title"`
2262	// Prices list of price portions
2263	Prices *[]LabeledPrice `json:"prices"`
2264}
2265
2266// SuccessfulPayment contains basic information about a successful payment.
2267type SuccessfulPayment struct {
2268	// Currency three-letter ISO 4217 currency code
2269	// (see https://core.telegram.org/bots/payments#supported-currencies)
2270	Currency string `json:"currency"`
2271	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
2272	// For example, for a price of US$ 1.45 pass amount = 145.
2273	// See the exp parameter in currencies.json,
2274	// (https://core.telegram.org/bots/payments/currencies.json)
2275	// it shows the number of digits past the decimal point
2276	// for each currency (2 for the majority of currencies).
2277	TotalAmount int `json:"total_amount"`
2278	// InvoicePayload bot specified invoice payload
2279	InvoicePayload string `json:"invoice_payload"`
2280	// ShippingOptionID identifier of the shipping option chosen by the user
2281	//
2282	// optional
2283	ShippingOptionID string `json:"shipping_option_id,omitempty"`
2284	// OrderInfo order info provided by the user
2285	//
2286	// optional
2287	OrderInfo *OrderInfo `json:"order_info,omitempty"`
2288	// TelegramPaymentChargeID telegram payment identifier
2289	TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
2290	// ProviderPaymentChargeID provider payment identifier
2291	ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
2292}
2293
2294// ShippingQuery contains information about an incoming shipping query.
2295type ShippingQuery struct {
2296	// ID unique query identifier
2297	ID string `json:"id"`
2298	// From user who sent the query
2299	From *User `json:"from"`
2300	// InvoicePayload bot specified invoice payload
2301	InvoicePayload string `json:"invoice_payload"`
2302	// ShippingAddress user specified shipping address
2303	ShippingAddress *ShippingAddress `json:"shipping_address"`
2304}
2305
2306// PreCheckoutQuery contains information about an incoming pre-checkout query.
2307type PreCheckoutQuery struct {
2308	// ID unique query identifier
2309	ID string `json:"id"`
2310	// From user who sent the query
2311	From *User `json:"from"`
2312	// Currency three-letter ISO 4217 currency code
2313	//	// (see https://core.telegram.org/bots/payments#supported-currencies)
2314	Currency string `json:"currency"`
2315	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
2316	//	// For example, for a price of US$ 1.45 pass amount = 145.
2317	//	// See the exp parameter in currencies.json,
2318	//	// (https://core.telegram.org/bots/payments/currencies.json)
2319	//	// it shows the number of digits past the decimal point
2320	//	// for each currency (2 for the majority of currencies).
2321	TotalAmount int `json:"total_amount"`
2322	// InvoicePayload bot specified invoice payload
2323	InvoicePayload string `json:"invoice_payload"`
2324	// ShippingOptionID identifier of the shipping option chosen by the user
2325	//
2326	// optional
2327	ShippingOptionID string `json:"shipping_option_id,omitempty"`
2328	// OrderInfo order info provided by the user
2329	//
2330	// optional
2331	OrderInfo *OrderInfo `json:"order_info,omitempty"`
2332}
2333
2334// Error is an error containing extra information returned by the Telegram API.
2335type Error struct {
2336	Code    int
2337	Message string
2338	ResponseParameters
2339}
2340
2341func (e Error) Error() string {
2342	return e.Message
2343}
2344
2345// BotCommand represents a bot command.
2346type BotCommand struct {
2347	// Command text of the command, 1-32 characters.
2348	// Can contain only lowercase English letters, digits and underscores.
2349	Command string `json:"command"`
2350	// Description of the command, 3-256 characters.
2351	Description string `json:"description"`
2352}