all repos — telegram-bot-api @ f7e326b02e008b78a79cd56f85786a5940d0939c

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