all repos — telegram-bot-api @ 24e02f7ba6aa2e045e23e8afbebaf7f249f0e368

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