all repos — telegram-bot-api @ 17d3e395d52d40e76b22f043424937a4e8d2f58c

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