all repos — telegram-bot-api @ fd903f81823eed76670e323838bce4d3158cb227

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