all repos — telegram-bot-api @ 3f07c5f67644dfc8a9c37210de2b95cfdb060515

Golang bindings for the Telegram Bot API

types.go (view raw)

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