all repos — telegram-bot-api @ 53d566ba56fb4b9925de3aeb74726e870f8d2e1d

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// Error is an error containing extra information returned by the Telegram API.
  23type Error struct {
  24	Code    int
  25	Message string
  26	ResponseParameters
  27}
  28
  29// Error message string.
  30func (e Error) Error() string {
  31	return e.Message
  32}
  33
  34// Update is an update response, from GetUpdates.
  35type Update struct {
  36	// UpdateID is the update's unique identifier.
  37	// Update identifiers start from a certain positive number and increase
  38	// sequentially.
  39	// This ID becomes especially handy if you're using Webhooks,
  40	// since it allows you to ignore repeated updates or to restore
  41	// the correct update sequence, should they get out of order.
  42	// If there are no new updates for at least a week, then identifier
  43	// of the next update will be chosen randomly instead of sequentially.
  44	UpdateID int `json:"update_id"`
  45	// Message new incoming message of any kind — text, photo, sticker, etc.
  46	//
  47	// optional
  48	Message *Message `json:"message,omitempty"`
  49	// EditedMessage new version of a message that is known to the bot and was
  50	// edited
  51	//
  52	// optional
  53	EditedMessage *Message `json:"edited_message,omitempty"`
  54	// ChannelPost new version of a message that is known to the bot and was
  55	// edited
  56	//
  57	// optional
  58	ChannelPost *Message `json:"channel_post,omitempty"`
  59	// EditedChannelPost new incoming channel post of any kind — text, photo,
  60	// sticker, etc.
  61	//
  62	// optional
  63	EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
  64	// InlineQuery new incoming inline query
  65	//
  66	// optional
  67	InlineQuery *InlineQuery `json:"inline_query,omitempty"`
  68	// ChosenInlineResult is the result of an inline query
  69	// that was chosen by a user and sent to their chat partner.
  70	// Please see our documentation on the feedback collecting
  71	// for details on how to enable these updates for your bot.
  72	//
  73	// optional
  74	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
  75	// CallbackQuery new incoming callback query
  76	//
  77	// optional
  78	CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
  79	// ShippingQuery new incoming shipping query. Only for invoices with
  80	// flexible price
  81	//
  82	// optional
  83	ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`
  84	// PreCheckoutQuery new incoming pre-checkout query. Contains full
  85	// information about checkout
  86	//
  87	// optional
  88	PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
  89	// Pool new poll state. Bots receive only updates about stopped polls and
  90	// polls, which are sent by the bot
  91	//
  92	// optional
  93	Poll *Poll `json:"poll,omitempty"`
  94	// PollAnswer user changed their answer in a non-anonymous poll. Bots
  95	// receive new votes only in polls that were sent by the bot itself.
  96	//
  97	// optional
  98	PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
  99	// MyChatMember is the bot's chat member status was updated in a chat. For
 100	// private chats, this update is received only when the bot is blocked or
 101	// unblocked by the user.
 102	//
 103	// optional
 104	MyChatMember *ChatMemberUpdated `json:"my_chat_member"`
 105	// ChatMember is a chat member's status was updated in a chat. The bot must
 106	// be an administrator in the chat and must explicitly specify "chat_member"
 107	// in the list of allowed_updates to receive these updates.
 108	//
 109	// optional
 110	ChatMember *ChatMemberUpdated `json:"chat_member"`
 111}
 112
 113// UpdatesChannel is the channel for getting updates.
 114type UpdatesChannel <-chan Update
 115
 116// Clear discards all unprocessed incoming updates.
 117func (ch UpdatesChannel) Clear() {
 118	for len(ch) != 0 {
 119		<-ch
 120	}
 121}
 122
 123// User represents a Telegram user or bot.
 124type User struct {
 125	// ID is a unique identifier for this user or bot
 126	ID int64 `json:"id"`
 127	// IsBot true, if this user is a bot
 128	//
 129	// optional
 130	IsBot bool `json:"is_bot,omitempty"`
 131	// FirstName user's or bot's first name
 132	FirstName string `json:"first_name"`
 133	// LastName user's or bot's last name
 134	//
 135	// optional
 136	LastName string `json:"last_name,omitempty"`
 137	// UserName user's or bot's username
 138	//
 139	// optional
 140	UserName string `json:"username,omitempty"`
 141	// LanguageCode IETF language tag of the user's language
 142	// more info: https://en.wikipedia.org/wiki/IETF_language_tag
 143	//
 144	// optional
 145	LanguageCode string `json:"language_code,omitempty"`
 146	// CanJoinGroups is true, if the bot can be invited to groups.
 147	// Returned only in getMe.
 148	//
 149	// optional
 150	CanJoinGroups bool `json:"can_join_groups,omitempty"`
 151	// CanReadAllGroupMessages is true, if privacy mode is disabled for the bot.
 152	// Returned only in getMe.
 153	//
 154	// optional
 155	CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`
 156	// SupportsInlineQueries is true, if the bot supports inline queries.
 157	// Returned only in getMe.
 158	//
 159	// optional
 160	SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
 161}
 162
 163// String displays a simple text version of a user.
 164//
 165// It is normally a user's username, but falls back to a first/last
 166// name as available.
 167func (u *User) String() string {
 168	if u == nil {
 169		return ""
 170	}
 171	if u.UserName != "" {
 172		return u.UserName
 173	}
 174
 175	name := u.FirstName
 176	if u.LastName != "" {
 177		name += " " + u.LastName
 178	}
 179
 180	return name
 181}
 182
 183// Chat represents a chat.
 184type Chat struct {
 185	// ID is a unique identifier for this chat
 186	ID int64 `json:"id"`
 187	// Type of chat, can be either “private”, “group”, “supergroup” or “channel”
 188	Type string `json:"type"`
 189	// Title for supergroups, channels and group chats
 190	//
 191	// optional
 192	Title string `json:"title,omitempty"`
 193	// UserName for private chats, supergroups and channels if available
 194	//
 195	// optional
 196	UserName string `json:"username,omitempty"`
 197	// FirstName of the other party in a private chat
 198	//
 199	// optional
 200	FirstName string `json:"first_name,omitempty"`
 201	// LastName of the other party in a private chat
 202	//
 203	// optional
 204	LastName string `json:"last_name,omitempty"`
 205	// Photo is a chat photo
 206	Photo *ChatPhoto `json:"photo"`
 207	// Bio is the bio of the other party in a private chat. Returned only in
 208	// getChat
 209	//
 210	// optional
 211	Bio string `json:"bio,omitempty"`
 212	// Description for groups, supergroups and channel chats
 213	//
 214	// optional
 215	Description string `json:"description,omitempty"`
 216	// InviteLink is a chat invite link, for groups, supergroups and channel chats.
 217	// Each administrator in a chat generates their own invite links,
 218	// so the bot must first generate the link using exportChatInviteLink
 219	//
 220	// optional
 221	InviteLink string `json:"invite_link,omitempty"`
 222	// PinnedMessage is the pinned message, for groups, supergroups and channels
 223	//
 224	// optional
 225	PinnedMessage *Message `json:"pinned_message,omitempty"`
 226	// Permissions is default chat member permissions, for groups and
 227	// supergroups. Returned only in getChat.
 228	//
 229	// optional
 230	Permissions *ChatPermissions `json:"permissions,omitempty"`
 231	// SlowModeDelay is for supergroups, the minimum allowed delay between
 232	// consecutive messages sent by each unpriviledged user. Returned only in
 233	// getChat.
 234	//
 235	// optional
 236	SlowModeDelay int `json:"slow_mode_delay,omitempty"`
 237	// StickerSetName is for supergroups, name of group sticker set.Returned
 238	// only in getChat.
 239	//
 240	// optional
 241	StickerSetName string `json:"sticker_set_name,omitempty"`
 242	// CanSetStickerSet is true, if the bot can change the group sticker set.
 243	// Returned only in getChat.
 244	//
 245	// optional
 246	CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
 247	// LinkedChatID is a unique identifier for the linked chat, i.e. the
 248	// discussion group identifier for a channel and vice versa; for supergroups
 249	// and channel chats.
 250	//
 251	// optional
 252	LinkedChatID int64 `json:"linked_chat_id,omitempty"`
 253	// Location is for supergroups, the location to which the supergroup is
 254	// connected. Returned only in getChat.
 255	//
 256	// optional
 257	Location *ChatLocation `json:"location"`
 258}
 259
 260// IsPrivate returns if the Chat is a private conversation.
 261func (c Chat) IsPrivate() bool {
 262	return c.Type == "private"
 263}
 264
 265// IsGroup returns if the Chat is a group.
 266func (c Chat) IsGroup() bool {
 267	return c.Type == "group"
 268}
 269
 270// IsSuperGroup returns if the Chat is a supergroup.
 271func (c Chat) IsSuperGroup() bool {
 272	return c.Type == "supergroup"
 273}
 274
 275// IsChannel returns if the Chat is a channel.
 276func (c Chat) IsChannel() bool {
 277	return c.Type == "channel"
 278}
 279
 280// ChatConfig returns a ChatConfig struct for chat related methods.
 281func (c Chat) ChatConfig() ChatConfig {
 282	return ChatConfig{ChatID: c.ID}
 283}
 284
 285// Message represents a message.
 286type Message struct {
 287	// MessageID is a unique message identifier inside this chat
 288	MessageID int `json:"message_id"`
 289	// From is a sender, empty for messages sent to channels;
 290	//
 291	// optional
 292	From *User `json:"from,omitempty"`
 293	// SenderChat is the sender of the message, sent on behalf of a chat. The
 294	// channel itself for channel messages. The supergroup itself for messages
 295	// from anonymous group administrators. The linked channel for messages
 296	// automatically forwarded to the discussion group
 297	//
 298	// optional
 299	SenderChat *Chat `json:"sender_chat,omitempty"`
 300	// Date of the message was sent in Unix time
 301	Date int `json:"date"`
 302	// Chat is the conversation the message belongs to
 303	Chat *Chat `json:"chat"`
 304	// ForwardFrom for forwarded messages, sender of the original message;
 305	//
 306	// optional
 307	ForwardFrom *User `json:"forward_from,omitempty"`
 308	// ForwardFromChat for messages forwarded from channels,
 309	// information about the original channel;
 310	//
 311	// optional
 312	ForwardFromChat *Chat `json:"forward_from_chat,omitempty"`
 313	// ForwardFromMessageID for messages forwarded from channels,
 314	// identifier of the original message in the channel;
 315	//
 316	// optional
 317	ForwardFromMessageID int `json:"forward_from_message_id,omitempty"`
 318	// ForwardSignature for messages forwarded from channels, signature of the
 319	// post author if present
 320	//
 321	// optional
 322	ForwardSignature string `json:"forward_signature,omitempty"`
 323	// ForwardSenderName is the sender's name for messages forwarded from users
 324	// who disallow adding a link to their account in forwarded messages
 325	//
 326	// optional
 327	ForwardSenderName string `json:"forward_sender_name,omitempty"`
 328	// ForwardDate for forwarded messages, date the original message was sent in Unix time;
 329	//
 330	// optional
 331	ForwardDate int `json:"forward_date,omitempty"`
 332	// ReplyToMessage for replies, the original message.
 333	// Note that the Message object in this field will not contain further ReplyToMessage fields
 334	// even if it itself is a reply;
 335	//
 336	// optional
 337	ReplyToMessage *Message `json:"reply_to_message,omitempty"`
 338	// ViaBot through which the message was sent;
 339	//
 340	// optional
 341	ViaBot *User `json:"via_bot,omitempty"`
 342	// EditDate of the message was last edited in Unix time;
 343	//
 344	// optional
 345	EditDate int `json:"edit_date,omitempty"`
 346	// MediaGroupID is the unique identifier of a media message group this message belongs to;
 347	//
 348	// optional
 349	MediaGroupID string `json:"media_group_id,omitempty"`
 350	// AuthorSignature is the signature of the post author for messages in channels;
 351	//
 352	// optional
 353	AuthorSignature string `json:"author_signature,omitempty"`
 354	// Text is for text messages, the actual UTF-8 text of the message, 0-4096 characters;
 355	//
 356	// optional
 357	Text string `json:"text,omitempty"`
 358	// Entities is for text messages, special entities like usernames,
 359	// URLs, bot commands, etc. that appear in the text;
 360	//
 361	// optional
 362	Entities []MessageEntity `json:"entities,omitempty"`
 363	// Animation message is an animation, information about the animation.
 364	// For backward compatibility, when this field is set, the document field will also be set;
 365	//
 366	// optional
 367	Animation *Animation `json:"animation,omitempty"`
 368	// Audio message is an audio file, information about the file;
 369	//
 370	// optional
 371	Audio *Audio `json:"audio,omitempty"`
 372	// Document message is a general file, information about the file;
 373	//
 374	// optional
 375	Document *Document `json:"document,omitempty"`
 376	// Photo message is a photo, available sizes of the photo;
 377	//
 378	// optional
 379	Photo []PhotoSize `json:"photo,omitempty"`
 380	// Sticker message is a sticker, information about the sticker;
 381	//
 382	// optional
 383	Sticker *Sticker `json:"sticker,omitempty"`
 384	// Video message is a video, information about the video;
 385	//
 386	// optional
 387	Video *Video `json:"video,omitempty"`
 388	// VideoNote message is a video note, information about the video message;
 389	//
 390	// optional
 391	VideoNote *VideoNote `json:"video_note,omitempty"`
 392	// Voice message is a voice message, information about the file;
 393	//
 394	// optional
 395	Voice *Voice `json:"voice,omitempty"`
 396	// Caption for the animation, audio, document, photo, video or voice, 0-1024 characters;
 397	//
 398	// optional
 399	Caption string `json:"caption,omitempty"`
 400	// CaptionEntities;
 401	//
 402	// optional
 403	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
 404	// Contact message is a shared contact, information about the contact;
 405	//
 406	// optional
 407	Contact *Contact `json:"contact,omitempty"`
 408	// Dice is a dice with random value;
 409	//
 410	// optional
 411	Dice *Dice `json:"dice,omitempty"`
 412	// Game message is a game, information about the game;
 413	//
 414	// optional
 415	Game *Game `json:"game,omitempty"`
 416	// Poll is a native poll, information about the poll;
 417	//
 418	// optional
 419	Poll *Poll `json:"poll,omitempty"`
 420	// Venue message is a venue, information about the venue.
 421	// For backward compatibility, when this field is set, the location field
 422	// will also be set;
 423	//
 424	// optional
 425	Venue *Venue `json:"venue,omitempty"`
 426	// Location message is a shared location, information about the location;
 427	//
 428	// optional
 429	Location *Location `json:"location,omitempty"`
 430	// NewChatMembers that were added to the group or supergroup
 431	// and information about them (the bot itself may be one of these members);
 432	//
 433	// optional
 434	NewChatMembers []User `json:"new_chat_members,omitempty"`
 435	// LeftChatMember is a member was removed from the group,
 436	// information about them (this member may be the bot itself);
 437	//
 438	// optional
 439	LeftChatMember *User `json:"left_chat_member,omitempty"`
 440	// NewChatTitle is a chat title was changed to this value;
 441	//
 442	// optional
 443	NewChatTitle string `json:"new_chat_title,omitempty"`
 444	// NewChatPhoto is a chat photo was change to this value;
 445	//
 446	// optional
 447	NewChatPhoto []PhotoSize `json:"new_chat_photo,omitempty"`
 448	// DeleteChatPhoto is a service message: the chat photo was deleted;
 449	//
 450	// optional
 451	DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"`
 452	// GroupChatCreated is a service message: the group has been created;
 453	//
 454	// optional
 455	GroupChatCreated bool `json:"group_chat_created,omitempty"`
 456	// SuperGroupChatCreated is a service message: the supergroup has been created.
 457	// This field can't be received in a message coming through updates,
 458	// because bot can't be a member of a supergroup when it is created.
 459	// It can only be found in ReplyToMessage if someone replies to a very first message
 460	// in a directly created supergroup;
 461	//
 462	// optional
 463	SuperGroupChatCreated bool `json:"supergroup_chat_created,omitempty"`
 464	// ChannelChatCreated is a service message: the channel has been created.
 465	// This field can't be received in a message coming through updates,
 466	// because bot can't be a member of a channel when it is created.
 467	// It can only be found in ReplyToMessage
 468	// if someone replies to a very first message in a channel;
 469	//
 470	// optional
 471	ChannelChatCreated bool `json:"channel_chat_created,omitempty"`
 472	// MessageAutoDeleteTimerChanged is a service message: auto-delete timer
 473	// settings changed in the chat.
 474	//
 475	// optional
 476	MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed"`
 477	// MigrateToChatID is the group has been migrated to a supergroup with the specified identifier.
 478	// This number may be greater than 32 bits and some programming languages
 479	// may have difficulty/silent defects in interpreting it.
 480	// But it is smaller than 52 bits, so a signed 64 bit integer
 481	// or double-precision float type are safe for storing this identifier;
 482	//
 483	// optional
 484	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
 485	// MigrateFromChatID is the supergroup has been migrated from a group with the specified identifier.
 486	// This number may be greater than 32 bits and some programming languages
 487	// may have difficulty/silent defects in interpreting it.
 488	// But it is smaller than 52 bits, so a signed 64 bit integer
 489	// or double-precision float type are safe for storing this identifier;
 490	//
 491	// optional
 492	MigrateFromChatID int64 `json:"migrate_from_chat_id,omitempty"`
 493	// PinnedMessage is a specified message was pinned.
 494	// Note that the Message object in this field will not contain further ReplyToMessage
 495	// fields even if it is itself a reply;
 496	//
 497	// optional
 498	PinnedMessage *Message `json:"pinned_message,omitempty"`
 499	// Invoice message is an invoice for a payment;
 500	//
 501	// optional
 502	Invoice *Invoice `json:"invoice,omitempty"`
 503	// SuccessfulPayment message is a service message about a successful payment,
 504	// information about the payment;
 505	//
 506	// optional
 507	SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`
 508	// ConnectedWebsite is Tthe domain name of the website on which the user has
 509	// logged in;
 510	//
 511	// optional
 512	ConnectedWebsite string `json:"connected_website,omitempty"`
 513	// PassportData is a Telegram Passport data;
 514	//
 515	// optional
 516	PassportData *PassportData `json:"passport_data,omitempty"`
 517	// ProximityAlertTriggered is a service message. A user in the chat
 518	// triggered another user's proximity alert while sharing Live Location
 519	//
 520	// optional
 521	ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered"`
 522	// VoiceChatStarted is a service message: voice chat started.
 523	//
 524	// optional
 525	VoiceChatStarted *VoiceChatStarted `json:"voice_chat_started"`
 526	// VoiceChatEnded is a service message: voice chat ended.
 527	//
 528	// optional
 529	VoiceChatEnded *VoiceChatEnded `json:"voice_chat_ended"`
 530	// VoiceChatParticipantsInvited is a service message: new participants
 531	// invited to a voice chat.
 532	//
 533	// optional
 534	VoiceChatParticipantsInvited *VoiceChatParticipantsInvited `json:"voice_chat_participants_invited"`
 535	// ReplyMarkup is the Inline keyboard attached to the message.
 536	// login_url buttons are represented as ordinary url buttons.
 537	//
 538	// optional
 539	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 540}
 541
 542// Time converts the message timestamp into a Time.
 543func (m *Message) Time() time.Time {
 544	return time.Unix(int64(m.Date), 0)
 545}
 546
 547// IsCommand returns true if message starts with a "bot_command" entity.
 548func (m *Message) IsCommand() bool {
 549	if m.Entities == nil || len(m.Entities) == 0 {
 550		return false
 551	}
 552
 553	entity := m.Entities[0]
 554	return entity.Offset == 0 && entity.IsCommand()
 555}
 556
 557// Command checks if the message was a command and if it was, returns the
 558// command. If the Message was not a command, it returns an empty string.
 559//
 560// If the command contains the at name syntax, it is removed. Use
 561// CommandWithAt() if you do not want that.
 562func (m *Message) Command() string {
 563	command := m.CommandWithAt()
 564
 565	if i := strings.Index(command, "@"); i != -1 {
 566		command = command[:i]
 567	}
 568
 569	return command
 570}
 571
 572// CommandWithAt checks if the message was a command and if it was, returns the
 573// command. If the Message was not a command, it returns an empty string.
 574//
 575// If the command contains the at name syntax, it is not removed. Use Command()
 576// if you want that.
 577func (m *Message) CommandWithAt() string {
 578	if !m.IsCommand() {
 579		return ""
 580	}
 581
 582	// IsCommand() checks that the message begins with a bot_command entity
 583	entity := m.Entities[0]
 584	return m.Text[1:entity.Length]
 585}
 586
 587// CommandArguments checks if the message was a command and if it was,
 588// returns all text after the command name. If the Message was not a
 589// command, it returns an empty string.
 590//
 591// Note: The first character after the command name is omitted:
 592// - "/foo bar baz" yields "bar baz", not " bar baz"
 593// - "/foo-bar baz" yields "bar baz", too
 594// Even though the latter is not a command conforming to the spec, the API
 595// marks "/foo" as command entity.
 596func (m *Message) CommandArguments() string {
 597	if !m.IsCommand() {
 598		return ""
 599	}
 600
 601	// IsCommand() checks that the message begins with a bot_command entity
 602	entity := m.Entities[0]
 603
 604	if len(m.Text) == entity.Length {
 605		return "" // The command makes up the whole message
 606	}
 607
 608	return m.Text[entity.Length+1:]
 609}
 610
 611// MessageID represents a unique message identifier.
 612type MessageID struct {
 613	MessageID int `json:"message_id"`
 614}
 615
 616// MessageEntity represents one special entity in a text message.
 617type MessageEntity struct {
 618	// Type of the entity.
 619	// Can be:
 620	//  “mention” (@username),
 621	//  “hashtag” (#hashtag),
 622	//  “cashtag” ($USD),
 623	//  “bot_command” (/start@jobs_bot),
 624	//  “url” (https://telegram.org),
 625	//  “email” (do-not-reply@telegram.org),
 626	//  “phone_number” (+1-212-555-0123),
 627	//  “bold” (bold text),
 628	//  “italic” (italic text),
 629	//  “underline” (underlined text),
 630	//  “strikethrough” (strikethrough text),
 631	//  “code” (monowidth string),
 632	//  “pre” (monowidth block),
 633	//  “text_link” (for clickable text URLs),
 634	//  “text_mention” (for users without usernames)
 635	Type string `json:"type"`
 636	// Offset in UTF-16 code units to the start of the entity
 637	Offset int `json:"offset"`
 638	// Length
 639	Length int `json:"length"`
 640	// URL for “text_link” only, url that will be opened after user taps on the text
 641	//
 642	// optional
 643	URL string `json:"url,omitempty"`
 644	// User for “text_mention” only, the mentioned user
 645	//
 646	// optional
 647	User *User `json:"user,omitempty"`
 648	// Language for “pre” only, the programming language of the entity text
 649	//
 650	// optional
 651	Language string `json:"language,omitempty"`
 652}
 653
 654// ParseURL attempts to parse a URL contained within a MessageEntity.
 655func (e MessageEntity) ParseURL() (*url.URL, error) {
 656	if e.URL == "" {
 657		return nil, errors.New(ErrBadURL)
 658	}
 659
 660	return url.Parse(e.URL)
 661}
 662
 663// IsMention returns true if the type of the message entity is "mention" (@username).
 664func (e MessageEntity) IsMention() bool {
 665	return e.Type == "mention"
 666}
 667
 668// IsHashtag returns true if the type of the message entity is "hashtag".
 669func (e MessageEntity) IsHashtag() bool {
 670	return e.Type == "hashtag"
 671}
 672
 673// IsCommand returns true if the type of the message entity is "bot_command".
 674func (e MessageEntity) IsCommand() bool {
 675	return e.Type == "bot_command"
 676}
 677
 678// IsURL returns true if the type of the message entity is "url".
 679func (e MessageEntity) IsURL() bool {
 680	return e.Type == "url"
 681}
 682
 683// IsEmail returns true if the type of the message entity is "email".
 684func (e MessageEntity) IsEmail() bool {
 685	return e.Type == "email"
 686}
 687
 688// IsBold returns true if the type of the message entity is "bold" (bold text).
 689func (e MessageEntity) IsBold() bool {
 690	return e.Type == "bold"
 691}
 692
 693// IsItalic returns true if the type of the message entity is "italic" (italic text).
 694func (e MessageEntity) IsItalic() bool {
 695	return e.Type == "italic"
 696}
 697
 698// IsCode returns true if the type of the message entity is "code" (monowidth string).
 699func (e MessageEntity) IsCode() bool {
 700	return e.Type == "code"
 701}
 702
 703// IsPre returns true if the type of the message entity is "pre" (monowidth block).
 704func (e MessageEntity) IsPre() bool {
 705	return e.Type == "pre"
 706}
 707
 708// IsTextLink returns true if the type of the message entity is "text_link" (clickable text URL).
 709func (e MessageEntity) IsTextLink() bool {
 710	return e.Type == "text_link"
 711}
 712
 713// PhotoSize represents one size of a photo or a file / sticker thumbnail.
 714type PhotoSize struct {
 715	// FileID identifier for this file, which can be used to download or reuse
 716	// the file
 717	FileID string `json:"file_id"`
 718	// FileUniqueID is the unique identifier for this file, which is supposed to
 719	// be the same over time and for different bots. Can't be used to download
 720	// or reuse the file.
 721	FileUniqueID string `json:"file_unique_id"`
 722	// Width photo width
 723	Width int `json:"width"`
 724	// Height photo height
 725	Height int `json:"height"`
 726	// FileSize file size
 727	//
 728	// optional
 729	FileSize int `json:"file_size,omitempty"`
 730}
 731
 732// Animation represents an animation file.
 733type Animation struct {
 734	// FileID odentifier for this file, which can be used to download or reuse
 735	// the file
 736	FileID string `json:"file_id"`
 737	// FileUniqueID is the unique identifier for this file, which is supposed to
 738	// be the same over time and for different bots. Can't be used to download
 739	// or reuse the file.
 740	FileUniqueID string `json:"file_unique_id"`
 741	// Width video width as defined by sender
 742	Width int `json:"width"`
 743	// Height video height as defined by sender
 744	Height int `json:"height"`
 745	// Duration of the video in seconds as defined by sender
 746	Duration int `json:"duration"`
 747	// Thumbnail animation thumbnail as defined by sender
 748	//
 749	// optional
 750	Thumbnail *PhotoSize `json:"thumb,omitempty"`
 751	// FileName original animation filename as defined by sender
 752	//
 753	// optional
 754	FileName string `json:"file_name,omitempty"`
 755	// MimeType of the file as defined by sender
 756	//
 757	// optional
 758	MimeType string `json:"mime_type,omitempty"`
 759	// FileSize file size
 760	//
 761	// optional
 762	FileSize int `json:"file_size,omitempty"`
 763}
 764
 765// Audio represents an audio file to be treated as music by the Telegram clients.
 766type Audio struct {
 767	// FileID is an identifier for this file, which can be used to download or
 768	// reuse the file
 769	FileID string `json:"file_id"`
 770	// FileUniqueID is the unique identifier for this file, which is supposed to
 771	// be the same over time and for different bots. Can't be used to download
 772	// or reuse the file.
 773	FileUniqueID string `json:"file_unique_id"`
 774	// Duration of the audio in seconds as defined by sender
 775	Duration int `json:"duration"`
 776	// Performer of the audio as defined by sender or by audio tags
 777	//
 778	// optional
 779	Performer string `json:"performer,omitempty"`
 780	// Title of the audio as defined by sender or by audio tags
 781	//
 782	// optional
 783	Title string `json:"title,omitempty"`
 784	// FileName is the original filename as defined by sender
 785	//
 786	// optional
 787	FileName string `json:"file_name,omitempty"`
 788	// MimeType of the file as defined by sender
 789	//
 790	// optional
 791	MimeType string `json:"mime_type,omitempty"`
 792	// FileSize file size
 793	//
 794	// optional
 795	FileSize int `json:"file_size,omitempty"`
 796	// Thumbnail is the album cover to which the music file belongs
 797	//
 798	// optional
 799	Thumbnail *PhotoSize `json:"thumb,omitempty"`
 800}
 801
 802// Document represents a general file.
 803type Document struct {
 804	// FileID is a identifier for this file, which can be used to download or
 805	// reuse the file
 806	FileID string `json:"file_id"`
 807	// FileUniqueID is the unique identifier for this file, which is supposed to
 808	// be the same over time and for different bots. Can't be used to download
 809	// or reuse the file.
 810	FileUniqueID string `json:"file_unique_id"`
 811	// Thumbnail document thumbnail as defined by sender
 812	//
 813	// optional
 814	Thumbnail *PhotoSize `json:"thumb,omitempty"`
 815	// FileName original filename as defined by sender
 816	//
 817	// optional
 818	FileName string `json:"file_name,omitempty"`
 819	// MimeType  of the file as defined by sender
 820	//
 821	// optional
 822	MimeType string `json:"mime_type,omitempty"`
 823	// FileSize file size
 824	//
 825	// optional
 826	FileSize int `json:"file_size,omitempty"`
 827}
 828
 829// Video represents a video file.
 830type Video struct {
 831	// FileID identifier for this file, which can be used to download or reuse
 832	// the file
 833	FileID string `json:"file_id"`
 834	// FileUniqueID is the unique identifier for this file, which is supposed to
 835	// be the same over time and for different bots. Can't be used to download
 836	// or reuse the file.
 837	FileUniqueID string `json:"file_unique_id"`
 838	// Width video width as defined by sender
 839	Width int `json:"width"`
 840	// Height video height as defined by sender
 841	Height int `json:"height"`
 842	// Duration of the video in seconds as defined by sender
 843	Duration int `json:"duration"`
 844	// Thumbnail video thumbnail
 845	//
 846	// optional
 847	Thumbnail *PhotoSize `json:"thumb,omitempty"`
 848	// FileName is the original filename as defined by sender
 849	//
 850	// optional
 851	FileName string `json:"file_name,omitempty"`
 852	// MimeType of a file as defined by sender
 853	//
 854	// optional
 855	MimeType string `json:"mime_type,omitempty"`
 856	// FileSize file size
 857	//
 858	// optional
 859	FileSize int `json:"file_size,omitempty"`
 860}
 861
 862// VideoNote object represents a video message.
 863type VideoNote struct {
 864	// FileID identifier for this file, which can be used to download or reuse the file
 865	FileID string `json:"file_id"`
 866	// FileUniqueID is the unique identifier for this file, which is supposed to
 867	// be the same over time and for different bots. Can't be used to download
 868	// or reuse the file.
 869	FileUniqueID string `json:"file_unique_id"`
 870	// Length video width and height (diameter of the video message) as defined by sender
 871	Length int `json:"length"`
 872	// Duration of the video in seconds as defined by sender
 873	Duration int `json:"duration"`
 874	// Thumbnail video thumbnail
 875	//
 876	// optional
 877	Thumbnail *PhotoSize `json:"thumb,omitempty"`
 878	// FileSize file size
 879	//
 880	// optional
 881	FileSize int `json:"file_size,omitempty"`
 882}
 883
 884// Voice represents a voice note.
 885type Voice struct {
 886	// FileID identifier for this file, which can be used to download or reuse the file
 887	FileID string `json:"file_id"`
 888	// FileUniqueID is the unique identifier for this file, which is supposed to
 889	// be the same over time and for different bots. Can't be used to download
 890	// or reuse the file.
 891	FileUniqueID string `json:"file_unique_id"`
 892	// Duration of the audio in seconds as defined by sender
 893	Duration int `json:"duration"`
 894	// MimeType of the file as defined by sender
 895	//
 896	// optional
 897	MimeType string `json:"mime_type,omitempty"`
 898	// FileSize file size
 899	//
 900	// optional
 901	FileSize int `json:"file_size,omitempty"`
 902}
 903
 904// Contact represents a phone contact.
 905//
 906// Note that LastName and UserID may be empty.
 907type Contact struct {
 908	// PhoneNumber contact's phone number
 909	PhoneNumber string `json:"phone_number"`
 910	// FirstName contact's first name
 911	FirstName string `json:"first_name"`
 912	// LastName contact's last name
 913	//
 914	// optional
 915	LastName string `json:"last_name,omitempty"`
 916	// UserID contact's user identifier in Telegram
 917	//
 918	// optional
 919	UserID int64 `json:"user_id,omitempty"`
 920	// VCard is additional data about the contact in the form of a vCard.
 921	//
 922	// optional
 923	VCard string `json:"vcard,omitempty"`
 924}
 925
 926// Dice represents an animated emoji that displays a random value.
 927type Dice struct {
 928	// Emoji on which the dice throw animation is based
 929	Emoji string `json:"emoji"`
 930	// Value of the dice
 931	Value int `json:"value"`
 932}
 933
 934// PollOption contains information about one answer option in a poll.
 935type PollOption struct {
 936	// Text is the option text, 1-100 characters
 937	Text string `json:"text"`
 938	// VoterCount is the number of users that voted for this option
 939	VoterCount int `json:"voter_count"`
 940}
 941
 942// PollAnswer represents an answer of a user in a non-anonymous poll.
 943type PollAnswer struct {
 944	// PollID is the unique poll identifier
 945	PollID string `json:"poll_id"`
 946	// User who changed the answer to the poll
 947	User User `json:"user"`
 948	// OptionIDs is the 0-based identifiers of poll options chosen by the user.
 949	// May be empty if user retracted vote.
 950	OptionIDs []int `json:"option_ids"`
 951}
 952
 953// Poll contains information about a poll.
 954type Poll struct {
 955	// ID is the unique poll identifier
 956	ID string `json:"id"`
 957	// Question is the poll question, 1-255 characters
 958	Question string `json:"question"`
 959	// Options is the list of poll options
 960	Options []PollOption `json:"options"`
 961	// TotalVoterCount is the total numbers of users who voted in the poll
 962	TotalVoterCount int `json:"total_voter_count"`
 963	// IsClosed is if the poll is closed
 964	IsClosed bool `json:"is_closed"`
 965	// IsAnonymous is if the poll is anonymous
 966	IsAnonymous bool `json:"is_anonymous"`
 967	// Type is the poll type, currently can be "regular" or "quiz"
 968	Type string `json:"type"`
 969	// AllowsMultipleAnswers is true, if the poll allows multiple answers
 970	AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
 971	// CorrectOptionID is the 0-based identifier of the correct answer option.
 972	// Available only for polls in quiz mode, which are closed, or was sent (not
 973	// forwarded) by the bot or to the private chat with the bot.
 974	//
 975	// optional
 976	CorrectOptionID int `json:"correct_option_id,omitempty"`
 977	// Explanation is text that is shown when a user chooses an incorrect answer
 978	// or taps on the lamp icon in a quiz-style poll, 0-200 characters
 979	//
 980	// optional
 981	Explanation string `json:"explanation,omitempty"`
 982	// ExplainationEntities are special entities like usernames, URLs, bot
 983	// commands, etc. that appear in the explanation
 984	//
 985	// optional
 986	ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`
 987	// OpenPeriod is the amount of time in seconds the poll will be active
 988	// after creation
 989	//
 990	// optional
 991	OpenPeriod int `json:"open_period,omitempty"`
 992	// Closedate is the point in time (unix timestamp) when the poll will be
 993	// automatically closed
 994	//
 995	// optional
 996	CloseDate int `json:"close_date,omitempty"`
 997}
 998
 999// Location represents a point on the map.
1000type Location struct {
1001	// Longitude as defined by sender
1002	Longitude float64 `json:"longitude"`
1003	// Latitude as defined by sender
1004	Latitude float64 `json:"latitude"`
1005	// HorizontalAccuracy is the radius of uncertainty for the location,
1006	// measured in meters; 0-1500
1007	//
1008	// optional
1009	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
1010	// LivePeriod is time relative to the message sending date, during which the
1011	// location can be updated, in seconds. For active live locations only.
1012	//
1013	// optional
1014	LivePeriod int `json:"live_period,omitempty"`
1015	// Heading is the direction in which user is moving, in degrees; 1-360. For
1016	// active live locations only.
1017	//
1018	// optional
1019	Heading int `json:"heading,omitempty"`
1020	// ProximityAlertRadius is the maximum distance for proximity alerts about
1021	// approaching another chat member, in meters. For sent live locations only.
1022	//
1023	// optional
1024	ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
1025}
1026
1027// Venue represents a venue.
1028type Venue struct {
1029	// Location is the venue location
1030	Location Location `json:"location"`
1031	// Title is the name of the venue
1032	Title string `json:"title"`
1033	// Address of the venue
1034	Address string `json:"address"`
1035	// FoursquareID is the foursquare identifier of the venue
1036	//
1037	// optional
1038	FoursquareID string `json:"foursquare_id,omitempty"`
1039	// FoursquareType is the foursquare type of the venue
1040	//
1041	// optional
1042	FoursquareType string `json:"foursquare_type,omitempty"`
1043	// GooglePlaceID is the Google Places identifier of the venue
1044	//
1045	// optional
1046	GooglePlaceID string `json:"google_place_id,omitempty"`
1047	// GooglePlaceType is the Google Places type of the venue
1048	//
1049	// optional
1050	GooglePlaceType string `json:"google_place_type,omitempty"`
1051}
1052
1053// ProximityAlertTriggered represents a service message sent when a user in the
1054// chat triggers a proximity alert sent by another user.
1055type ProximityAlertTriggered struct {
1056	// Traveler is the user that triggered the alert
1057	Traveler User `json:"traveler"`
1058	// Watcher is the user that set the alert
1059	Watcher User `json:"watcher"`
1060	// Distance is the distance between the users
1061	Distance int `json:"distance"`
1062}
1063
1064// MessageAutoDeleteTimerChanged represents a service message about a change in
1065// auto-delete timer settings.
1066type MessageAutoDeleteTimerChanged struct {
1067	// New auto-delete time for messages in the chat.
1068	MessageAutoDeleteTime int `json:"message_auto_delete_time"`
1069}
1070
1071// VoiceChatStarted represents a service message about a voice chat started in
1072// the chat.
1073type VoiceChatStarted struct{}
1074
1075// VoiceChatEnded represents a service message about a voice chat ended in the
1076// chat.
1077type VoiceChatEnded struct {
1078	// Voice chat duration; in seconds.
1079	Duration int `json:"duration"`
1080}
1081
1082// VoiceChatParticipantsInvited represents a service message about new members
1083// invited to a voice chat.
1084type VoiceChatParticipantsInvited struct {
1085	// New members that were invited to the voice chat.
1086	//
1087	// optional
1088	Users []User `json:"users"`
1089}
1090
1091// UserProfilePhotos contains a set of user profile photos.
1092type UserProfilePhotos struct {
1093	// TotalCount total number of profile pictures the target user has
1094	TotalCount int `json:"total_count"`
1095	// Photos requested profile pictures (in up to 4 sizes each)
1096	Photos [][]PhotoSize `json:"photos"`
1097}
1098
1099// File contains information about a file to download from Telegram.
1100type File struct {
1101	// FileID identifier for this file, which can be used to download or reuse
1102	// the file
1103	FileID string `json:"file_id"`
1104	// FileUniqueID is the unique identifier for this file, which is supposed to
1105	// be the same over time and for different bots. Can't be used to download
1106	// or reuse the file.
1107	FileUniqueID string `json:"file_unique_id"`
1108	// FileSize file size, if known
1109	//
1110	// optional
1111	FileSize int `json:"file_size,omitempty"`
1112	// FilePath file path
1113	//
1114	// optional
1115	FilePath string `json:"file_path,omitempty"`
1116}
1117
1118// Link returns a full path to the download URL for a File.
1119//
1120// It requires the Bot token to create the link.
1121func (f *File) Link(token string) string {
1122	return fmt.Sprintf(FileEndpoint, token, f.FilePath)
1123}
1124
1125// ReplyKeyboardMarkup represents a custom keyboard with reply options.
1126type ReplyKeyboardMarkup struct {
1127	// Keyboard is an array of button rows, each represented by an Array of KeyboardButton objects
1128	Keyboard [][]KeyboardButton `json:"keyboard"`
1129	// ResizeKeyboard requests clients to resize the keyboard vertically for optimal fit
1130	// (e.g., make the keyboard smaller if there are just two rows of buttons).
1131	// Defaults to false, in which case the custom keyboard
1132	// is always of the same height as the app's standard keyboard.
1133	//
1134	// optional
1135	ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
1136	// OneTimeKeyboard requests clients to hide the keyboard as soon as it's been used.
1137	// The keyboard will still be available, but clients will automatically display
1138	// the usual letter-keyboard in the chat – the user can press a special button
1139	// in the input field to see the custom keyboard again.
1140	// Defaults to false.
1141	//
1142	// optional
1143	OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
1144	// Selective use this parameter if you want to show the keyboard to specific users only.
1145	// Targets:
1146	//  1) users that are @mentioned in the text of the Message object;
1147	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
1148	//
1149	// Example: A user requests to change the bot's language,
1150	// bot replies to the request with a keyboard to select the new language.
1151	// Other users in the group don't see the keyboard.
1152	//
1153	// optional
1154	Selective bool `json:"selective,omitempty"`
1155}
1156
1157// KeyboardButton represents one button of the reply keyboard. For simple text
1158// buttons String can be used instead of this object to specify text of the
1159// button. Optional fields request_contact, request_location, and request_poll
1160// are mutually exclusive.
1161type KeyboardButton struct {
1162	// Text of the button. If none of the optional fields are used,
1163	// it will be sent as a message when the button is pressed.
1164	Text string `json:"text"`
1165	// RequestContact if True, the user's phone number will be sent
1166	// as a contact when the button is pressed.
1167	// Available in private chats only.
1168	//
1169	// optional
1170	RequestContact bool `json:"request_contact,omitempty"`
1171	// RequestLocation if True, the user's current location will be sent when
1172	// the button is pressed.
1173	// Available in private chats only.
1174	//
1175	// optional
1176	RequestLocation bool `json:"request_location,omitempty"`
1177	// RequestPoll if True, the user will be asked to create a poll and send it
1178	// to the bot when the button is pressed. Available in private chats only
1179	//
1180	// optional
1181	RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
1182}
1183
1184// KeyboardButtonPollType represents type of a poll, which is allowed to
1185// be created and sent when the corresponding button is pressed.
1186type KeyboardButtonPollType struct {
1187	// Type is if quiz is passed, the user will be allowed to create only polls
1188	// in the quiz mode. If regular is passed, only regular polls will be
1189	// allowed. Otherwise, the user will be allowed to create a poll of any type.
1190	Type string `json:"type"`
1191}
1192
1193// ReplyKeyboardRemove Upon receiving a message with this object, Telegram
1194// clients will remove the current custom keyboard and display the default
1195// letter-keyboard. By default, custom keyboards are displayed until a new
1196// keyboard is sent by a bot. An exception is made for one-time keyboards
1197// that are hidden immediately after the user presses a button.
1198type ReplyKeyboardRemove struct {
1199	// RemoveKeyboard requests clients to remove the custom keyboard
1200	// (user will not be able to summon this keyboard;
1201	// if you want to hide the keyboard from sight but keep it accessible,
1202	// use one_time_keyboard in ReplyKeyboardMarkup).
1203	RemoveKeyboard bool `json:"remove_keyboard"`
1204	// Selective use this parameter if you want to remove the keyboard for specific users only.
1205	// Targets:
1206	//  1) users that are @mentioned in the text of the Message object;
1207	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
1208	//
1209	// Example: A user votes in a poll, bot returns confirmation message
1210	// in reply to the vote and removes the keyboard for that user,
1211	// while still showing the keyboard with poll options to users who haven't voted yet.
1212	//
1213	// optional
1214	Selective bool `json:"selective,omitempty"`
1215}
1216
1217// InlineKeyboardMarkup represents an inline keyboard that appears right next to
1218// the message it belongs to.
1219type InlineKeyboardMarkup struct {
1220	// InlineKeyboard array of button rows, each represented by an Array of
1221	// InlineKeyboardButton objects
1222	InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
1223}
1224
1225// InlineKeyboardButton represents one button of an inline keyboard. You must
1226// use exactly one of the optional fields.
1227//
1228// Note that some values are references as even an empty string
1229// will change behavior.
1230//
1231// CallbackGame, if set, MUST be first button in first row.
1232type InlineKeyboardButton struct {
1233	// Text label text on the button
1234	Text string `json:"text"`
1235	// URL HTTP or tg:// url to be opened when button is pressed.
1236	//
1237	// optional
1238	URL *string `json:"url,omitempty"`
1239	// LoginURL is an HTTP URL used to automatically authorize the user. Can be
1240	// used as a replacement for the Telegram Login Widget
1241	//
1242	// optional
1243	LoginURL *LoginURL `json:"login_url,omitempty"`
1244	// CallbackData data to be sent in a callback query to the bot when button is pressed, 1-64 bytes.
1245	//
1246	// optional
1247	CallbackData *string `json:"callback_data,omitempty"`
1248	// SwitchInlineQuery if set, pressing the button will prompt the user to select one of their chats,
1249	// open that chat and insert the bot's username and the specified inline query in the input field.
1250	// Can be empty, in which case just the bot's username will be inserted.
1251	//
1252	// This offers an easy way for users to start using your bot
1253	// in inline mode when they are currently in a private chat with it.
1254	// Especially useful when combined with switch_pm… actions – in this case
1255	// the user will be automatically returned to the chat they switched from,
1256	// skipping the chat selection screen.
1257	//
1258	// optional
1259	SwitchInlineQuery *string `json:"switch_inline_query,omitempty"`
1260	// SwitchInlineQueryCurrentChat if set, pressing the button will insert the bot's username
1261	// and the specified inline query in the current chat's input field.
1262	// Can be empty, in which case only the bot's username will be inserted.
1263	//
1264	// This offers a quick way for the user to open your bot in inline mode
1265	// in the same chat – good for selecting something from multiple options.
1266	//
1267	// optional
1268	SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"`
1269	// CallbackGame description of the game that will be launched when the user presses the button.
1270	//
1271	// optional
1272	CallbackGame *CallbackGame `json:"callback_game,omitempty"`
1273	// Pay specify True, to send a Pay button.
1274	//
1275	// NOTE: This type of button must always be the first button in the first row.
1276	//
1277	// optional
1278	Pay bool `json:"pay,omitempty"`
1279}
1280
1281// LoginURL represents a parameter of the inline keyboard button used to
1282// automatically authorize a user. Serves as a great replacement for the
1283// Telegram Login Widget when the user is coming from Telegram. All the user
1284// needs to do is tap/click a button and confirm that they want to log in.
1285type LoginURL struct {
1286	// URL is an HTTP URL to be opened with user authorization data added to the
1287	// query string when the button is pressed. If the user refuses to provide
1288	// authorization data, the original URL without information about the user
1289	// will be opened. The data added is the same as described in Receiving
1290	// authorization data.
1291	//
1292	// NOTE: You must always check the hash of the received data to verify the
1293	// authentication and the integrity of the data as described in Checking
1294	// authorization.
1295	URL string `json:"url"`
1296	// ForwardText is the new text of the button in forwarded messages
1297	//
1298	// optional
1299	ForwardText string `json:"forward_text,omitempty"`
1300	// BotUsername is the username of a bot, which will be used for user
1301	// authorization. See Setting up a bot for more details. If not specified,
1302	// the current bot's username will be assumed. The url's domain must be the
1303	// same as the domain linked with the bot. See Linking your domain to the
1304	// bot for more details.
1305	//
1306	// optional
1307	BotUsername string `json:"bot_username,omitempty"`
1308	// RequestWriteAccess if true requests permission for your bot to send
1309	// messages to the user
1310	//
1311	// optional
1312	RequestWriteAccess bool `json:"request_write_access,omitempty"`
1313}
1314
1315// CallbackQuery represents an incoming callback query from a callback button in
1316// an inline keyboard. If the button that originated the query was attached to a
1317// message sent by the bot, the field message will be present. If the button was
1318// attached to a message sent via the bot (in inline mode), the field
1319// inline_message_id will be present. Exactly one of the fields data or
1320// game_short_name will be present.
1321type CallbackQuery struct {
1322	// ID unique identifier for this query
1323	ID string `json:"id"`
1324	// From sender
1325	From *User `json:"from"`
1326	// Message with the callback button that originated the query.
1327	// Note that message content and message date will not be available if the
1328	// message is too old.
1329	//
1330	// optional
1331	Message *Message `json:"message,omitempty"`
1332	// InlineMessageID identifier of the message sent via the bot in inline
1333	// mode, that originated the query.
1334	//
1335	// optional
1336	InlineMessageID string `json:"inline_message_id,omitempty"`
1337	// ChatInstance global identifier, uniquely corresponding to the chat to
1338	// which the message with the callback button was sent. Useful for high
1339	// scores in games.
1340	ChatInstance string `json:"chat_instance"`
1341	// Data associated with the callback button. Be aware that
1342	// a bad client can send arbitrary data in this field.
1343	//
1344	// optional
1345	Data string `json:"data,omitempty"`
1346	// GameShortName short name of a Game to be returned, serves as the unique identifier for the game.
1347	//
1348	// optional
1349	GameShortName string `json:"game_short_name,omitempty"`
1350}
1351
1352// ForceReply when receiving a message with this object, Telegram clients will
1353// display a reply interface to the user (act as if the user has selected the
1354// bot's message and tapped 'Reply'). This can be extremely useful if you  want
1355// to create user-friendly step-by-step interfaces without having to sacrifice
1356// privacy mode.
1357type ForceReply struct {
1358	// ForceReply shows reply interface to the user,
1359	// as if they manually selected the bot's message and tapped 'Reply'.
1360	ForceReply bool `json:"force_reply"`
1361	// Selective use this parameter if you want to force reply from specific users only.
1362	// Targets:
1363	//  1) users that are @mentioned in the text of the Message object;
1364	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
1365	//
1366	// optional
1367	Selective bool `json:"selective,omitempty"`
1368}
1369
1370// ChatPhoto represents a chat photo.
1371type ChatPhoto struct {
1372	// SmallFileID is a file identifier of small (160x160) chat photo.
1373	// This file_id can be used only for photo download and
1374	// only for as long as the photo is not changed.
1375	SmallFileID string `json:"small_file_id"`
1376	// SmallFileUniqueID is a unique file identifier of small (160x160) chat
1377	// photo, which is supposed to be the same over time and for different bots.
1378	// Can't be used to download or reuse the file.
1379	SmallFileUniqueID string `json:"small_file_unique_id"`
1380	// BigFileID is a file identifier of big (640x640) chat photo.
1381	// This file_id can be used only for photo download and
1382	// only for as long as the photo is not changed.
1383	BigFileID string `json:"big_file_id"`
1384	// BigFileUniqueID is a file identifier of big (640x640) chat photo, which
1385	// is supposed to be the same over time and for different bots. Can't be
1386	// used to download or reuse the file.
1387	BigFileUniqueID string `json:"big_file_unique_id"`
1388}
1389
1390// ChatInviteLink represents an invite link for a chat.
1391type ChatInviteLink struct {
1392	// InviteLink is the invite link. If the link was created by another chat
1393	// administrator, then the second part of the link will be replaced with “…”.
1394	InviteLink string `json:"invite_link"`
1395	// Creator of the link.
1396	Creator User `json:"creator"`
1397	// IsPrimary is true, if the link is primary.
1398	IsPrimary bool `json:"is_primary"`
1399	// IsRevoked is true, if the link is revoked.
1400	IsRevoked bool `json:"is_revoked"`
1401	// ExpireDate is the point in time (Unix timestamp) when the link will
1402	// expire or has been expired.
1403	//
1404	// optional
1405	ExpireDate int `json:"expire_date"`
1406	// MemberLimit is the maximum number of users that can be members of the
1407	// chat simultaneously after joining the chat via this invite link; 1-99999.
1408	//
1409	// optional
1410	MemberLimit int `json:"member_limit"`
1411}
1412
1413// ChatMember contains information about one member of a chat.
1414type ChatMember struct {
1415	// User information about the user
1416	User *User `json:"user"`
1417	// Status the member's status in the chat.
1418	// Can be
1419	//  “creator”,
1420	//  “administrator”,
1421	//  “member”,
1422	//  “restricted”,
1423	//  “left” or
1424	//  “kicked”
1425	Status string `json:"status"`
1426	// CustomTitle owner and administrators only. Custom title for this user
1427	//
1428	// optional
1429	CustomTitle string `json:"custom_title,omitempty"`
1430	// IsAnonymous owner and administrators only. True, if the user's presence
1431	// in the chat is hidden
1432	//
1433	// optional
1434	IsAnonymous bool `json:"is_anonymous"`
1435	// UntilDate restricted and kicked only.
1436	// Date when restrictions will be lifted for this user;
1437	// unix time.
1438	//
1439	// optional
1440	UntilDate int64 `json:"until_date,omitempty"`
1441	// CanBeEdited administrators only.
1442	// True, if the bot is allowed to edit administrator privileges of that user.
1443	//
1444	// optional
1445	CanBeEdited bool `json:"can_be_edited,omitempty"`
1446	// CanManageChat administrators only.
1447	// True, if the administrator can access the chat event log, chat
1448	// statistics, message statistics in channels, see channel members, see
1449	// anonymous administrators in supergoups and ignore slow mode. Implied by
1450	// any other administrator privilege.
1451	//
1452	// optional
1453	CanManageChat bool `json:"can_manage_chat"`
1454	// CanPostMessages administrators only.
1455	// True, if the administrator can post in the channel;
1456	// channels only.
1457	//
1458	// optional
1459	CanPostMessages bool `json:"can_post_messages,omitempty"`
1460	// CanEditMessages administrators only.
1461	// True, if the administrator can edit messages of other users and can pin messages;
1462	// channels only.
1463	//
1464	// optional
1465	CanEditMessages bool `json:"can_edit_messages,omitempty"`
1466	// CanDeleteMessages administrators only.
1467	// True, if the administrator can delete messages of other users.
1468	//
1469	// optional
1470	CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
1471	// CanManageVoiceChats administrators only.
1472	// True, if the administrator can manage voice chats.
1473	//
1474	// optional
1475	CanManageVoiceChats bool `json:"can_manage_voice_chats"`
1476	// CanRestrictMembers administrators only.
1477	// True, if the administrator can restrict, ban or unban chat members.
1478	//
1479	// optional
1480	CanRestrictMembers bool `json:"can_restrict_members,omitempty"`
1481	// CanPromoteMembers administrators only.
1482	// True, if the administrator can add new administrators
1483	// with a subset of their own privileges or demote administrators that he has promoted,
1484	// directly or indirectly (promoted by administrators that were appointed by the user).
1485	//
1486	// optional
1487	CanPromoteMembers bool `json:"can_promote_members,omitempty"`
1488	// CanChangeInfo administrators and restricted only.
1489	// True, if the user is allowed to change the chat title, photo and other settings.
1490	//
1491	// optional
1492	CanChangeInfo bool `json:"can_change_info,omitempty"`
1493	// CanInviteUsers administrators and restricted only.
1494	// True, if the user is allowed to invite new users to the chat.
1495	//
1496	// optional
1497	CanInviteUsers bool `json:"can_invite_users,omitempty"`
1498	// CanPinMessages administrators and restricted only.
1499	// True, if the user is allowed to pin messages; groups and supergroups only
1500	//
1501	// optional
1502	CanPinMessages bool `json:"can_pin_messages,omitempty"`
1503	// IsMember is true, if the user is a member of the chat at the moment of
1504	// the request
1505	IsMember bool `json:"is_member"`
1506	// CanSendMessages
1507	//
1508	// optional
1509	CanSendMessages bool `json:"can_send_messages,omitempty"`
1510	// CanSendMediaMessages restricted only.
1511	// True, if the user is allowed to send text messages, contacts, locations and venues
1512	//
1513	// optional
1514	CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"`
1515	// CanSendPolls restricted only.
1516	// True, if the user is allowed to send polls
1517	//
1518	// optional
1519	CanSendPolls bool `json:"can_send_polls,omitempty"`
1520	// CanSendOtherMessages restricted only.
1521	// True, if the user is allowed to send audios, documents,
1522	// photos, videos, video notes and voice notes.
1523	//
1524	// optional
1525	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
1526	// CanAddWebPagePreviews restricted only.
1527	// True, if the user is allowed to add web page previews to their messages.
1528	//
1529	// optional
1530	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
1531}
1532
1533// IsCreator returns if the ChatMember was the creator of the chat.
1534func (chat ChatMember) IsCreator() bool { return chat.Status == "creator" }
1535
1536// IsAdministrator returns if the ChatMember is a chat administrator.
1537func (chat ChatMember) IsAdministrator() bool { return chat.Status == "administrator" }
1538
1539// HasLeft returns if the ChatMember left the chat.
1540func (chat ChatMember) HasLeft() bool { return chat.Status == "left" }
1541
1542// WasKicked returns if the ChatMember was kicked from the chat.
1543func (chat ChatMember) WasKicked() bool { return chat.Status == "kicked" }
1544
1545// ChatMemberUpdated represents changes in the status of a chat member.
1546type ChatMemberUpdated struct {
1547	// Chat the user belongs to.
1548	Chat Chat `json:"chat"`
1549	// From is the performer of the action, which resulted in the change.
1550	From User `json:"from"`
1551	// Date the change was done in Unix time.
1552	Date int `json:"date"`
1553	// Previous information about the chat member.
1554	OldChatMember ChatMember `json:"old_chat_member"`
1555	// New information about the chat member.
1556	NewChatMember ChatMember `json:"new_chat_member"`
1557	// InviteLink is the link which was used by the user to join the chat;
1558	// for joining by invite link events only.
1559	//
1560	// optional
1561	InviteLink *ChatInviteLink `json:"invite_link"`
1562}
1563
1564// ChatPermissions describes actions that a non-administrator user is
1565// allowed to take in a chat. All fields are optional.
1566type ChatPermissions struct {
1567	// CanSendMessages is true, if the user is allowed to send text messages,
1568	// contacts, locations and venues
1569	//
1570	// optional
1571	CanSendMessages bool `json:"can_send_messages,omitempty"`
1572	// CanSendMediaMessages is true, if the user is allowed to send audios,
1573	// documents, photos, videos, video notes and voice notes, implies
1574	// can_send_messages
1575	//
1576	// optional
1577	CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"`
1578	// CanSendPolls is true, if the user is allowed to send polls, implies
1579	// can_send_messages
1580	//
1581	// optional
1582	CanSendPolls bool `json:"can_send_polls,omitempty"`
1583	// CanSendOtherMessages is true, if the user is allowed to send animations,
1584	// games, stickers and use inline bots, implies can_send_media_messages
1585	//
1586	// optional
1587	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
1588	// CanAddWebPagePreviews is true, if the user is allowed to add web page
1589	// previews to their messages, implies can_send_media_messages
1590	//
1591	// optional
1592	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
1593	// CanChangeInfo is true, if the user is allowed to change the chat title,
1594	// photo and other settings. Ignored in public supergroups
1595	//
1596	// optional
1597	CanChangeInfo bool `json:"can_change_info,omitempty"`
1598	// CanInviteUsers is true, if the user is allowed to invite new users to the
1599	// chat
1600	//
1601	// optional
1602	CanInviteUsers bool `json:"can_invite_users,omitempty"`
1603	// CanPinMessages is true, if the user is allowed to pin messages. Ignored
1604	// in public supergroups
1605	//
1606	// optional
1607	CanPinMessages bool `json:"can_pin_messages,omitempty"`
1608}
1609
1610// ChatLocation represents a location to which a chat is connected.
1611type ChatLocation struct {
1612	// Location is the location to which the supergroup is connected. Can't be a
1613	// live location.
1614	Location Location `json:"location"`
1615	// Address is the location address; 1-64 characters, as defined by the chat
1616	// owner
1617	Address string `json:"address"`
1618}
1619
1620// BotCommand represents a bot command.
1621type BotCommand struct {
1622	// Command text of the command, 1-32 characters.
1623	// Can contain only lowercase English letters, digits and underscores.
1624	Command string `json:"command"`
1625	// Description of the command, 3-256 characters.
1626	Description string `json:"description"`
1627}
1628
1629// ResponseParameters are various errors that can be returned in APIResponse.
1630type ResponseParameters struct {
1631	// The group has been migrated to a supergroup with the specified identifier.
1632	//
1633	// optional
1634	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
1635	// In case of exceeding flood control, the number of seconds left to wait
1636	// before the request can be repeated.
1637	//
1638	// optional
1639	RetryAfter int `json:"retry_after,omitempty"`
1640}
1641
1642// BaseInputMedia is a base type for the InputMedia types.
1643type BaseInputMedia struct {
1644	// Type of the result.
1645	Type string `json:"type"`
1646	// Media file to send. Pass a file_id to send a file
1647	// that exists on the Telegram servers (recommended),
1648	// pass an HTTP URL for Telegram to get a file from the Internet,
1649	// or pass “attach://<file_attach_name>” to upload a new one
1650	// using multipart/form-data under <file_attach_name> name.
1651	Media interface{} `json:"media"`
1652	// thumb intentionally missing as it is not currently compatible
1653
1654	// Caption of the video to be sent, 0-1024 characters after entities parsing.
1655	//
1656	// optional
1657	Caption string `json:"caption,omitempty"`
1658	// ParseMode mode for parsing entities in the video caption.
1659	// See formatting options for more details
1660	// (https://core.telegram.org/bots/api#formatting-options).
1661	//
1662	// optional
1663	ParseMode string `json:"parse_mode,omitempty"`
1664	// CaptionEntities is a list of special entities that appear in the caption,
1665	// which can be specified instead of parse_mode
1666	//
1667	// optional
1668	CaptionEntities []MessageEntity `json:"caption_entities"`
1669}
1670
1671// InputMediaPhoto is a photo to send as part of a media group.
1672type InputMediaPhoto struct {
1673	BaseInputMedia
1674}
1675
1676// InputMediaVideo is a video to send as part of a media group.
1677type InputMediaVideo struct {
1678	BaseInputMedia
1679	// Thumbnail of the file sent; can be ignored if thumbnail generation for
1680	// the file is supported server-side.
1681	//
1682	// optional
1683	Thumb interface{} `json:"thumb"`
1684	// Width video width
1685	//
1686	// optional
1687	Width int `json:"width,omitempty"`
1688	// Height video height
1689	//
1690	// optional
1691	Height int `json:"height,omitempty"`
1692	// Duration video duration
1693	//
1694	// optional
1695	Duration int `json:"duration,omitempty"`
1696	// SupportsStreaming pass True, if the uploaded video is suitable for streaming.
1697	//
1698	// optional
1699	SupportsStreaming bool `json:"supports_streaming,omitempty"`
1700}
1701
1702// InputMediaAnimation is an animation to send as part of a media group.
1703type InputMediaAnimation struct {
1704	BaseInputMedia
1705	// Thumbnail of the file sent; can be ignored if thumbnail generation for
1706	// the file is supported server-side.
1707	//
1708	// optional
1709	Thumb interface{} `json:"thumb"`
1710	// Width video width
1711	//
1712	// optional
1713	Width int `json:"width,omitempty"`
1714	// Height video height
1715	//
1716	// optional
1717	Height int `json:"height,omitempty"`
1718	// Duration video duration
1719	//
1720	// optional
1721	Duration int `json:"duration,omitempty"`
1722}
1723
1724// InputMediaAudio is a audio to send as part of a media group.
1725type InputMediaAudio struct {
1726	BaseInputMedia
1727	// Thumbnail of the file sent; can be ignored if thumbnail generation for
1728	// the file is supported server-side.
1729	//
1730	// optional
1731	Thumb interface{} `json:"thumb"`
1732	// Duration of the audio in seconds
1733	//
1734	// optional
1735	Duration int `json:"duration,omitempty"`
1736	// Performer of the audio
1737	//
1738	// optional
1739	Performer string `json:"performer,omitempty"`
1740	// Title of the audio
1741	//
1742	// optional
1743	Title string `json:"title,omitempty"`
1744}
1745
1746// InputMediaDocument is a general file to send as part of a media group.
1747type InputMediaDocument struct {
1748	BaseInputMedia
1749	// Thumbnail of the file sent; can be ignored if thumbnail generation for
1750	// the file is supported server-side.
1751	//
1752	// optional
1753	Thumb interface{} `json:"thumb"`
1754	// DisableContentTypeDetection disables automatic server-side content type
1755	// detection for files uploaded using multipart/form-data. Always true, if
1756	// the document is sent as part of an album
1757	//
1758	// optional
1759	DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"`
1760}
1761
1762// Sticker represents a sticker.
1763type Sticker struct {
1764	// FileID is an identifier for this file, which can be used to download or
1765	// reuse the file
1766	FileID string `json:"file_id"`
1767	// FileUniqueID is an unique identifier for this file,
1768	// which is supposed to be the same over time and for different bots.
1769	// Can't be used to download or reuse the file.
1770	FileUniqueID string `json:"file_unique_id"`
1771	// Width sticker width
1772	Width int `json:"width"`
1773	// Height sticker height
1774	Height int `json:"height"`
1775	// IsAnimated true, if the sticker is animated
1776	//
1777	// optional
1778	IsAnimated bool `json:"is_animated,omitempty"`
1779	// Thumbnail sticker thumbnail in the .WEBP or .JPG format
1780	//
1781	// optional
1782	Thumbnail *PhotoSize `json:"thumb,omitempty"`
1783	// Emoji associated with the sticker
1784	//
1785	// optional
1786	Emoji string `json:"emoji,omitempty"`
1787	// SetName of the sticker set to which the sticker belongs
1788	//
1789	// optional
1790	SetName string `json:"set_name,omitempty"`
1791	// MaskPosition is for mask stickers, the position where the mask should be
1792	// placed
1793	//
1794	// optional
1795	MaskPosition *MaskPosition `json:"mask_position,omitempty"`
1796	// FileSize
1797	//
1798	// optional
1799	FileSize int `json:"file_size,omitempty"`
1800}
1801
1802// StickerSet represents a sticker set.
1803type StickerSet struct {
1804	// Name sticker set name
1805	Name string `json:"name"`
1806	// Title sticker set title
1807	Title string `json:"title"`
1808	// IsAnimated true, if the sticker set contains animated stickers
1809	IsAnimated bool `json:"is_animated"`
1810	// ContainsMasks true, if the sticker set contains masks
1811	ContainsMasks bool `json:"contains_masks"`
1812	// Stickers list of all set stickers
1813	Stickers []Sticker `json:"stickers"`
1814	// Thumb is the sticker set thumbnail in the .WEBP or .TGS format
1815	Thumbnail *PhotoSize `json:"thumb"`
1816}
1817
1818// MaskPosition describes the position on faces where a mask should be placed
1819// by default.
1820type MaskPosition struct {
1821	// The part of the face relative to which the mask should be placed.
1822	// One of “forehead”, “eyes”, “mouth”, or “chin”.
1823	Point string `json:"point"`
1824	// Shift by X-axis measured in widths of the mask scaled to the face size,
1825	// from left to right. For example, choosing -1.0 will place mask just to
1826	// the left of the default mask position.
1827	XShift float64 `json:"x_shift"`
1828	// Shift by Y-axis measured in heights of the mask scaled to the face size,
1829	// from top to bottom. For example, 1.0 will place the mask just below the
1830	// default mask position.
1831	YShift float64 `json:"y_shift"`
1832	// Mask scaling coefficient. For example, 2.0 means double size.
1833	Scale float64 `json:"scale"`
1834}
1835
1836// Game represents a game. Use BotFather to create and edit games, their short
1837// names will act as unique identifiers.
1838type Game struct {
1839	// Title of the game
1840	Title string `json:"title"`
1841	// Description of the game
1842	Description string `json:"description"`
1843	// Photo that will be displayed in the game message in chats.
1844	Photo []PhotoSize `json:"photo"`
1845	// Text a brief description of the game or high scores included in the game message.
1846	// Can be automatically edited to include current high scores for the game
1847	// when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
1848	//
1849	// optional
1850	Text string `json:"text,omitempty"`
1851	// TextEntities special entities that appear in text, such as usernames, URLs, bot commands, etc.
1852	//
1853	// optional
1854	TextEntities []MessageEntity `json:"text_entities,omitempty"`
1855	// Animation animation that will be displayed in the game message in chats.
1856	// Upload via BotFather (https://t.me/botfather).
1857	//
1858	// optional
1859	Animation Animation `json:"animation,omitempty"`
1860}
1861
1862// GameHighScore is a user's score and position on the leaderboard.
1863type GameHighScore struct {
1864	// Position in high score table for the game
1865	Position int `json:"position"`
1866	// User user
1867	User User `json:"user"`
1868	// Score score
1869	Score int `json:"score"`
1870}
1871
1872// CallbackGame is for starting a game in an inline keyboard button.
1873type CallbackGame struct{}
1874
1875// WebhookInfo is information about a currently set webhook.
1876type WebhookInfo struct {
1877	// URL webhook URL, may be empty if webhook is not set up.
1878	URL string `json:"url"`
1879	// HasCustomCertificate true, if a custom certificate was provided for webhook certificate checks.
1880	HasCustomCertificate bool `json:"has_custom_certificate"`
1881	// PendingUpdateCount number of updates awaiting delivery.
1882	PendingUpdateCount int `json:"pending_update_count"`
1883	// IPAddress is the currently used webhook IP address
1884	//
1885	// optional
1886	IPAddress string `json:"ip_address,omitempty"`
1887	// LastErrorDate unix time for the most recent error
1888	// that happened when trying to deliver an update via webhook.
1889	//
1890	// optional
1891	LastErrorDate int `json:"last_error_date,omitempty"`
1892	// LastErrorMessage error message in human-readable format for the most recent error
1893	// that happened when trying to deliver an update via webhook.
1894	//
1895	// optional
1896	LastErrorMessage string `json:"last_error_message,omitempty"`
1897	// MaxConnections maximum allowed number of simultaneous
1898	// HTTPS connections to the webhook for update delivery.
1899	//
1900	// optional
1901	MaxConnections int `json:"max_connections,omitempty"`
1902	// AllowedUpdates is a list of update types the bot is subscribed to.
1903	// Defaults to all update types
1904	//
1905	// optional
1906	AllowedUpdates []string `json:"allowed_updates,omitempty"`
1907}
1908
1909// IsSet returns true if a webhook is currently set.
1910func (info WebhookInfo) IsSet() bool {
1911	return info.URL != ""
1912}
1913
1914// InlineQuery is a Query from Telegram for an inline request.
1915type InlineQuery struct {
1916	// ID unique identifier for this query
1917	ID string `json:"id"`
1918	// From sender
1919	From *User `json:"from"`
1920	// Location sender location, only for bots that request user location.
1921	//
1922	// optional
1923	Location *Location `json:"location,omitempty"`
1924	// Query text of the query (up to 256 characters).
1925	Query string `json:"query"`
1926	// Offset of the results to be returned, can be controlled by the bot.
1927	Offset string `json:"offset"`
1928}
1929
1930// InlineQueryResultCachedAudio is an inline query response with cached audio.
1931type InlineQueryResultCachedAudio struct {
1932	// Type of the result, must be audio
1933	Type string `json:"type"`
1934	// ID unique identifier for this result, 1-64 bytes
1935	ID string `json:"id"`
1936	// AudioID a valid file identifier for the audio file
1937	AudioID string `json:"audio_file_id"`
1938	// Caption 0-1024 characters after entities parsing
1939	//
1940	// optional
1941	Caption string `json:"caption,omitempty"`
1942	// ParseMode mode for parsing entities in the video caption.
1943	// See formatting options for more details
1944	// (https://core.telegram.org/bots/api#formatting-options).
1945	//
1946	// optional
1947	ParseMode string `json:"parse_mode,omitempty"`
1948	// CaptionEntities is a list of special entities that appear in the caption,
1949	// which can be specified instead of parse_mode
1950	//
1951	// optional
1952	CaptionEntities []MessageEntity `json:"caption_entities"`
1953	// ReplyMarkup inline keyboard attached to the message
1954	//
1955	// optional
1956	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1957	// InputMessageContent content of the message to be sent instead of the audio
1958	//
1959	// optional
1960	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1961}
1962
1963// InlineQueryResultCachedDocument is an inline query response with cached document.
1964type InlineQueryResultCachedDocument struct {
1965	// Type of the result, must be document
1966	Type string `json:"type"`
1967	// ID unique identifier for this result, 1-64 bytes
1968	ID string `json:"id"`
1969	// DocumentID a valid file identifier for the file
1970	DocumentID string `json:"document_file_id"`
1971	// Title for the result
1972	//
1973	// optional
1974	Title string `json:"title,omitempty"`
1975	// Caption of the document to be sent, 0-1024 characters after entities parsing
1976	//
1977	// optional
1978	Caption string `json:"caption,omitempty"`
1979	// Description short description of the result
1980	//
1981	// optional
1982	Description string `json:"description,omitempty"`
1983	// ParseMode mode for parsing entities in the video caption.
1984	//	// See formatting options for more details
1985	//	// (https://core.telegram.org/bots/api#formatting-options).
1986	//
1987	// optional
1988	ParseMode string `json:"parse_mode,omitempty"`
1989	// CaptionEntities is a list of special entities that appear in the caption,
1990	// which can be specified instead of parse_mode
1991	//
1992	// optional
1993	CaptionEntities []MessageEntity `json:"caption_entities"`
1994	// ReplyMarkup inline keyboard attached to the message
1995	//
1996	// optional
1997	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1998	// InputMessageContent content of the message to be sent instead of the file
1999	//
2000	// optional
2001	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2002}
2003
2004// InlineQueryResultCachedGIF is an inline query response with cached gif.
2005type InlineQueryResultCachedGIF struct {
2006	// Type of the result, must be gif.
2007	Type string `json:"type"`
2008	// ID unique identifier for this result, 1-64 bytes.
2009	ID string `json:"id"`
2010	// GifID a valid file identifier for the GIF file.
2011	GIFID string `json:"gif_file_id"`
2012	// Title for the result
2013	//
2014	// optional
2015	Title string `json:"title,omitempty"`
2016	// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
2017	//
2018	// optional
2019	Caption string `json:"caption,omitempty"`
2020	// ParseMode mode for parsing entities in the caption.
2021	// See formatting options for more details
2022	// (https://core.telegram.org/bots/api#formatting-options).
2023	//
2024	// optional
2025	ParseMode string `json:"parse_mode,omitempty"`
2026	// CaptionEntities is a list of special entities that appear in the caption,
2027	// which can be specified instead of parse_mode
2028	//
2029	// optional
2030	CaptionEntities []MessageEntity `json:"caption_entities"`
2031	// ReplyMarkup inline keyboard attached to the message.
2032	//
2033	// optional
2034	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2035	// InputMessageContent content of the message to be sent instead of the GIF animation.
2036	//
2037	// optional
2038	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2039}
2040
2041// InlineQueryResultCachedMPEG4GIF is an inline query response with cached
2042// H.264/MPEG-4 AVC video without sound gif.
2043type InlineQueryResultCachedMPEG4GIF struct {
2044	// Type of the result, must be mpeg4_gif
2045	Type string `json:"type"`
2046	// ID unique identifier for this result, 1-64 bytes
2047	ID string `json:"id"`
2048	// MPEG4FileID a valid file identifier for the MP4 file
2049	MPEG4FileID string `json:"mpeg4_file_id"`
2050	// Title for the result
2051	//
2052	// optional
2053	Title string `json:"title,omitempty"`
2054	// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
2055	//
2056	// optional
2057	Caption string `json:"caption,omitempty"`
2058	// ParseMode mode for parsing entities in the caption.
2059	// See formatting options for more details
2060	// (https://core.telegram.org/bots/api#formatting-options).
2061	//
2062	// optional
2063	ParseMode string `json:"parse_mode,omitempty"`
2064	// ParseMode mode for parsing entities in the video caption.
2065	// See formatting options for more details
2066	// (https://core.telegram.org/bots/api#formatting-options).
2067	//
2068	// optional
2069	CaptionEntities []MessageEntity `json:"caption_entities"`
2070	// ReplyMarkup inline keyboard attached to the message.
2071	//
2072	// optional
2073	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2074	// InputMessageContent content of the message to be sent instead of the video animation.
2075	//
2076	// optional
2077	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2078}
2079
2080// InlineQueryResultCachedPhoto is an inline query response with cached photo.
2081type InlineQueryResultCachedPhoto struct {
2082	// Type of the result, must be photo.
2083	Type string `json:"type"`
2084	// ID unique identifier for this result, 1-64 bytes.
2085	ID string `json:"id"`
2086	// PhotoID a valid file identifier of the photo.
2087	PhotoID string `json:"photo_file_id"`
2088	// Title for the result.
2089	//
2090	// optional
2091	Title string `json:"title,omitempty"`
2092	// Description short description of the result.
2093	//
2094	// optional
2095	Description string `json:"description,omitempty"`
2096	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
2097	//
2098	// optional
2099	Caption string `json:"caption,omitempty"`
2100	// ParseMode mode for parsing entities in the photo caption.
2101	// See formatting options for more details
2102	// (https://core.telegram.org/bots/api#formatting-options).
2103	//
2104	// optional
2105	ParseMode string `json:"parse_mode,omitempty"`
2106	// CaptionEntities is a list of special entities that appear in the caption,
2107	// which can be specified instead of parse_mode
2108	//
2109	// optional
2110	CaptionEntities []MessageEntity `json:"caption_entities"`
2111	// ReplyMarkup inline keyboard attached to the message.
2112	//
2113	// optional
2114	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2115	// InputMessageContent content of the message to be sent instead of the photo.
2116	//
2117	// optional
2118	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2119}
2120
2121// InlineQueryResultCachedSticker is an inline query response with cached sticker.
2122type InlineQueryResultCachedSticker struct {
2123	// Type of the result, must be sticker
2124	Type string `json:"type"`
2125	// ID unique identifier for this result, 1-64 bytes
2126	ID string `json:"id"`
2127	// StickerID a valid file identifier of the sticker
2128	StickerID string `json:"sticker_file_id"`
2129	// Title is a title
2130	Title string `json:"title"`
2131	// ReplyMarkup inline keyboard attached to the message
2132	//
2133	// optional
2134	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2135	// InputMessageContent content of the message to be sent instead of the sticker
2136	//
2137	// optional
2138	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2139}
2140
2141// InlineQueryResultCachedVideo is an inline query response with cached video.
2142type InlineQueryResultCachedVideo struct {
2143	// Type of the result, must be video
2144	Type string `json:"type"`
2145	// ID unique identifier for this result, 1-64 bytes
2146	ID string `json:"id"`
2147	// VideoID a valid file identifier for the video file
2148	VideoID string `json:"video_file_id"`
2149	// Title for the result
2150	Title string `json:"title"`
2151	// Description short description of the result
2152	//
2153	// optional
2154	Description string `json:"description,omitempty"`
2155	// Caption of the video to be sent, 0-1024 characters after entities parsing
2156	//
2157	// optional
2158	Caption string `json:"caption,omitempty"`
2159	// ParseMode mode for parsing entities in the video caption.
2160	// See formatting options for more details
2161	// (https://core.telegram.org/bots/api#formatting-options).
2162	//
2163	// optional
2164	ParseMode string `json:"parse_mode,omitempty"`
2165	// CaptionEntities is a list of special entities that appear in the caption,
2166	// which can be specified instead of parse_mode
2167	//
2168	// optional
2169	CaptionEntities []MessageEntity `json:"caption_entities"`
2170	// ReplyMarkup inline keyboard attached to the message
2171	//
2172	// optional
2173	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2174	// InputMessageContent content of the message to be sent instead of the video
2175	//
2176	// optional
2177	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2178}
2179
2180// InlineQueryResultCachedVoice is an inline query response with cached voice.
2181type InlineQueryResultCachedVoice struct {
2182	// Type of the result, must be voice
2183	Type string `json:"type"`
2184	// ID unique identifier for this result, 1-64 bytes
2185	ID string `json:"id"`
2186	// VoiceID a valid file identifier for the voice message
2187	VoiceID string `json:"voice_file_id"`
2188	// Title voice message title
2189	Title string `json:"title"`
2190	// Caption 0-1024 characters after entities parsing
2191	//
2192	// optional
2193	Caption string `json:"caption,omitempty"`
2194	// ParseMode mode for parsing entities in the video caption.
2195	// See formatting options for more details
2196	// (https://core.telegram.org/bots/api#formatting-options).
2197	//
2198	// optional
2199	ParseMode string `json:"parse_mode,omitempty"`
2200	// CaptionEntities is a list of special entities that appear in the caption,
2201	// which can be specified instead of parse_mode
2202	//
2203	// optional
2204	CaptionEntities []MessageEntity `json:"caption_entities"`
2205	// ReplyMarkup inline keyboard attached to the message
2206	//
2207	// optional
2208	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2209	// InputMessageContent content of the message to be sent instead of the voice message
2210	//
2211	// optional
2212	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2213}
2214
2215// InlineQueryResultArticle represents a link to an article or web page.
2216type InlineQueryResultArticle struct {
2217	// Type of the result, must be article.
2218	Type string `json:"type"`
2219	// ID unique identifier for this result, 1-64 Bytes.
2220	ID string `json:"id"`
2221	// Title of the result
2222	Title string `json:"title"`
2223	// InputMessageContent content of the message to be sent.
2224	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2225	// ReplyMarkup Inline keyboard attached to the message.
2226	//
2227	// optional
2228	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2229	// URL of the result.
2230	//
2231	// optional
2232	URL string `json:"url,omitempty"`
2233	// HideURL pass True, if you don't want the URL to be shown in the message.
2234	//
2235	// optional
2236	HideURL bool `json:"hide_url,omitempty"`
2237	// Description short description of the result.
2238	//
2239	// optional
2240	Description string `json:"description,omitempty"`
2241	// ThumbURL url of the thumbnail for the result
2242	//
2243	// optional
2244	ThumbURL string `json:"thumb_url,omitempty"`
2245	// ThumbWidth thumbnail width
2246	//
2247	// optional
2248	ThumbWidth int `json:"thumb_width,omitempty"`
2249	// ThumbHeight thumbnail height
2250	//
2251	// optional
2252	ThumbHeight int `json:"thumb_height,omitempty"`
2253}
2254
2255// InlineQueryResultAudio is an inline query response audio.
2256type InlineQueryResultAudio struct {
2257	// Type of the result, must be audio
2258	Type string `json:"type"`
2259	// ID unique identifier for this result, 1-64 bytes
2260	ID string `json:"id"`
2261	// URL a valid url for the audio file
2262	URL string `json:"audio_url"`
2263	// Title is a title
2264	Title string `json:"title"`
2265	// Caption 0-1024 characters after entities parsing
2266	//
2267	// optional
2268	Caption string `json:"caption,omitempty"`
2269	// ParseMode mode for parsing entities in the video caption.
2270	// See formatting options for more details
2271	// (https://core.telegram.org/bots/api#formatting-options).
2272	//
2273	// optional
2274	ParseMode string `json:"parse_mode,omitempty"`
2275	// CaptionEntities is a list of special entities that appear in the caption,
2276	// which can be specified instead of parse_mode
2277	//
2278	// optional
2279	CaptionEntities []MessageEntity `json:"caption_entities"`
2280	// Performer is a performer
2281	//
2282	// optional
2283	Performer string `json:"performer,omitempty"`
2284	// Duration audio duration in seconds
2285	//
2286	// optional
2287	Duration int `json:"audio_duration,omitempty"`
2288	// ReplyMarkup inline keyboard attached to the message
2289	//
2290	// optional
2291	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2292	// InputMessageContent content of the message to be sent instead of the audio
2293	//
2294	// optional
2295	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2296}
2297
2298// InlineQueryResultContact is an inline query response contact.
2299type InlineQueryResultContact struct {
2300	Type                string                `json:"type"`         // required
2301	ID                  string                `json:"id"`           // required
2302	PhoneNumber         string                `json:"phone_number"` // required
2303	FirstName           string                `json:"first_name"`   // required
2304	LastName            string                `json:"last_name"`
2305	VCard               string                `json:"vcard"`
2306	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2307	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
2308	ThumbURL            string                `json:"thumb_url"`
2309	ThumbWidth          int                   `json:"thumb_width"`
2310	ThumbHeight         int                   `json:"thumb_height"`
2311}
2312
2313// InlineQueryResultGame is an inline query response game.
2314type InlineQueryResultGame struct {
2315	// Type of the result, must be game
2316	Type string `json:"type"`
2317	// ID unique identifier for this result, 1-64 bytes
2318	ID string `json:"id"`
2319	// GameShortName short name of the game
2320	GameShortName string `json:"game_short_name"`
2321	// ReplyMarkup inline keyboard attached to the message
2322	//
2323	// optional
2324	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2325}
2326
2327// InlineQueryResultDocument is an inline query response document.
2328type InlineQueryResultDocument struct {
2329	// Type of the result, must be document
2330	Type string `json:"type"`
2331	// ID unique identifier for this result, 1-64 bytes
2332	ID string `json:"id"`
2333	// Title for the result
2334	Title string `json:"title"`
2335	// Caption of the document to be sent, 0-1024 characters after entities parsing
2336	//
2337	// optional
2338	Caption string `json:"caption,omitempty"`
2339	// URL a valid url for the file
2340	URL string `json:"document_url"`
2341	// MimeType of the content of the file, either “application/pdf” or “application/zip”
2342	MimeType string `json:"mime_type"`
2343	// Description short description of the result
2344	//
2345	// optional
2346	Description string `json:"description,omitempty"`
2347	// ReplyMarkup nline keyboard attached to the message
2348	//
2349	// optional
2350	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2351	// InputMessageContent content of the message to be sent instead of the file
2352	//
2353	// optional
2354	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2355	// ThumbURL url of the thumbnail (jpeg only) for the file
2356	//
2357	// optional
2358	ThumbURL string `json:"thumb_url,omitempty"`
2359	// ThumbWidth thumbnail width
2360	//
2361	// optional
2362	ThumbWidth int `json:"thumb_width,omitempty"`
2363	// ThumbHeight thumbnail height
2364	//
2365	// optional
2366	ThumbHeight int `json:"thumb_height,omitempty"`
2367}
2368
2369// InlineQueryResultGIF is an inline query response GIF.
2370type InlineQueryResultGIF struct {
2371	// Type of the result, must be gif.
2372	Type string `json:"type"`
2373	// ID unique identifier for this result, 1-64 bytes.
2374	ID string `json:"id"`
2375	// URL a valid URL for the GIF file. File size must not exceed 1MB.
2376	URL string `json:"gif_url"`
2377	// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
2378	ThumbURL string `json:"thumb_url"`
2379	// Width of the GIF
2380	//
2381	// optional
2382	Width int `json:"gif_width,omitempty"`
2383	// Height of the GIF
2384	//
2385	// optional
2386	Height int `json:"gif_height,omitempty"`
2387	// Duration of the GIF
2388	//
2389	// optional
2390	Duration int `json:"gif_duration,omitempty"`
2391	// Title for the result
2392	//
2393	// optional
2394	Title string `json:"title,omitempty"`
2395	// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
2396	//
2397	// optional
2398	Caption string `json:"caption,omitempty"`
2399	// ParseMode mode for parsing entities in the video caption.
2400	// See formatting options for more details
2401	// (https://core.telegram.org/bots/api#formatting-options).
2402	//
2403	// optional
2404	ParseMode string `json:"parse_mode,omitempty"`
2405	// CaptionEntities is a list of special entities that appear in the caption,
2406	// which can be specified instead of parse_mode
2407	//
2408	// optional
2409	CaptionEntities []MessageEntity `json:"caption_entities"`
2410	// ReplyMarkup inline keyboard attached to the message
2411	//
2412	// optional
2413	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2414	// InputMessageContent content of the message to be sent instead of the GIF animation.
2415	//
2416	// optional
2417	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2418}
2419
2420// InlineQueryResultLocation is an inline query response location.
2421type InlineQueryResultLocation struct {
2422	// Type of the result, must be location
2423	Type string `json:"type"`
2424	// ID unique identifier for this result, 1-64 Bytes
2425	ID string `json:"id"`
2426	// Latitude  of the location in degrees
2427	Latitude float64 `json:"latitude"`
2428	// Longitude of the location in degrees
2429	Longitude float64 `json:"longitude"`
2430	// Title of the location
2431	Title string `json:"title"`
2432	// HorizontalAccuracy is the radius of uncertainty for the location,
2433	// measured in meters; 0-1500
2434	//
2435	// optional
2436	HorizontalAccuracy float64 `json:"horizontal_accuracy"`
2437	// LivePeriod is the period in seconds for which the location can be
2438	// updated, should be between 60 and 86400.
2439	//
2440	// optional
2441	LivePeriod int `json:"live_period"`
2442	// Heading is for live locations, a direction in which the user is moving,
2443	// in degrees. Must be between 1 and 360 if specified.
2444	//
2445	// optional
2446	Heading int `json:"heading"`
2447	// ProximityAlertRadius is for live locations, a maximum distance for
2448	// proximity alerts about approaching another chat member, in meters. Must
2449	// be between 1 and 100000 if specified.
2450	//
2451	// optional
2452	ProximityAlertRadius int `json:"proximity_alert_radius"`
2453	// ReplyMarkup inline keyboard attached to the message
2454	//
2455	// optional
2456	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2457	// InputMessageContent content of the message to be sent instead of the location
2458	//
2459	// optional
2460	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2461	// ThumbURL url of the thumbnail for the result
2462	//
2463	// optional
2464	ThumbURL string `json:"thumb_url,omitempty"`
2465	// ThumbWidth thumbnail width
2466	//
2467	// optional
2468	ThumbWidth int `json:"thumb_width,omitempty"`
2469	// ThumbHeight thumbnail height
2470	//
2471	// optional
2472	ThumbHeight int `json:"thumb_height,omitempty"`
2473}
2474
2475// InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.
2476type InlineQueryResultMPEG4GIF struct {
2477	// Type of the result, must be mpeg4_gif
2478	Type string `json:"type"`
2479	// ID unique identifier for this result, 1-64 bytes
2480	ID string `json:"id"`
2481	// URL a valid URL for the MP4 file. File size must not exceed 1MB
2482	URL string `json:"mpeg4_url"`
2483	// Width video width
2484	//
2485	// optional
2486	Width int `json:"mpeg4_width"`
2487	// Height vVideo height
2488	//
2489	// optional
2490	Height int `json:"mpeg4_height"`
2491	// Duration video duration
2492	//
2493	// optional
2494	Duration int `json:"mpeg4_duration"`
2495	// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
2496	ThumbURL string `json:"thumb_url"`
2497	// Title for the result
2498	//
2499	// optional
2500	Title string `json:"title,omitempty"`
2501	// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
2502	//
2503	// optional
2504	Caption string `json:"caption,omitempty"`
2505	// ParseMode mode for parsing entities in the video caption.
2506	// See formatting options for more details
2507	// (https://core.telegram.org/bots/api#formatting-options).
2508	//
2509	// optional
2510	ParseMode string `json:"parse_mode,omitempty"`
2511	// CaptionEntities is a list of special entities that appear in the caption,
2512	// which can be specified instead of parse_mode
2513	//
2514	// optional
2515	CaptionEntities []MessageEntity `json:"caption_entities"`
2516	// ReplyMarkup inline keyboard attached to the message
2517	//
2518	// optional
2519	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2520	// InputMessageContent content of the message to be sent instead of the video animation
2521	//
2522	// optional
2523	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2524}
2525
2526// InlineQueryResultPhoto is an inline query response photo.
2527type InlineQueryResultPhoto struct {
2528	// Type of the result, must be article.
2529	Type string `json:"type"`
2530	// ID unique identifier for this result, 1-64 Bytes.
2531	ID string `json:"id"`
2532	// URL a valid URL of the photo. Photo must be in jpeg format.
2533	// Photo size must not exceed 5MB.
2534	URL string `json:"photo_url"`
2535	// MimeType
2536	MimeType string `json:"mime_type"`
2537	// Width of the photo
2538	//
2539	// optional
2540	Width int `json:"photo_width,omitempty"`
2541	// Height of the photo
2542	//
2543	// optional
2544	Height int `json:"photo_height,omitempty"`
2545	// ThumbURL url of the thumbnail for the photo.
2546	//
2547	// optional
2548	ThumbURL string `json:"thumb_url,omitempty"`
2549	// Title for the result
2550	//
2551	// optional
2552	Title string `json:"title,omitempty"`
2553	// Description short description of the result
2554	//
2555	// optional
2556	Description string `json:"description,omitempty"`
2557	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
2558	//
2559	// optional
2560	Caption string `json:"caption,omitempty"`
2561	// ParseMode mode for parsing entities in the photo caption.
2562	// See formatting options for more details
2563	// (https://core.telegram.org/bots/api#formatting-options).
2564	//
2565	// optional
2566	ParseMode string `json:"parse_mode,omitempty"`
2567	// ReplyMarkup inline keyboard attached to the message.
2568	//
2569	// optional
2570	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2571	// CaptionEntities is a list of special entities that appear in the caption,
2572	// which can be specified instead of parse_mode
2573	//
2574	// optional
2575	CaptionEntities []MessageEntity `json:"caption_entities"`
2576	// InputMessageContent content of the message to be sent instead of the photo.
2577	//
2578	// optional
2579	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2580}
2581
2582// InlineQueryResultVenue is an inline query response venue.
2583type InlineQueryResultVenue struct {
2584	// Type of the result, must be venue
2585	Type string `json:"type"`
2586	// ID unique identifier for this result, 1-64 Bytes
2587	ID string `json:"id"`
2588	// Latitude of the venue location in degrees
2589	Latitude float64 `json:"latitude"`
2590	// Longitude of the venue location in degrees
2591	Longitude float64 `json:"longitude"`
2592	// Title of the venue
2593	Title string `json:"title"`
2594	// Address of the venue
2595	Address string `json:"address"`
2596	// FoursquareID foursquare identifier of the venue if known
2597	//
2598	// optional
2599	FoursquareID string `json:"foursquare_id,omitempty"`
2600	// FoursquareType foursquare type of the venue, if known.
2601	// (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
2602	//
2603	// optional
2604	FoursquareType string `json:"foursquare_type,omitempty"`
2605	// GooglePlaceID is the Google Places identifier of the venue
2606	//
2607	// optional
2608	GooglePlaceID string `json:"google_place_id,omitempty"`
2609	// GooglePlaceType is the Google Places type of the venue
2610	//
2611	// optional
2612	GooglePlaceType string `json:"google_place_type,omitempty"`
2613	// ReplyMarkup inline keyboard attached to the message
2614	//
2615	// optional
2616	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2617	// InputMessageContent content of the message to be sent instead of the venue
2618	//
2619	// optional
2620	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2621	// ThumbURL url of the thumbnail for the result
2622	//
2623	// optional
2624	ThumbURL string `json:"thumb_url,omitempty"`
2625	// ThumbWidth thumbnail width
2626	//
2627	// optional
2628	ThumbWidth int `json:"thumb_width,omitempty"`
2629	// ThumbHeight thumbnail height
2630	//
2631	// optional
2632	ThumbHeight int `json:"thumb_height,omitempty"`
2633}
2634
2635// InlineQueryResultVideo is an inline query response video.
2636type InlineQueryResultVideo struct {
2637	// Type of the result, must be video
2638	Type string `json:"type"`
2639	// ID unique identifier for this result, 1-64 bytes
2640	ID string `json:"id"`
2641	// URL a valid url for the embedded video player or video file
2642	URL string `json:"video_url"`
2643	// MimeType of the content of video url, “text/html” or “video/mp4”
2644	MimeType string `json:"mime_type"`
2645	//
2646	// ThumbURL url of the thumbnail (jpeg only) for the video
2647	// optional
2648	ThumbURL string `json:"thumb_url,omitempty"`
2649	// Title for the result
2650	Title string `json:"title"`
2651	// Caption of the video to be sent, 0-1024 characters after entities parsing
2652	//
2653	// optional
2654	Caption string `json:"caption,omitempty"`
2655	// Width video width
2656	//
2657	// optional
2658	Width int `json:"video_width,omitempty"`
2659	// Height video height
2660	//
2661	// optional
2662	Height int `json:"video_height,omitempty"`
2663	// Duration video duration in seconds
2664	//
2665	// optional
2666	Duration int `json:"video_duration,omitempty"`
2667	// Description short description of the result
2668	//
2669	// optional
2670	Description string `json:"description,omitempty"`
2671	// ReplyMarkup inline keyboard attached to the message
2672	//
2673	// optional
2674	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2675	// InputMessageContent content of the message to be sent instead of the video.
2676	// This field is required if InlineQueryResultVideo is used to send
2677	// an HTML-page as a result (e.g., a YouTube video).
2678	//
2679	// optional
2680	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2681}
2682
2683// InlineQueryResultVoice is an inline query response voice.
2684type InlineQueryResultVoice struct {
2685	// Type of the result, must be voice
2686	Type string `json:"type"`
2687	// ID unique identifier for this result, 1-64 bytes
2688	ID string `json:"id"`
2689	// URL a valid URL for the voice recording
2690	URL string `json:"voice_url"`
2691	// Title recording title
2692	Title string `json:"title"`
2693	// Caption 0-1024 characters after entities parsing
2694	//
2695	// optional
2696	Caption string `json:"caption,omitempty"`
2697	// ParseMode mode for parsing entities in the video caption.
2698	// See formatting options for more details
2699	// (https://core.telegram.org/bots/api#formatting-options).
2700	//
2701	// optional
2702	ParseMode string `json:"parse_mode,omitempty"`
2703	// CaptionEntities is a list of special entities that appear in the caption,
2704	// which can be specified instead of parse_mode
2705	//
2706	// optional
2707	CaptionEntities []MessageEntity `json:"caption_entities"`
2708	// Duration recording duration in seconds
2709	//
2710	// optional
2711	Duration int `json:"voice_duration,omitempty"`
2712	// ReplyMarkup inline keyboard attached to the message
2713	//
2714	// optional
2715	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2716	// InputMessageContent content of the message to be sent instead of the voice recording
2717	//
2718	// optional
2719	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2720}
2721
2722// ChosenInlineResult is an inline query result chosen by a User
2723type ChosenInlineResult struct {
2724	// ResultID the unique identifier for the result that was chosen
2725	ResultID string `json:"result_id"`
2726	// From the user that chose the result
2727	From *User `json:"from"`
2728	// Location sender location, only for bots that require user location
2729	//
2730	// optional
2731	Location *Location `json:"location,omitempty"`
2732	// InlineMessageID identifier of the sent inline message.
2733	// Available only if there is an inline keyboard attached to the message.
2734	// Will be also received in callback queries and can be used to edit the message.
2735	//
2736	// optional
2737	InlineMessageID string `json:"inline_message_id,omitempty"`
2738	// Query the query that was used to obtain the result
2739	Query string `json:"query"`
2740}
2741
2742// InputTextMessageContent contains text for displaying
2743// as an inline query result.
2744type InputTextMessageContent struct {
2745	// Text of the message to be sent, 1-4096 characters
2746	Text string `json:"message_text"`
2747	// ParseMode mode for parsing entities in the message text.
2748	// See formatting options for more details
2749	// (https://core.telegram.org/bots/api#formatting-options).
2750	//
2751	// optional
2752	ParseMode string `json:"parse_mode,omitempty"`
2753	// Entities is a list of special entities that appear in message text, which
2754	// can be specified instead of parse_mode
2755	//
2756	// optional
2757	Entities []MessageEntity `json:"entities,omitempty"`
2758	// DisableWebPagePreview disables link previews for links in the sent message
2759	//
2760	// optional
2761	DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"`
2762}
2763
2764// InputLocationMessageContent contains a location for displaying
2765// as an inline query result.
2766type InputLocationMessageContent struct {
2767	// Latitude of the location in degrees
2768	Latitude float64 `json:"latitude"`
2769	// Longitude of the location in degrees
2770	Longitude float64 `json:"longitude"`
2771	// HorizontalAccuracy is the radius of uncertainty for the location,
2772	// measured in meters; 0-1500
2773	//
2774	// optional
2775	HorizontalAccuracy float64 `json:"horizontal_accuracy"`
2776	// LivePeriod is the period in seconds for which the location can be
2777	// updated, should be between 60 and 86400
2778	//
2779	// optional
2780	LivePeriod int `json:"live_period,omitempty"`
2781	// Heading is for live locations, a direction in which the user is moving,
2782	// in degrees. Must be between 1 and 360 if specified.
2783	//
2784	// optional
2785	Heading int `json:"heading"`
2786	// ProximityAlertRadius is for live locations, a maximum distance for
2787	// proximity alerts about approaching another chat member, in meters. Must
2788	// be between 1 and 100000 if specified.
2789	//
2790	// optional
2791	ProximityAlertRadius int `json:"proximity_alert_radius"`
2792}
2793
2794// InputVenueMessageContent contains a venue for displaying
2795// as an inline query result.
2796type InputVenueMessageContent struct {
2797	// Latitude of the venue in degrees
2798	Latitude float64 `json:"latitude"`
2799	// Longitude of the venue in degrees
2800	Longitude float64 `json:"longitude"`
2801	// Title name of the venue
2802	Title string `json:"title"`
2803	// Address of the venue
2804	Address string `json:"address"`
2805	// FoursquareID foursquare identifier of the venue, if known
2806	//
2807	// optional
2808	FoursquareID string `json:"foursquare_id,omitempty"`
2809	// FoursquareType Foursquare type of the venue, if known
2810	//
2811	// optional
2812	FoursquareType string `json:"foursquare_type,omitempty"`
2813	// GooglePlaceID is the Google Places identifier of the venue
2814	//
2815	// optional
2816	GooglePlaceID string `json:"google_place_id"`
2817	// GooglePlaceType is the Google Places type of the venue
2818	//
2819	// optional
2820	GooglePlaceType string `json:"google_place_type"`
2821}
2822
2823// InputContactMessageContent contains a contact for displaying
2824// as an inline query result.
2825type InputContactMessageContent struct {
2826	// 	PhoneNumber contact's phone number
2827	PhoneNumber string `json:"phone_number"`
2828	// FirstName contact's first name
2829	FirstName string `json:"first_name"`
2830	// LastName contact's last name
2831	//
2832	// optional
2833	LastName string `json:"last_name,omitempty"`
2834	// Additional data about the contact in the form of a vCard
2835	//
2836	// optional
2837	VCard string `json:"vcard,omitempty"`
2838}
2839
2840// LabeledPrice represents a portion of the price for goods or services.
2841type LabeledPrice struct {
2842	// Label portion label
2843	Label string `json:"label"`
2844	// Amount price of the product in the smallest units of the currency (integer, not float/double).
2845	// For example, for a price of US$ 1.45 pass amount = 145.
2846	// See the exp parameter in currencies.json
2847	// (https://core.telegram.org/bots/payments/currencies.json),
2848	// it shows the number of digits past the decimal point
2849	// for each currency (2 for the majority of currencies).
2850	Amount int `json:"amount"`
2851}
2852
2853// Invoice contains basic information about an invoice.
2854type Invoice struct {
2855	// Title product name
2856	Title string `json:"title"`
2857	// Description product description
2858	Description string `json:"description"`
2859	// StartParameter unique bot deep-linking parameter that can be used to generate this invoice
2860	StartParameter string `json:"start_parameter"`
2861	// Currency three-letter ISO 4217 currency code
2862	// (see https://core.telegram.org/bots/payments#supported-currencies)
2863	Currency string `json:"currency"`
2864	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
2865	// For example, for a price of US$ 1.45 pass amount = 145.
2866	// See the exp parameter in currencies.json
2867	// (https://core.telegram.org/bots/payments/currencies.json),
2868	// it shows the number of digits past the decimal point
2869	// for each currency (2 for the majority of currencies).
2870	TotalAmount int `json:"total_amount"`
2871}
2872
2873// ShippingAddress represents a shipping address.
2874type ShippingAddress struct {
2875	// CountryCode ISO 3166-1 alpha-2 country code
2876	CountryCode string `json:"country_code"`
2877	// State if applicable
2878	State string `json:"state"`
2879	// City city
2880	City string `json:"city"`
2881	// StreetLine1 first line for the address
2882	StreetLine1 string `json:"street_line1"`
2883	// StreetLine2 second line for the address
2884	StreetLine2 string `json:"street_line2"`
2885	// PostCode address post code
2886	PostCode string `json:"post_code"`
2887}
2888
2889// OrderInfo represents information about an order.
2890type OrderInfo struct {
2891	// Name user name
2892	//
2893	// optional
2894	Name string `json:"name,omitempty"`
2895	// PhoneNumber user's phone number
2896	//
2897	// optional
2898	PhoneNumber string `json:"phone_number,omitempty"`
2899	// Email user email
2900	//
2901	// optional
2902	Email string `json:"email,omitempty"`
2903	// ShippingAddress user shipping address
2904	//
2905	// optional
2906	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
2907}
2908
2909// ShippingOption represents one shipping option.
2910type ShippingOption struct {
2911	// ID shipping option identifier
2912	ID string `json:"id"`
2913	// Title option title
2914	Title string `json:"title"`
2915	// Prices list of price portions
2916	Prices []LabeledPrice `json:"prices"`
2917}
2918
2919// SuccessfulPayment contains basic information about a successful payment.
2920type SuccessfulPayment struct {
2921	// Currency three-letter ISO 4217 currency code
2922	// (see https://core.telegram.org/bots/payments#supported-currencies)
2923	Currency string `json:"currency"`
2924	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
2925	// For example, for a price of US$ 1.45 pass amount = 145.
2926	// See the exp parameter in currencies.json,
2927	// (https://core.telegram.org/bots/payments/currencies.json)
2928	// it shows the number of digits past the decimal point
2929	// for each currency (2 for the majority of currencies).
2930	TotalAmount int `json:"total_amount"`
2931	// InvoicePayload bot specified invoice payload
2932	InvoicePayload string `json:"invoice_payload"`
2933	// ShippingOptionID identifier of the shipping option chosen by the user
2934	//
2935	// optional
2936	ShippingOptionID string `json:"shipping_option_id,omitempty"`
2937	// OrderInfo order info provided by the user
2938	//
2939	// optional
2940	OrderInfo *OrderInfo `json:"order_info,omitempty"`
2941	// TelegramPaymentChargeID telegram payment identifier
2942	TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
2943	// ProviderPaymentChargeID provider payment identifier
2944	ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
2945}
2946
2947// ShippingQuery contains information about an incoming shipping query.
2948type ShippingQuery struct {
2949	// ID unique query identifier
2950	ID string `json:"id"`
2951	// From user who sent the query
2952	From *User `json:"from"`
2953	// InvoicePayload bot specified invoice payload
2954	InvoicePayload string `json:"invoice_payload"`
2955	// ShippingAddress user specified shipping address
2956	ShippingAddress *ShippingAddress `json:"shipping_address"`
2957}
2958
2959// PreCheckoutQuery contains information about an incoming pre-checkout query.
2960type PreCheckoutQuery struct {
2961	// ID unique query identifier
2962	ID string `json:"id"`
2963	// From user who sent the query
2964	From *User `json:"from"`
2965	// Currency three-letter ISO 4217 currency code
2966	//	// (see https://core.telegram.org/bots/payments#supported-currencies)
2967	Currency string `json:"currency"`
2968	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
2969	//	// For example, for a price of US$ 1.45 pass amount = 145.
2970	//	// See the exp parameter in currencies.json,
2971	//	// (https://core.telegram.org/bots/payments/currencies.json)
2972	//	// it shows the number of digits past the decimal point
2973	//	// for each currency (2 for the majority of currencies).
2974	TotalAmount int `json:"total_amount"`
2975	// InvoicePayload bot specified invoice payload
2976	InvoicePayload string `json:"invoice_payload"`
2977	// ShippingOptionID identifier of the shipping option chosen by the user
2978	//
2979	// optional
2980	ShippingOptionID string `json:"shipping_option_id,omitempty"`
2981	// OrderInfo order info provided by the user
2982	//
2983	// optional
2984	OrderInfo *OrderInfo `json:"order_info,omitempty"`
2985}