all repos — telegram-bot-api @ 6d16deaa376eaab7ed713feec2ebfb9070c759ef

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	// FromRequest is true, if the access was granted after
1377	// the user accepted an explicit request from a Web App
1378	// sent by the method requestWriteAccess.
1379	//
1380	// Optional
1381	FromRequest bool `json:"from_request,omitempty"`
1382	// Name of the Web App which was launched from a link
1383	//
1384	// Optional
1385	WebAppName string `json:"web_app_name,omitempty"`
1386	// FromAttachmentMenu is true, if the access was granted when
1387	// the bot was added to the attachment or side menu
1388	//
1389	// Optional
1390	FromAttachmentMenu bool `json:"from_attachment_menu,omitempty"`
1391}
1392
1393// VideoChatScheduled represents a service message about a voice chat scheduled
1394// in the chat.
1395type VideoChatScheduled struct {
1396	// Point in time (Unix timestamp) when the voice chat is supposed to be
1397	// started by a chat administrator
1398	StartDate int `json:"start_date"`
1399}
1400
1401// Time converts the scheduled start date into a Time.
1402func (m *VideoChatScheduled) Time() time.Time {
1403	return time.Unix(int64(m.StartDate), 0)
1404}
1405
1406// VideoChatStarted represents a service message about a voice chat started in
1407// the chat.
1408type VideoChatStarted struct{}
1409
1410// VideoChatEnded represents a service message about a voice chat ended in the
1411// chat.
1412type VideoChatEnded struct {
1413	// Voice chat duration; in seconds.
1414	Duration int `json:"duration"`
1415}
1416
1417// VideoChatParticipantsInvited represents a service message about new members
1418// invited to a voice chat.
1419type VideoChatParticipantsInvited struct {
1420	// New members that were invited to the voice chat.
1421	//
1422	// optional
1423	Users []User `json:"users,omitempty"`
1424}
1425
1426// UserProfilePhotos contains a set of user profile photos.
1427type UserProfilePhotos struct {
1428	// TotalCount total number of profile pictures the target user has
1429	TotalCount int `json:"total_count"`
1430	// Photos requested profile pictures (in up to 4 sizes each)
1431	Photos [][]PhotoSize `json:"photos"`
1432}
1433
1434// File contains information about a file to download from Telegram.
1435type File struct {
1436	// FileID identifier for this file, which can be used to download or reuse
1437	// the file
1438	FileID string `json:"file_id"`
1439	// FileUniqueID is the unique identifier for this file, which is supposed to
1440	// be the same over time and for different bots. Can't be used to download
1441	// or reuse the file.
1442	FileUniqueID string `json:"file_unique_id"`
1443	// FileSize file size, if known
1444	//
1445	// optional
1446	FileSize int64 `json:"file_size,omitempty"`
1447	// FilePath file path
1448	//
1449	// optional
1450	FilePath string `json:"file_path,omitempty"`
1451}
1452
1453// Link returns a full path to the download URL for a File.
1454//
1455// It requires the Bot token to create the link.
1456func (f *File) Link(token string) string {
1457	return fmt.Sprintf(FileEndpoint, token, f.FilePath)
1458}
1459
1460// WebAppInfo contains information about a Web App.
1461type WebAppInfo struct {
1462	// URL is the HTTPS URL of a Web App to be opened with additional data as
1463	// specified in Initializing Web Apps.
1464	URL string `json:"url"`
1465}
1466
1467// ReplyKeyboardMarkup represents a custom keyboard with reply options.
1468type ReplyKeyboardMarkup struct {
1469	// Keyboard is an array of button rows, each represented by an Array of KeyboardButton objects
1470	Keyboard [][]KeyboardButton `json:"keyboard"`
1471	// IsPersistent requests clients to always show the keyboard
1472	// when the regular keyboard is hidden.
1473	// Defaults to false, in which case the custom keyboard can be hidden
1474	// and opened with a keyboard icon.
1475	//
1476	// optional
1477	IsPersistent bool `json:"is_persistent"`
1478	// ResizeKeyboard requests clients to resize the keyboard vertically for optimal fit
1479	// (e.g., make the keyboard smaller if there are just two rows of buttons).
1480	// Defaults to false, in which case the custom keyboard
1481	// is always of the same height as the app's standard keyboard.
1482	//
1483	// optional
1484	ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
1485	// OneTimeKeyboard requests clients to hide the keyboard as soon as it's been used.
1486	// The keyboard will still be available, but clients will automatically display
1487	// the usual letter-keyboard in the chat – the user can press a special button
1488	// in the input field to see the custom keyboard again.
1489	// Defaults to false.
1490	//
1491	// optional
1492	OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
1493	// InputFieldPlaceholder is the placeholder to be shown in the input field when
1494	// the keyboard is active; 1-64 characters.
1495	//
1496	// optional
1497	InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
1498	// Selective use this parameter if you want to show the keyboard to specific users only.
1499	// Targets:
1500	//  1) users that are @mentioned in the text of the Message object;
1501	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
1502	//
1503	// Example: A user requests to change the bot's language,
1504	// bot replies to the request with a keyboard to select the new language.
1505	// Other users in the group don't see the keyboard.
1506	//
1507	// optional
1508	Selective bool `json:"selective,omitempty"`
1509}
1510
1511// KeyboardButton represents one button of the reply keyboard. For simple text
1512// buttons String can be used instead of this object to specify text of the
1513// button. Optional fields request_contact, request_location, and request_poll
1514// are mutually exclusive.
1515type KeyboardButton struct {
1516	// Text of the button. If none of the optional fields are used,
1517	// it will be sent as a message when the button is pressed.
1518	Text string `json:"text"`
1519	// RequestUser if specified, pressing the button will open
1520	// a list of suitable users. Tapping on any user will send
1521	// their identifier to the bot in a "user_shared" service message.
1522	// Available in private chats only.
1523	//
1524	// optional
1525	RequestUser *KeyboardButtonRequestUser `json:"request_user,omitempty"`
1526	// RequestChat if specified, pressing the button will open
1527	// a list of suitable chats. Tapping on a chat will send
1528	// its identifier to the bot in a "chat_shared" service message.
1529	// Available in private chats only.
1530	//
1531	// optional
1532	RequestChat *KeyboardButtonRequestChat `json:"request_chat,omitempty"`
1533	// RequestContact if True, the user's phone number will be sent
1534	// as a contact when the button is pressed.
1535	// Available in private chats only.
1536	//
1537	// optional
1538	RequestContact bool `json:"request_contact,omitempty"`
1539	// RequestLocation if True, the user's current location will be sent when
1540	// the button is pressed.
1541	// Available in private chats only.
1542	//
1543	// optional
1544	RequestLocation bool `json:"request_location,omitempty"`
1545	// RequestPoll if specified, the user will be asked to create a poll and send it
1546	// to the bot when the button is pressed. Available in private chats only
1547	//
1548	// optional
1549	RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
1550	// WebApp if specified, the described Web App will be launched when the button
1551	// is pressed. The Web App will be able to send a “web_app_data” service
1552	// message. Available in private chats only.
1553	//
1554	// optional
1555	WebApp *WebAppInfo `json:"web_app,omitempty"`
1556}
1557
1558// KeyboardButtonRequestUser defines the criteria used to request
1559// a suitable user. The identifier of the selected user will be shared
1560// with the bot when the corresponding button is pressed.
1561type KeyboardButtonRequestUser struct {
1562	// RequestID is a signed 32-bit identifier of the request.
1563	RequestID int `json:"request_id"`
1564	// UserIsBot pass True to request a bot,
1565	// pass False to request a regular user.
1566	// If not specified, no additional restrictions are applied.
1567	//
1568	// optional
1569	UserIsBot bool `json:"user_is_bot,omitempty"`
1570	// UserIsPremium pass True to request a premium user,
1571	// pass False to request a non-premium user.
1572	// If not specified, no additional restrictions are applied.
1573	//
1574	// optional
1575	UserIsPremium bool `json:"user_is_premium,omitempty"`
1576}
1577
1578// KeyboardButtonRequestChat defines the criteria used to request
1579// a suitable chat. The identifier of the selected chat will be shared
1580// with the bot when the corresponding button is pressed.
1581type KeyboardButtonRequestChat struct {
1582	// RequestID is a signed 32-bit identifier of the request.
1583	RequestID int `json:"request_id"`
1584	// ChatIsChannel pass True to request a channel chat,
1585	// pass False to request a group or a supergroup chat.
1586	ChatIsChannel bool `json:"chat_is_channel"`
1587	// ChatIsForum pass True to request a forum supergroup,
1588	// pass False to request a non-forum chat.
1589	// If not specified, no additional restrictions are applied.
1590	//
1591	// optional
1592	ChatIsForum bool `json:"chat_is_forum,omitempty"`
1593	// ChatHasUsername pass True to request a supergroup or a channel with a username,
1594	// pass False to request a chat without a username.
1595	// If not specified, no additional restrictions are applied.
1596	//
1597	// optional
1598	ChatHasUsername bool `json:"chat_has_username,omitempty"`
1599	// ChatIsCreated pass True to request a chat owned by the user.
1600	// Otherwise, no additional restrictions are applied.
1601	//
1602	// optional
1603	ChatIsCreated bool `json:"chat_is_created,omitempty"`
1604	// UserAdministratorRights is a JSON-serialized object listing
1605	// the required administrator rights of the user in the chat.
1606	// If not specified, no additional restrictions are applied.
1607	//
1608	// optional
1609	UserAdministratorRights *ChatAdministratorRights `json:"user_administrator_rights,omitempty"`
1610	// BotAdministratorRights is a JSON-serialized object listing
1611	// the required administrator rights of the bot in the chat.
1612	// The rights must be a subset of user_administrator_rights.
1613	// If not specified, no additional restrictions are applied.
1614	//
1615	// optional
1616	BotAdministratorRights *ChatAdministratorRights `json:"bot_administrator_rights,omitempty"`
1617	// BotIsMember pass True to request a chat with the bot as a member.
1618	// Otherwise, no additional restrictions are applied.
1619	//
1620	// optional
1621	BotIsMember bool `json:"bot_is_member,omitempty"`
1622}
1623
1624// KeyboardButtonPollType represents type of poll, which is allowed to
1625// be created and sent when the corresponding button is pressed.
1626type KeyboardButtonPollType struct {
1627	// Type is if quiz is passed, the user will be allowed to create only polls
1628	// in the quiz mode. If regular is passed, only regular polls will be
1629	// allowed. Otherwise, the user will be allowed to create a poll of any type.
1630	Type string `json:"type"`
1631}
1632
1633// ReplyKeyboardRemove Upon receiving a message with this object, Telegram
1634// clients will remove the current custom keyboard and display the default
1635// letter-keyboard. By default, custom keyboards are displayed until a new
1636// keyboard is sent by a bot. An exception is made for one-time keyboards
1637// that are hidden immediately after the user presses a button.
1638type ReplyKeyboardRemove struct {
1639	// RemoveKeyboard requests clients to remove the custom keyboard
1640	// (user will not be able to summon this keyboard;
1641	// if you want to hide the keyboard from sight but keep it accessible,
1642	// use one_time_keyboard in ReplyKeyboardMarkup).
1643	RemoveKeyboard bool `json:"remove_keyboard"`
1644	// Selective use this parameter if you want to remove the keyboard for specific users only.
1645	// Targets:
1646	//  1) users that are @mentioned in the text of the Message object;
1647	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
1648	//
1649	// Example: A user votes in a poll, bot returns confirmation message
1650	// in reply to the vote and removes the keyboard for that user,
1651	// while still showing the keyboard with poll options to users who haven't voted yet.
1652	//
1653	// optional
1654	Selective bool `json:"selective,omitempty"`
1655}
1656
1657// InlineKeyboardMarkup represents an inline keyboard that appears right next to
1658// the message it belongs to.
1659type InlineKeyboardMarkup struct {
1660	// InlineKeyboard array of button rows, each represented by an Array of
1661	// InlineKeyboardButton objects
1662	InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
1663}
1664
1665// InlineKeyboardButton represents one button of an inline keyboard. You must
1666// use exactly one of the optional fields.
1667//
1668// Note that some values are references as even an empty string
1669// will change behavior.
1670//
1671// CallbackGame, if set, MUST be first button in first row.
1672type InlineKeyboardButton struct {
1673	// Text label text on the button
1674	Text string `json:"text"`
1675	// URL HTTP or tg:// url to be opened when button is pressed.
1676	//
1677	// optional
1678	URL *string `json:"url,omitempty"`
1679	// LoginURL is an HTTP URL used to automatically authorize the user. Can be
1680	// used as a replacement for the Telegram Login Widget
1681	//
1682	// optional
1683	LoginURL *LoginURL `json:"login_url,omitempty"`
1684	// CallbackData data to be sent in a callback query to the bot when button is pressed, 1-64 bytes.
1685	//
1686	// optional
1687	CallbackData *string `json:"callback_data,omitempty"`
1688	// WebApp is the Description of the Web App that will be launched when the user presses the button.
1689	// The Web App will be able to send an arbitrary message on behalf of the user using the method
1690	// answerWebAppQuery. Available only in private chats between a user and the bot.
1691	//
1692	// optional
1693	WebApp *WebAppInfo `json:"web_app,omitempty"`
1694	// SwitchInlineQuery if set, pressing the button will prompt the user to select one of their chats,
1695	// open that chat and insert the bot's username and the specified inline query in the input field.
1696	// Can be empty, in which case just the bot's username will be inserted.
1697	//
1698	// This offers an easy way for users to start using your bot
1699	// in inline mode when they are currently in a private chat with it.
1700	// Especially useful when combined with switch_pm… actions – in this case
1701	// the user will be automatically returned to the chat they switched from,
1702	// skipping the chat selection screen.
1703	//
1704	// optional
1705	SwitchInlineQuery *string `json:"switch_inline_query,omitempty"`
1706	// SwitchInlineQueryCurrentChat if set, pressing the button will insert the bot's username
1707	// and the specified inline query in the current chat's input field.
1708	// Can be empty, in which case only the bot's username will be inserted.
1709	//
1710	// This offers a quick way for the user to open your bot in inline mode
1711	// in the same chat – good for selecting something from multiple options.
1712	//
1713	// optional
1714	SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"`
1715	//SwitchInlineQueryChosenChat If set, pressing the button will prompt the user to
1716	//select one of their chats of the specified type, open that chat and insert the bot's
1717	//username and the specified inline query in the input field
1718	//
1719	//optional
1720	SwitchInlineQueryChosenChat *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`
1721	// CallbackGame description of the game that will be launched when the user presses the button.
1722	//
1723	// optional
1724	CallbackGame *CallbackGame `json:"callback_game,omitempty"`
1725	// Pay specify True, to send a Pay button.
1726	//
1727	// NOTE: This type of button must always be the first button in the first row.
1728	//
1729	// optional
1730	Pay bool `json:"pay,omitempty"`
1731}
1732
1733// LoginURL represents a parameter of the inline keyboard button used to
1734// automatically authorize a user. Serves as a great replacement for the
1735// Telegram Login Widget when the user is coming from Telegram. All the user
1736// needs to do is tap/click a button and confirm that they want to log in.
1737type LoginURL struct {
1738	// URL is an HTTP URL to be opened with user authorization data added to the
1739	// query string when the button is pressed. If the user refuses to provide
1740	// authorization data, the original URL without information about the user
1741	// will be opened. The data added is the same as described in Receiving
1742	// authorization data.
1743	//
1744	// NOTE: You must always check the hash of the received data to verify the
1745	// authentication and the integrity of the data as described in Checking
1746	// authorization.
1747	URL string `json:"url"`
1748	// ForwardText is the new text of the button in forwarded messages
1749	//
1750	// optional
1751	ForwardText string `json:"forward_text,omitempty"`
1752	// BotUsername is the username of a bot, which will be used for user
1753	// authorization. See Setting up a bot for more details. If not specified,
1754	// the current bot's username will be assumed. The url's domain must be the
1755	// same as the domain linked with the bot. See Linking your domain to the
1756	// bot for more details.
1757	//
1758	// optional
1759	BotUsername string `json:"bot_username,omitempty"`
1760	// RequestWriteAccess if true requests permission for your bot to send
1761	// messages to the user
1762	//
1763	// optional
1764	RequestWriteAccess bool `json:"request_write_access,omitempty"`
1765}
1766
1767// CallbackQuery represents an incoming callback query from a callback button in
1768// an inline keyboard. If the button that originated the query was attached to a
1769// message sent by the bot, the field message will be present. If the button was
1770// attached to a message sent via the bot (in inline mode), the field
1771// inline_message_id will be present. Exactly one of the fields data or
1772// game_short_name will be present.
1773type CallbackQuery struct {
1774	// ID unique identifier for this query
1775	ID string `json:"id"`
1776	// From sender
1777	From *User `json:"from"`
1778	// Message with the callback button that originated the query.
1779	// Note that message content and message date will not be available if the
1780	// message is too old.
1781	//
1782	// optional
1783	Message *Message `json:"message,omitempty"`
1784	// InlineMessageID identifier of the message sent via the bot in inline
1785	// mode, that originated the query.
1786	//
1787	// optional
1788	InlineMessageID string `json:"inline_message_id,omitempty"`
1789	// ChatInstance global identifier, uniquely corresponding to the chat to
1790	// which the message with the callback button was sent. Useful for high
1791	// scores in games.
1792	ChatInstance string `json:"chat_instance"`
1793	// Data associated with the callback button. Be aware that
1794	// a bad client can send arbitrary data in this field.
1795	//
1796	// optional
1797	Data string `json:"data,omitempty"`
1798	// GameShortName short name of a Game to be returned, serves as the unique identifier for the game.
1799	//
1800	// optional
1801	GameShortName string `json:"game_short_name,omitempty"`
1802}
1803
1804// ForceReply when receiving a message with this object, Telegram clients will
1805// display a reply interface to the user (act as if the user has selected the
1806// bot's message and tapped 'Reply'). This can be extremely useful if you  want
1807// to create user-friendly step-by-step interfaces without having to sacrifice
1808// privacy mode.
1809type ForceReply struct {
1810	// ForceReply shows reply interface to the user,
1811	// as if they manually selected the bot's message and tapped 'Reply'.
1812	ForceReply bool `json:"force_reply"`
1813	// InputFieldPlaceholder is the placeholder to be shown in the input field when
1814	// the reply is active; 1-64 characters.
1815	//
1816	// optional
1817	InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
1818	// Selective use this parameter if you want to force reply from specific users only.
1819	// Targets:
1820	//  1) users that are @mentioned in the text of the Message object;
1821	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
1822	//
1823	// optional
1824	Selective bool `json:"selective,omitempty"`
1825}
1826
1827// ChatPhoto represents a chat photo.
1828type ChatPhoto struct {
1829	// SmallFileID is a file identifier of small (160x160) chat photo.
1830	// This file_id can be used only for photo download and
1831	// only for as long as the photo is not changed.
1832	SmallFileID string `json:"small_file_id"`
1833	// SmallFileUniqueID is a unique file identifier of small (160x160) chat
1834	// photo, which is supposed to be the same over time and for different bots.
1835	// Can't be used to download or reuse the file.
1836	SmallFileUniqueID string `json:"small_file_unique_id"`
1837	// BigFileID is a file identifier of big (640x640) chat photo.
1838	// This file_id can be used only for photo download and
1839	// only for as long as the photo is not changed.
1840	BigFileID string `json:"big_file_id"`
1841	// BigFileUniqueID is a file identifier of big (640x640) chat photo, which
1842	// is supposed to be the same over time and for different bots. Can't be
1843	// used to download or reuse the file.
1844	BigFileUniqueID string `json:"big_file_unique_id"`
1845}
1846
1847// ChatInviteLink represents an invite link for a chat.
1848type ChatInviteLink struct {
1849	// InviteLink is the invite link. If the link was created by another chat
1850	// administrator, then the second part of the link will be replaced with “…”.
1851	InviteLink string `json:"invite_link"`
1852	// Creator of the link.
1853	Creator User `json:"creator"`
1854	// CreatesJoinRequest is true if users joining the chat via the link need to
1855	// be approved by chat administrators.
1856	//
1857	// optional
1858	CreatesJoinRequest bool `json:"creates_join_request,omitempty"`
1859	// IsPrimary is true, if the link is primary.
1860	IsPrimary bool `json:"is_primary"`
1861	// IsRevoked is true, if the link is revoked.
1862	IsRevoked bool `json:"is_revoked"`
1863	// Name is the name of the invite link.
1864	//
1865	// optional
1866	Name string `json:"name,omitempty"`
1867	// ExpireDate is the point in time (Unix timestamp) when the link will
1868	// expire or has been expired.
1869	//
1870	// optional
1871	ExpireDate int `json:"expire_date,omitempty"`
1872	// MemberLimit is the maximum number of users that can be members of the
1873	// chat simultaneously after joining the chat via this invite link; 1-99999.
1874	//
1875	// optional
1876	MemberLimit int `json:"member_limit,omitempty"`
1877	// PendingJoinRequestCount is the number of pending join requests created
1878	// using this link.
1879	//
1880	// optional
1881	PendingJoinRequestCount int `json:"pending_join_request_count,omitempty"`
1882}
1883
1884type ChatAdministratorRights struct {
1885	IsAnonymous         bool `json:"is_anonymous"`
1886	CanManageChat       bool `json:"can_manage_chat"`
1887	CanDeleteMessages   bool `json:"can_delete_messages"`
1888	CanManageVideoChats bool `json:"can_manage_video_chats"`
1889	CanRestrictMembers  bool `json:"can_restrict_members"`
1890	CanPromoteMembers   bool `json:"can_promote_members"`
1891	CanChangeInfo       bool `json:"can_change_info"`
1892	CanInviteUsers      bool `json:"can_invite_users"`
1893	CanPostMessages     bool `json:"can_post_messages"`
1894	CanEditMessages     bool `json:"can_edit_messages"`
1895	CanPinMessages      bool `json:"can_pin_messages"`
1896	CanPostStories      bool `json:"can_post_stories"`
1897	CanEditStories      bool `json:"can_edit_stories"`
1898	CanDeleteStories    bool `json:"can_delete_stories"`
1899	CanManageTopics     bool `json:"can_manage_topics"`
1900}
1901
1902// ChatMember contains information about one member of a chat.
1903type ChatMember struct {
1904	// User information about the user
1905	User *User `json:"user"`
1906	// Status the member's status in the chat.
1907	// Can be
1908	//  “creator”,
1909	//  “administrator”,
1910	//  “member”,
1911	//  “restricted”,
1912	//  “left” or
1913	//  “kicked”
1914	Status string `json:"status"`
1915	// CustomTitle owner and administrators only. Custom title for this user
1916	//
1917	// optional
1918	CustomTitle string `json:"custom_title,omitempty"`
1919	// IsAnonymous owner and administrators only. True, if the user's presence
1920	// in the chat is hidden
1921	//
1922	// optional
1923	IsAnonymous bool `json:"is_anonymous,omitempty"`
1924	// UntilDate restricted and kicked only.
1925	// Date when restrictions will be lifted for this user;
1926	// unix time.
1927	//
1928	// optional
1929	UntilDate int64 `json:"until_date,omitempty"`
1930	// CanBeEdited administrators only.
1931	// True, if the bot is allowed to edit administrator privileges of that user.
1932	//
1933	// optional
1934	CanBeEdited bool `json:"can_be_edited,omitempty"`
1935	// CanManageChat administrators only.
1936	// True, if the administrator can access the chat event log, chat
1937	// statistics, message statistics in channels, see channel members, see
1938	// anonymous administrators in supergroups and ignore slow mode. Implied by
1939	// any other administrator privilege.
1940	//
1941	// optional
1942	CanManageChat bool `json:"can_manage_chat,omitempty"`
1943	// CanPostMessages administrators only.
1944	// True, if the administrator can post in the channel;
1945	// channels only.
1946	//
1947	// optional
1948	CanPostMessages bool `json:"can_post_messages,omitempty"`
1949	// CanEditMessages administrators only.
1950	// True, if the administrator can edit messages of other users and can pin messages;
1951	// channels only.
1952	//
1953	// optional
1954	CanEditMessages bool `json:"can_edit_messages,omitempty"`
1955	// CanDeleteMessages administrators only.
1956	// True, if the administrator can delete messages of other users.
1957	//
1958	// optional
1959	CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
1960	// CanManageVideoChats administrators only.
1961	// True, if the administrator can manage video chats.
1962	//
1963	// optional
1964	CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"`
1965	// CanRestrictMembers administrators only.
1966	// True, if the administrator can restrict, ban or unban chat members.
1967	//
1968	// optional
1969	CanRestrictMembers bool `json:"can_restrict_members,omitempty"`
1970	// CanPromoteMembers administrators only.
1971	// True, if the administrator can add new administrators
1972	// with a subset of their own privileges or demote administrators that he has promoted,
1973	// directly or indirectly (promoted by administrators that were appointed by the user).
1974	//
1975	// optional
1976	CanPromoteMembers bool `json:"can_promote_members,omitempty"`
1977	// CanChangeInfo administrators and restricted only.
1978	// True, if the user is allowed to change the chat title, photo and other settings.
1979	//
1980	// optional
1981	CanChangeInfo bool `json:"can_change_info,omitempty"`
1982	// CanInviteUsers administrators and restricted only.
1983	// True, if the user is allowed to invite new users to the chat.
1984	//
1985	// optional
1986	CanInviteUsers bool `json:"can_invite_users,omitempty"`
1987	// CanPinMessages administrators and restricted only.
1988	// True, if the user is allowed to pin messages; groups and supergroups only
1989	//
1990	// optional
1991	CanPinMessages bool `json:"can_pin_messages,omitempty"`
1992	// CanPostStories administrators only.
1993	// True, if the administrator can post stories in the channel; channels only
1994	//
1995	// optional
1996	CanPostStories bool `json:"can_post_stories,omitempty"`
1997	// CanEditStories administrators only.
1998	// True, if the administrator can edit stories posted by other users; channels only
1999	//
2000	// optional
2001	CanEditStories bool `json:"can_edit_stories,omitempty"`
2002	// CanDeleteStories administrators only.
2003	// True, if the administrator can delete stories posted by other users; channels only
2004	//
2005	// optional
2006	CanDeleteStories bool `json:"can_delete_stories,omitempty"`
2007	// CanManageTopics administrators and restricted only.
2008	// True, if the user is allowed to create, rename,
2009	// close, and reopen forum topics; supergroups only
2010	//
2011	// optional
2012	CanManageTopics bool `json:"can_manage_topics,omitempty"`
2013	// IsMember is true, if the user is a member of the chat at the moment of
2014	// the request
2015	IsMember bool `json:"is_member"`
2016	// CanSendMessages
2017	//
2018	// optional
2019	CanSendMessages bool `json:"can_send_messages,omitempty"`
2020	// CanSendAudios restricted only.
2021	// True, if the user is allowed to send audios
2022	//
2023	// optional
2024	CanSendAudios bool
2025	// CanSendDocuments restricted only.
2026	// True, if the user is allowed to send documents
2027	//
2028	// optional
2029	CanSendDocuments bool
2030	// CanSendPhotos is restricted only.
2031	// True, if the user is allowed to send photos
2032	//
2033	// optional
2034	CanSendPhotos bool
2035	// CanSendVideos restricted only.
2036	// True, if the user is allowed to send videos
2037	//
2038	// optional
2039	CanSendVideos bool
2040	// CanSendVideoNotes restricted only.
2041	// True, if the user is allowed to send video notes
2042	//
2043	// optional
2044	CanSendVideoNotes bool
2045	// CanSendVoiceNotes restricted only.
2046	// True, if the user is allowed to send voice notes
2047	//
2048	// optional
2049	CanSendVoiceNotes bool
2050	// CanSendPolls restricted only.
2051	// True, if the user is allowed to send polls
2052	//
2053	// optional
2054	CanSendPolls bool `json:"can_send_polls,omitempty"`
2055	// CanSendOtherMessages restricted only.
2056	// True, if the user is allowed to send audios, documents,
2057	// photos, videos, video notes and voice notes.
2058	//
2059	// optional
2060	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
2061	// CanAddWebPagePreviews restricted only.
2062	// True, if the user is allowed to add web page previews to their messages.
2063	//
2064	// optional
2065	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
2066}
2067
2068// IsCreator returns if the ChatMember was the creator of the chat.
2069func (chat ChatMember) IsCreator() bool { return chat.Status == "creator" }
2070
2071// IsAdministrator returns if the ChatMember is a chat administrator.
2072func (chat ChatMember) IsAdministrator() bool { return chat.Status == "administrator" }
2073
2074// HasLeft returns if the ChatMember left the chat.
2075func (chat ChatMember) HasLeft() bool { return chat.Status == "left" }
2076
2077// WasKicked returns if the ChatMember was kicked from the chat.
2078func (chat ChatMember) WasKicked() bool { return chat.Status == "kicked" }
2079
2080// SetCanSendMediaMessages is a method to replace field "can_send_media_messages".
2081// It sets CanSendAudio, CanSendDocuments, CanSendPhotos, CanSendVideos,
2082// CanSendVideoNotes, CanSendVoiceNotes to passed value.
2083func (chat *ChatMember) SetCanSendMediaMessages(b bool) {
2084	chat.CanSendAudios = b
2085	chat.CanSendDocuments = b
2086	chat.CanSendPhotos = b
2087	chat.CanSendVideos = b
2088	chat.CanSendVideoNotes = b
2089	chat.CanSendVoiceNotes = b
2090}
2091
2092// CanSendMediaMessages method to replace field "can_send_media_messages".
2093// It returns true if CanSendAudio and CanSendDocuments and CanSendPhotos and CanSendVideos and
2094// CanSendVideoNotes and CanSendVoiceNotes are true.
2095func (chat *ChatMember) CanSendMediaMessages() bool {
2096	return chat.CanSendAudios && chat.CanSendDocuments &&
2097		chat.CanSendPhotos && chat.CanSendVideos &&
2098		chat.CanSendVideoNotes && chat.CanSendVoiceNotes
2099}
2100
2101// ChatMemberUpdated represents changes in the status of a chat member.
2102type ChatMemberUpdated struct {
2103	// Chat the user belongs to.
2104	Chat Chat `json:"chat"`
2105	// From is the performer of the action, which resulted in the change.
2106	From User `json:"from"`
2107	// Date the change was done in Unix time.
2108	Date int `json:"date"`
2109	// Previous information about the chat member.
2110	OldChatMember ChatMember `json:"old_chat_member"`
2111	// New information about the chat member.
2112	NewChatMember ChatMember `json:"new_chat_member"`
2113	// InviteLink is the link which was used by the user to join the chat;
2114	// for joining by invite link events only.
2115	//
2116	// optional
2117	InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
2118	// ViaChatFolderInviteLink is True, if the user joined the chat
2119	// via a chat folder invite link
2120	//
2121	// optional
2122	ViaChatFolderInviteLink bool `json:"via_chat_folder_invite_link,omitempty"`
2123}
2124
2125// ChatJoinRequest represents a join request sent to a chat.
2126type ChatJoinRequest struct {
2127	// Chat to which the request was sent.
2128	Chat Chat `json:"chat"`
2129	// User that sent the join request.
2130	From User `json:"from"`
2131	// UserChatID identifier of a private chat with the user who sent the join request.
2132	UserChatID int64 `json:"user_chat_id"`
2133	// Date the request was sent in Unix time.
2134	Date int `json:"date"`
2135	// Bio of the user.
2136	//
2137	// optional
2138	Bio string `json:"bio,omitempty"`
2139	// InviteLink is the link that was used by the user to send the join request.
2140	//
2141	// optional
2142	InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
2143}
2144
2145// ChatPermissions describes actions that a non-administrator user is
2146// allowed to take in a chat. All fields are optional.
2147type ChatPermissions struct {
2148	// CanSendMessages is true, if the user is allowed to send text messages,
2149	// contacts, locations and venues
2150	//
2151	// optional
2152	CanSendMessages bool `json:"can_send_messages,omitempty"`
2153	// CanSendAudios is true, if the user is allowed to send audios
2154	//
2155	// optional
2156	CanSendAudios bool
2157	// CanSendDocuments is true, if the user is allowed to send documents
2158	//
2159	// optional
2160	CanSendDocuments bool
2161	// CanSendPhotos is true, if the user is allowed to send photos
2162	//
2163	// optional
2164	CanSendPhotos bool
2165	// CanSendVideos is true, if the user is allowed to send videos
2166	//
2167	// optional
2168	CanSendVideos bool
2169	// CanSendVideoNotes is true, if the user is allowed to send video notes
2170	//
2171	// optional
2172	CanSendVideoNotes bool
2173	// CanSendVoiceNotes is true, if the user is allowed to send voice notes
2174	//
2175	// optional
2176	CanSendVoiceNotes bool
2177	// CanSendPolls is true, if the user is allowed to send polls, implies
2178	// can_send_messages
2179	//
2180	// optional
2181	CanSendPolls bool `json:"can_send_polls,omitempty"`
2182	// CanSendOtherMessages is true, if the user is allowed to send animations,
2183	// games, stickers and use inline bots, implies can_send_media_messages
2184	//
2185	// optional
2186	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
2187	// CanAddWebPagePreviews is true, if the user is allowed to add web page
2188	// previews to their messages, implies can_send_media_messages
2189	//
2190	// optional
2191	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
2192	// CanChangeInfo is true, if the user is allowed to change the chat title,
2193	// photo and other settings. Ignored in public supergroups
2194	//
2195	// optional
2196	CanChangeInfo bool `json:"can_change_info,omitempty"`
2197	// CanInviteUsers is true, if the user is allowed to invite new users to the
2198	// chat
2199	//
2200	// optional
2201	CanInviteUsers bool `json:"can_invite_users,omitempty"`
2202	// CanPinMessages is true, if the user is allowed to pin messages. Ignored
2203	// in public supergroups
2204	//
2205	// optional
2206	CanPinMessages bool `json:"can_pin_messages,omitempty"`
2207	// CanManageTopics is true, if the user is allowed to create forum topics.
2208	// If omitted defaults to the value of can_pin_messages
2209	//
2210	// optional
2211	CanManageTopics bool `json:"can_manage_topics,omitempty"`
2212}
2213
2214// SetCanSendMediaMessages is a method to replace field "can_send_media_messages".
2215// It sets CanSendAudio, CanSendDocuments, CanSendPhotos, CanSendVideos,
2216// CanSendVideoNotes, CanSendVoiceNotes to passed value.
2217func (c *ChatPermissions) SetCanSendMediaMessages(b bool) {
2218	c.CanSendAudios = b
2219	c.CanSendDocuments = b
2220	c.CanSendPhotos = b
2221	c.CanSendVideos = b
2222	c.CanSendVideoNotes = b
2223	c.CanSendVoiceNotes = b
2224}
2225
2226// CanSendMediaMessages method to replace field "can_send_media_messages".
2227// It returns true if CanSendAudio and CanSendDocuments and CanSendPhotos and CanSendVideos and
2228// CanSendVideoNotes and CanSendVoiceNotes are true.
2229func (c *ChatPermissions) CanSendMediaMessages() bool {
2230	return c.CanSendAudios && c.CanSendDocuments &&
2231		c.CanSendPhotos && c.CanSendVideos &&
2232		c.CanSendVideoNotes && c.CanSendVoiceNotes
2233}
2234
2235// ChatLocation represents a location to which a chat is connected.
2236type ChatLocation struct {
2237	// Location is the location to which the supergroup is connected. Can't be a
2238	// live location.
2239	Location Location `json:"location"`
2240	// Address is the location address; 1-64 characters, as defined by the chat
2241	// owner
2242	Address string `json:"address"`
2243}
2244
2245// ForumTopic represents a forum topic.
2246type ForumTopic struct {
2247	// MessageThreadID is the unique identifier of the forum topic
2248	MessageThreadID int `json:"message_thread_id"`
2249	// Name is the name of the topic
2250	Name string `json:"name"`
2251	// IconColor is the color of the topic icon in RGB format
2252	IconColor int `json:"icon_color"`
2253	// IconCustomEmojiID is the unique identifier of the custom emoji
2254	// shown as the topic icon
2255	//
2256	// optional
2257	IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
2258}
2259
2260// BotCommand represents a bot command.
2261type BotCommand struct {
2262	// Command text of the command, 1-32 characters.
2263	// Can contain only lowercase English letters, digits and underscores.
2264	Command string `json:"command"`
2265	// Description of the command, 3-256 characters.
2266	Description string `json:"description"`
2267}
2268
2269// BotCommandScope represents the scope to which bot commands are applied.
2270//
2271// It contains the fields for all types of scopes, different types only support
2272// specific (or no) fields.
2273type BotCommandScope struct {
2274	Type   string `json:"type"`
2275	ChatID int64  `json:"chat_id,omitempty"`
2276	UserID int64  `json:"user_id,omitempty"`
2277}
2278
2279// BotName represents the bot's name.
2280type BotName struct {
2281	Name string `json:"name"`
2282}
2283
2284// BotDescription represents the bot's description.
2285type BotDescription struct {
2286	Description string `json:"description"`
2287}
2288
2289// BotShortDescription represents the bot's short description
2290type BotShortDescription struct {
2291	ShortDescription string `json:"short_description"`
2292}
2293
2294// MenuButton describes the bot's menu button in a private chat.
2295type MenuButton struct {
2296	// Type is the type of menu button, must be one of:
2297	// - `commands`
2298	// - `web_app`
2299	// - `default`
2300	Type string `json:"type"`
2301	// Text is the text on the button, for `web_app` type.
2302	Text string `json:"text,omitempty"`
2303	// WebApp is the description of the Web App that will be launched when the
2304	// user presses the button for the `web_app` type.
2305	WebApp *WebAppInfo `json:"web_app,omitempty"`
2306}
2307
2308// ResponseParameters are various errors that can be returned in APIResponse.
2309type ResponseParameters struct {
2310	// The group has been migrated to a supergroup with the specified identifier.
2311	//
2312	// optional
2313	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
2314	// In case of exceeding flood control, the number of seconds left to wait
2315	// before the request can be repeated.
2316	//
2317	// optional
2318	RetryAfter int `json:"retry_after,omitempty"`
2319}
2320
2321// BaseInputMedia is a base type for the InputMedia types.
2322type BaseInputMedia struct {
2323	// Type of the result.
2324	Type string `json:"type"`
2325	// Media file to send. Pass a file_id to send a file
2326	// that exists on the Telegram servers (recommended),
2327	// pass an HTTP URL for Telegram to get a file from the Internet,
2328	// or pass “attach://<file_attach_name>” to upload a new one
2329	// using multipart/form-data under <file_attach_name> name.
2330	Media RequestFileData `json:"media"`
2331	// thumb intentionally missing as it is not currently compatible
2332
2333	// Caption of the video to be sent, 0-1024 characters after entities parsing.
2334	//
2335	// optional
2336	Caption string `json:"caption,omitempty"`
2337	// ParseMode mode for parsing entities in the video caption.
2338	// See formatting options for more details
2339	// (https://core.telegram.org/bots/api#formatting-options).
2340	//
2341	// optional
2342	ParseMode string `json:"parse_mode,omitempty"`
2343	// CaptionEntities is a list of special entities that appear in the caption,
2344	// which can be specified instead of parse_mode
2345	//
2346	// optional
2347	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
2348	// HasSpoiler pass True, if the photo needs to be covered with a spoiler animation
2349	//
2350	// optional
2351	HasSpoiler bool `json:"has_spoiler,omitempty"`
2352}
2353
2354// InputMediaPhoto is a photo to send as part of a media group.
2355type InputMediaPhoto struct {
2356	BaseInputMedia
2357}
2358
2359// InputMediaVideo is a video to send as part of a media group.
2360type InputMediaVideo struct {
2361	BaseInputMedia
2362	// Thumbnail of the file sent; can be ignored if thumbnail generation for
2363	// the file is supported server-side.
2364	//
2365	// optional
2366	Thumb RequestFileData `json:"thumbnail,omitempty"`
2367	// Width video width
2368	//
2369	// optional
2370	Width int `json:"width,omitempty"`
2371	// Height video height
2372	//
2373	// optional
2374	Height int `json:"height,omitempty"`
2375	// Duration video duration
2376	//
2377	// optional
2378	Duration int `json:"duration,omitempty"`
2379	// SupportsStreaming pass True, if the uploaded video is suitable for streaming.
2380	//
2381	// optional
2382	SupportsStreaming bool `json:"supports_streaming,omitempty"`
2383	// HasSpoiler pass True, if the video needs to be covered with a spoiler animation
2384	//
2385	// optional
2386	HasSpoiler bool `json:"has_spoiler,omitempty"`
2387}
2388
2389// InputMediaAnimation is an animation to send as part of a media group.
2390type InputMediaAnimation struct {
2391	BaseInputMedia
2392	// Thumbnail of the file sent; can be ignored if thumbnail generation for
2393	// the file is supported server-side.
2394	//
2395	// optional
2396	Thumb RequestFileData `json:"thumbnail,omitempty"`
2397	// Width video width
2398	//
2399	// optional
2400	Width int `json:"width,omitempty"`
2401	// Height video height
2402	//
2403	// optional
2404	Height int `json:"height,omitempty"`
2405	// Duration video duration
2406	//
2407	// optional
2408	Duration int `json:"duration,omitempty"`
2409	// HasSpoiler pass True, if the photo needs to be covered with a spoiler animation
2410	//
2411	// optional
2412	HasSpoiler bool `json:"has_spoiler,omitempty"`
2413}
2414
2415// InputMediaAudio is an audio to send as part of a media group.
2416type InputMediaAudio struct {
2417	BaseInputMedia
2418	// Thumbnail of the file sent; can be ignored if thumbnail generation for
2419	// the file is supported server-side.
2420	//
2421	// optional
2422	Thumb RequestFileData `json:"thumbnail,omitempty"`
2423	// Duration of the audio in seconds
2424	//
2425	// optional
2426	Duration int `json:"duration,omitempty"`
2427	// Performer of the audio
2428	//
2429	// optional
2430	Performer string `json:"performer,omitempty"`
2431	// Title of the audio
2432	//
2433	// optional
2434	Title string `json:"title,omitempty"`
2435}
2436
2437// InputMediaDocument is a general file to send as part of a media group.
2438type InputMediaDocument struct {
2439	BaseInputMedia
2440	// Thumbnail of the file sent; can be ignored if thumbnail generation for
2441	// the file is supported server-side.
2442	//
2443	// optional
2444	Thumb RequestFileData `json:"thumbnail,omitempty"`
2445	// DisableContentTypeDetection disables automatic server-side content type
2446	// detection for files uploaded using multipart/form-data. Always true, if
2447	// the document is sent as part of an album
2448	//
2449	// optional
2450	DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"`
2451}
2452
2453// Constant values for sticker types
2454const (
2455	StickerTypeRegular     = "regular"
2456	StickerTypeMask        = "mask"
2457	StickerTypeCustomEmoji = "custom_emoji"
2458)
2459
2460// Sticker represents a sticker.
2461type Sticker struct {
2462	// FileID is an identifier for this file, which can be used to download or
2463	// reuse the file
2464	FileID string `json:"file_id"`
2465	// FileUniqueID is a unique identifier for this file,
2466	// which is supposed to be the same over time and for different bots.
2467	// Can't be used to download or reuse the file.
2468	FileUniqueID string `json:"file_unique_id"`
2469	// Type is a type of the sticker, currently one of “regular”,
2470	// “mask”, “custom_emoji”. The type of the sticker is independent
2471	// from its format, which is determined by the fields is_animated and is_video.
2472	Type string `json:"type"`
2473	// Width sticker width
2474	Width int `json:"width"`
2475	// Height sticker height
2476	Height int `json:"height"`
2477	// IsAnimated true, if the sticker is animated
2478	//
2479	// optional
2480	IsAnimated bool `json:"is_animated,omitempty"`
2481	// IsVideo true, if the sticker is a video sticker
2482	//
2483	// optional
2484	IsVideo bool `json:"is_video,omitempty"`
2485	// Thumbnail sticker thumbnail in the .WEBP or .JPG format
2486	//
2487	// optional
2488	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
2489	// Emoji associated with the sticker
2490	//
2491	// optional
2492	Emoji string `json:"emoji,omitempty"`
2493	// SetName of the sticker set to which the sticker belongs
2494	//
2495	// optional
2496	SetName string `json:"set_name,omitempty"`
2497	// PremiumAnimation for premium regular stickers, premium animation for the sticker
2498	//
2499	// optional
2500	PremiumAnimation *File `json:"premium_animation,omitempty"`
2501	// MaskPosition is for mask stickers, the position where the mask should be
2502	// placed
2503	//
2504	// optional
2505	MaskPosition *MaskPosition `json:"mask_position,omitempty"`
2506	// CustomEmojiID for custom emoji stickers, unique identifier of the custom emoji
2507	//
2508	// optional
2509	CustomEmojiID string `json:"custom_emoji_id,omitempty"`
2510	// 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
2511	//
2512	//optional
2513	NeedsRepainting bool `json:"needs_reainting,omitempty"`
2514	// FileSize
2515	//
2516	// optional
2517	FileSize int `json:"file_size,omitempty"`
2518}
2519
2520// IsRegular returns if the Sticker is regular
2521func (s Sticker) IsRegular() bool {
2522	return s.Type == StickerTypeRegular
2523}
2524
2525// IsMask returns if the Sticker is mask
2526func (s Sticker) IsMask() bool {
2527	return s.Type == StickerTypeMask
2528}
2529
2530// IsCustomEmoji returns if the Sticker is custom emoji
2531func (s Sticker) IsCustomEmoji() bool {
2532	return s.Type == StickerTypeCustomEmoji
2533}
2534
2535// StickerSet represents a sticker set.
2536type StickerSet struct {
2537	// Name sticker set name
2538	Name string `json:"name"`
2539	// Title sticker set title
2540	Title string `json:"title"`
2541	// StickerType of stickers in the set, currently one of “regular”, “mask”, “custom_emoji”
2542	StickerType string `json:"sticker_type"`
2543	// IsAnimated true, if the sticker set contains animated stickers
2544	IsAnimated bool `json:"is_animated"`
2545	// IsVideo true, if the sticker set contains video stickers
2546	IsVideo bool `json:"is_video"`
2547	// ContainsMasks true, if the sticker set contains masks
2548	//
2549	// deprecated. Use sticker_type instead
2550	ContainsMasks bool `json:"contains_masks"`
2551	// Stickers list of all set stickers
2552	Stickers []Sticker `json:"stickers"`
2553	// Thumb is the sticker set thumbnail in the .WEBP or .TGS format
2554	Thumbnail *PhotoSize `json:"thumbnail"`
2555}
2556
2557// IsRegular returns if the StickerSet is regular
2558func (s StickerSet) IsRegular() bool {
2559	return s.StickerType == StickerTypeRegular
2560}
2561
2562// IsMask returns if the StickerSet is mask
2563func (s StickerSet) IsMask() bool {
2564	return s.StickerType == StickerTypeMask
2565}
2566
2567// IsCustomEmoji returns if the StickerSet is custom emoji
2568func (s StickerSet) IsCustomEmoji() bool {
2569	return s.StickerType == StickerTypeCustomEmoji
2570}
2571
2572// MaskPosition describes the position on faces where a mask should be placed
2573// by default.
2574type MaskPosition struct {
2575	// The part of the face relative to which the mask should be placed.
2576	// One of “forehead”, “eyes”, “mouth”, or “chin”.
2577	Point string `json:"point"`
2578	// Shift by X-axis measured in widths of the mask scaled to the face size,
2579	// from left to right. For example, choosing -1.0 will place mask just to
2580	// the left of the default mask position.
2581	XShift float64 `json:"x_shift"`
2582	// Shift by Y-axis measured in heights of the mask scaled to the face size,
2583	// from top to bottom. For example, 1.0 will place the mask just below the
2584	// default mask position.
2585	YShift float64 `json:"y_shift"`
2586	// Mask scaling coefficient. For example, 2.0 means double size.
2587	Scale float64 `json:"scale"`
2588}
2589
2590// InputSticker describes a sticker to be added to a sticker set.
2591type InputSticker struct {
2592	// 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.
2593	Sticker RequestFile `json:"sticker"`
2594	// List of 1-20 emoji associated with the sticker
2595	EmojiList []string `json:"emoji_list"`
2596	// Position where the mask should be placed on faces. For “mask” stickers only.
2597	//
2598	// optional
2599	MaskPosition *MaskPosition `json:"mask_position"`
2600	// List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom_emoji” stickers only.
2601	//
2602	// optional
2603	Keywords []string `json:"keywords"`
2604}
2605
2606// Game represents a game. Use BotFather to create and edit games, their short
2607// names will act as unique identifiers.
2608type Game struct {
2609	// Title of the game
2610	Title string `json:"title"`
2611	// Description of the game
2612	Description string `json:"description"`
2613	// Photo that will be displayed in the game message in chats.
2614	Photo []PhotoSize `json:"photo"`
2615	// Text a brief description of the game or high scores included in the game message.
2616	// Can be automatically edited to include current high scores for the game
2617	// when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
2618	//
2619	// optional
2620	Text string `json:"text,omitempty"`
2621	// TextEntities special entities that appear in text, such as usernames, URLs, bot commands, etc.
2622	//
2623	// optional
2624	TextEntities []MessageEntity `json:"text_entities,omitempty"`
2625	// Animation is an animation that will be displayed in the game message in chats.
2626	// Upload via BotFather (https://t.me/botfather).
2627	//
2628	// optional
2629	Animation Animation `json:"animation,omitempty"`
2630}
2631
2632// GameHighScore is a user's score and position on the leaderboard.
2633type GameHighScore struct {
2634	// Position in high score table for the game
2635	Position int `json:"position"`
2636	// User user
2637	User User `json:"user"`
2638	// Score score
2639	Score int `json:"score"`
2640}
2641
2642// CallbackGame is for starting a game in an inline keyboard button.
2643type CallbackGame struct{}
2644
2645// SwitchInlineQueryChosenChat represents an inline button that switches the current
2646// user to inline mode in a chosen chat, with an optional default inline query.
2647type SwitchInlineQueryChosenChat struct {
2648	// Query is default inline query to be inserted in the input field.
2649	// If left empty, only the bot's username will be inserted
2650	//
2651	// optional
2652	Query string `json:"query,omitempty"`
2653	// AllowUserChats is True, if private chats with users can be chosen
2654	//
2655	// optional
2656	AllowUserChats bool `json:"allow_user_chats,omitempty"`
2657	// AllowBotChats is True, if private chats with bots can be chosen
2658	//
2659	// optional
2660	AllowBotChats bool `json:"allow_bot_chats,omitempty"`
2661	// AllowGroupChats is True, if group and supergroup chats can be chosen
2662	//
2663	// optional
2664	AllowGroupChats bool `json:"allow_group_chats,omitempty"`
2665	// AllowChannelChats is True, if channel chats can be chosen
2666	//
2667	// optional
2668	AllowChannelChats bool `json:"allow_channel_chats,omitempty"`
2669}
2670
2671// WebhookInfo is information about a currently set webhook.
2672type WebhookInfo struct {
2673	// URL webhook URL, may be empty if webhook is not set up.
2674	URL string `json:"url"`
2675	// HasCustomCertificate true, if a custom certificate was provided for webhook certificate checks.
2676	HasCustomCertificate bool `json:"has_custom_certificate"`
2677	// PendingUpdateCount number of updates awaiting delivery.
2678	PendingUpdateCount int `json:"pending_update_count"`
2679	// IPAddress is the currently used webhook IP address
2680	//
2681	// optional
2682	IPAddress string `json:"ip_address,omitempty"`
2683	// LastErrorDate unix time for the most recent error
2684	// that happened when trying to deliver an update via webhook.
2685	//
2686	// optional
2687	LastErrorDate int `json:"last_error_date,omitempty"`
2688	// LastErrorMessage error message in human-readable format for the most recent error
2689	// that happened when trying to deliver an update via webhook.
2690	//
2691	// optional
2692	LastErrorMessage string `json:"last_error_message,omitempty"`
2693	// LastSynchronizationErrorDate is the unix time of the most recent error that
2694	// happened when trying to synchronize available updates with Telegram datacenters.
2695	LastSynchronizationErrorDate int `json:"last_synchronization_error_date,omitempty"`
2696	// MaxConnections maximum allowed number of simultaneous
2697	// HTTPS connections to the webhook for update delivery.
2698	//
2699	// optional
2700	MaxConnections int `json:"max_connections,omitempty"`
2701	// AllowedUpdates is a list of update types the bot is subscribed to.
2702	// Defaults to all update types
2703	//
2704	// optional
2705	AllowedUpdates []string `json:"allowed_updates,omitempty"`
2706}
2707
2708// IsSet returns true if a webhook is currently set.
2709func (info WebhookInfo) IsSet() bool {
2710	return info.URL != ""
2711}
2712
2713// InlineQuery is a Query from Telegram for an inline request.
2714type InlineQuery struct {
2715	// ID unique identifier for this query
2716	ID string `json:"id"`
2717	// From sender
2718	From *User `json:"from"`
2719	// Query text of the query (up to 256 characters).
2720	Query string `json:"query"`
2721	// Offset of the results to be returned, can be controlled by the bot.
2722	Offset string `json:"offset"`
2723	// Type of the chat, from which the inline query was sent. Can be either
2724	// “sender” for a private chat with the inline query sender, “private”,
2725	// “group”, “supergroup”, or “channel”. The chat type should be always known
2726	// for requests sent from official clients and most third-party clients,
2727	// unless the request was sent from a secret chat
2728	//
2729	// optional
2730	ChatType string `json:"chat_type,omitempty"`
2731	// Location sender location, only for bots that request user location.
2732	//
2733	// optional
2734	Location *Location `json:"location,omitempty"`
2735}
2736
2737// InlineQueryResultCachedAudio is an inline query response with cached audio.
2738type InlineQueryResultCachedAudio struct {
2739	// Type of the result, must be audio
2740	Type string `json:"type"`
2741	// ID unique identifier for this result, 1-64 bytes
2742	ID string `json:"id"`
2743	// AudioID a valid file identifier for the audio file
2744	AudioID string `json:"audio_file_id"`
2745	// Caption 0-1024 characters after entities parsing
2746	//
2747	// optional
2748	Caption string `json:"caption,omitempty"`
2749	// ParseMode mode for parsing entities in the video caption.
2750	// See formatting options for more details
2751	// (https://core.telegram.org/bots/api#formatting-options).
2752	//
2753	// optional
2754	ParseMode string `json:"parse_mode,omitempty"`
2755	// CaptionEntities is a list of special entities that appear in the caption,
2756	// which can be specified instead of parse_mode
2757	//
2758	// optional
2759	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
2760	// ReplyMarkup inline keyboard attached to the message
2761	//
2762	// optional
2763	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2764	// InputMessageContent content of the message to be sent instead of the audio
2765	//
2766	// optional
2767	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2768}
2769
2770// InlineQueryResultCachedDocument is an inline query response with cached document.
2771type InlineQueryResultCachedDocument struct {
2772	// Type of the result, must be a document
2773	Type string `json:"type"`
2774	// ID unique identifier for this result, 1-64 bytes
2775	ID string `json:"id"`
2776	// DocumentID a valid file identifier for the file
2777	DocumentID string `json:"document_file_id"`
2778	// Title for the result
2779	//
2780	// optional
2781	Title string `json:"title,omitempty"`
2782	// Caption of the document to be sent, 0-1024 characters after entities parsing
2783	//
2784	// optional
2785	Caption string `json:"caption,omitempty"`
2786	// Description short description of the result
2787	//
2788	// optional
2789	Description string `json:"description,omitempty"`
2790	// ParseMode mode for parsing entities in the video caption.
2791	//	// See formatting options for more details
2792	//	// (https://core.telegram.org/bots/api#formatting-options).
2793	//
2794	// optional
2795	ParseMode string `json:"parse_mode,omitempty"`
2796	// CaptionEntities is a list of special entities that appear in the caption,
2797	// which can be specified instead of parse_mode
2798	//
2799	// optional
2800	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
2801	// ReplyMarkup inline keyboard attached to the message
2802	//
2803	// optional
2804	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2805	// InputMessageContent content of the message to be sent instead of the file
2806	//
2807	// optional
2808	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2809}
2810
2811// InlineQueryResultCachedGIF is an inline query response with cached gif.
2812type InlineQueryResultCachedGIF struct {
2813	// Type of the result, must be gif.
2814	Type string `json:"type"`
2815	// ID unique identifier for this result, 1-64 bytes.
2816	ID string `json:"id"`
2817	// GifID a valid file identifier for the GIF file.
2818	GIFID string `json:"gif_file_id"`
2819	// Title for the result
2820	//
2821	// optional
2822	Title string `json:"title,omitempty"`
2823	// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
2824	//
2825	// optional
2826	Caption string `json:"caption,omitempty"`
2827	// ParseMode mode for parsing entities in the caption.
2828	// See formatting options for more details
2829	// (https://core.telegram.org/bots/api#formatting-options).
2830	//
2831	// optional
2832	ParseMode string `json:"parse_mode,omitempty"`
2833	// CaptionEntities is a list of special entities that appear in the caption,
2834	// which can be specified instead of parse_mode
2835	//
2836	// optional
2837	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
2838	// ReplyMarkup inline keyboard attached to the message.
2839	//
2840	// optional
2841	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2842	// InputMessageContent content of the message to be sent instead of the GIF animation.
2843	//
2844	// optional
2845	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2846}
2847
2848// InlineQueryResultCachedMPEG4GIF is an inline query response with cached
2849// H.264/MPEG-4 AVC video without sound gif.
2850type InlineQueryResultCachedMPEG4GIF struct {
2851	// Type of the result, must be mpeg4_gif
2852	Type string `json:"type"`
2853	// ID unique identifier for this result, 1-64 bytes
2854	ID string `json:"id"`
2855	// MPEG4FileID a valid file identifier for the MP4 file
2856	MPEG4FileID string `json:"mpeg4_file_id"`
2857	// Title for the result
2858	//
2859	// optional
2860	Title string `json:"title,omitempty"`
2861	// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
2862	//
2863	// optional
2864	Caption string `json:"caption,omitempty"`
2865	// ParseMode mode for parsing entities in the caption.
2866	// See formatting options for more details
2867	// (https://core.telegram.org/bots/api#formatting-options).
2868	//
2869	// optional
2870	ParseMode string `json:"parse_mode,omitempty"`
2871	// ParseMode mode for parsing entities in the video caption.
2872	// See formatting options for more details
2873	// (https://core.telegram.org/bots/api#formatting-options).
2874	//
2875	// optional
2876	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
2877	// ReplyMarkup inline keyboard attached to the message.
2878	//
2879	// optional
2880	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2881	// InputMessageContent content of the message to be sent instead of the video animation.
2882	//
2883	// optional
2884	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2885}
2886
2887// InlineQueryResultCachedPhoto is an inline query response with cached photo.
2888type InlineQueryResultCachedPhoto struct {
2889	// Type of the result, must be a photo.
2890	Type string `json:"type"`
2891	// ID unique identifier for this result, 1-64 bytes.
2892	ID string `json:"id"`
2893	// PhotoID a valid file identifier of the photo.
2894	PhotoID string `json:"photo_file_id"`
2895	// Title for the result.
2896	//
2897	// optional
2898	Title string `json:"title,omitempty"`
2899	// Description short description of the result.
2900	//
2901	// optional
2902	Description string `json:"description,omitempty"`
2903	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
2904	//
2905	// optional
2906	Caption string `json:"caption,omitempty"`
2907	// ParseMode mode for parsing entities in the photo caption.
2908	// See formatting options for more details
2909	// (https://core.telegram.org/bots/api#formatting-options).
2910	//
2911	// optional
2912	ParseMode string `json:"parse_mode,omitempty"`
2913	// CaptionEntities is a list of special entities that appear in the caption,
2914	// which can be specified instead of parse_mode
2915	//
2916	// optional
2917	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
2918	// ReplyMarkup inline keyboard attached to the message.
2919	//
2920	// optional
2921	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2922	// InputMessageContent content of the message to be sent instead of the photo.
2923	//
2924	// optional
2925	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2926}
2927
2928// InlineQueryResultCachedSticker is an inline query response with cached sticker.
2929type InlineQueryResultCachedSticker struct {
2930	// Type of the result, must be a sticker
2931	Type string `json:"type"`
2932	// ID unique identifier for this result, 1-64 bytes
2933	ID string `json:"id"`
2934	// StickerID a valid file identifier of the sticker
2935	StickerID string `json:"sticker_file_id"`
2936	// Title is a title
2937	Title string `json:"title"`
2938	// ReplyMarkup inline keyboard attached to the message
2939	//
2940	// optional
2941	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2942	// InputMessageContent content of the message to be sent instead of the sticker
2943	//
2944	// optional
2945	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2946}
2947
2948// InlineQueryResultCachedVideo is an inline query response with cached video.
2949type InlineQueryResultCachedVideo struct {
2950	// Type of the result, must be video
2951	Type string `json:"type"`
2952	// ID unique identifier for this result, 1-64 bytes
2953	ID string `json:"id"`
2954	// VideoID a valid file identifier for the video file
2955	VideoID string `json:"video_file_id"`
2956	// Title for the result
2957	Title string `json:"title"`
2958	// Description short description of the result
2959	//
2960	// optional
2961	Description string `json:"description,omitempty"`
2962	// Caption of the video to be sent, 0-1024 characters after entities parsing
2963	//
2964	// optional
2965	Caption string `json:"caption,omitempty"`
2966	// ParseMode mode for parsing entities in the video caption.
2967	// See formatting options for more details
2968	// (https://core.telegram.org/bots/api#formatting-options).
2969	//
2970	// optional
2971	ParseMode string `json:"parse_mode,omitempty"`
2972	// CaptionEntities is a list of special entities that appear in the caption,
2973	// which can be specified instead of parse_mode
2974	//
2975	// optional
2976	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
2977	// ReplyMarkup inline keyboard attached to the message
2978	//
2979	// optional
2980	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2981	// InputMessageContent content of the message to be sent instead of the video
2982	//
2983	// optional
2984	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2985}
2986
2987// InlineQueryResultCachedVoice is an inline query response with cached voice.
2988type InlineQueryResultCachedVoice struct {
2989	// Type of the result, must be voice
2990	Type string `json:"type"`
2991	// ID unique identifier for this result, 1-64 bytes
2992	ID string `json:"id"`
2993	// VoiceID a valid file identifier for the voice message
2994	VoiceID string `json:"voice_file_id"`
2995	// Title voice message title
2996	Title string `json:"title"`
2997	// Caption 0-1024 characters after entities parsing
2998	//
2999	// optional
3000	Caption string `json:"caption,omitempty"`
3001	// ParseMode mode for parsing entities in the video caption.
3002	// See formatting options for more details
3003	// (https://core.telegram.org/bots/api#formatting-options).
3004	//
3005	// optional
3006	ParseMode string `json:"parse_mode,omitempty"`
3007	// CaptionEntities is a list of special entities that appear in the caption,
3008	// which can be specified instead of parse_mode
3009	//
3010	// optional
3011	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
3012	// ReplyMarkup inline keyboard attached to the message
3013	//
3014	// optional
3015	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3016	// InputMessageContent content of the message to be sent instead of the voice message
3017	//
3018	// optional
3019	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3020}
3021
3022// InlineQueryResultArticle represents a link to an article or web page.
3023type InlineQueryResultArticle struct {
3024	// Type of the result, must be article.
3025	Type string `json:"type"`
3026	// ID unique identifier for this result, 1-64 Bytes.
3027	ID string `json:"id"`
3028	// Title of the result
3029	Title string `json:"title"`
3030	// InputMessageContent content of the message to be sent.
3031	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3032	// ReplyMarkup Inline keyboard attached to the message.
3033	//
3034	// optional
3035	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3036	// URL of the result.
3037	//
3038	// optional
3039	URL string `json:"url,omitempty"`
3040	// HideURL pass True, if you don't want the URL to be shown in the message.
3041	//
3042	// optional
3043	HideURL bool `json:"hide_url,omitempty"`
3044	// Description short description of the result.
3045	//
3046	// optional
3047	Description string `json:"description,omitempty"`
3048	// ThumbURL url of the thumbnail for the result
3049	//
3050	// optional
3051	ThumbURL string `json:"thumbnail_url,omitempty"`
3052	// ThumbWidth thumbnail width
3053	//
3054	// optional
3055	ThumbWidth int `json:"thumbnail_width,omitempty"`
3056	// ThumbHeight thumbnail height
3057	//
3058	// optional
3059	ThumbHeight int `json:"thumbnail_height,omitempty"`
3060}
3061
3062// InlineQueryResultAudio is an inline query response audio.
3063type InlineQueryResultAudio struct {
3064	// Type of the result, must be audio
3065	Type string `json:"type"`
3066	// ID unique identifier for this result, 1-64 bytes
3067	ID string `json:"id"`
3068	// URL a valid url for the audio file
3069	URL string `json:"audio_url"`
3070	// Title is a title
3071	Title string `json:"title"`
3072	// Caption 0-1024 characters after entities parsing
3073	//
3074	// optional
3075	Caption string `json:"caption,omitempty"`
3076	// ParseMode mode for parsing entities in the video caption.
3077	// See formatting options for more details
3078	// (https://core.telegram.org/bots/api#formatting-options).
3079	//
3080	// optional
3081	ParseMode string `json:"parse_mode,omitempty"`
3082	// CaptionEntities is a list of special entities that appear in the caption,
3083	// which can be specified instead of parse_mode
3084	//
3085	// optional
3086	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
3087	// Performer is a performer
3088	//
3089	// optional
3090	Performer string `json:"performer,omitempty"`
3091	// Duration audio duration in seconds
3092	//
3093	// optional
3094	Duration int `json:"audio_duration,omitempty"`
3095	// ReplyMarkup inline keyboard attached to the message
3096	//
3097	// optional
3098	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3099	// InputMessageContent content of the message to be sent instead of the audio
3100	//
3101	// optional
3102	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3103}
3104
3105// InlineQueryResultContact is an inline query response contact.
3106type InlineQueryResultContact struct {
3107	Type                string                `json:"type"`         // required
3108	ID                  string                `json:"id"`           // required
3109	PhoneNumber         string                `json:"phone_number"` // required
3110	FirstName           string                `json:"first_name"`   // required
3111	LastName            string                `json:"last_name"`
3112	VCard               string                `json:"vcard"`
3113	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3114	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
3115	ThumbURL            string                `json:"thumbnail_url"`
3116	ThumbWidth          int                   `json:"thumbnail_width"`
3117	ThumbHeight         int                   `json:"thumbnail_height"`
3118}
3119
3120// InlineQueryResultGame is an inline query response game.
3121type InlineQueryResultGame struct {
3122	// Type of the result, must be game
3123	Type string `json:"type"`
3124	// ID unique identifier for this result, 1-64 bytes
3125	ID string `json:"id"`
3126	// GameShortName short name of the game
3127	GameShortName string `json:"game_short_name"`
3128	// ReplyMarkup inline keyboard attached to the message
3129	//
3130	// optional
3131	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3132}
3133
3134// InlineQueryResultDocument is an inline query response document.
3135type InlineQueryResultDocument struct {
3136	// Type of the result, must be a document
3137	Type string `json:"type"`
3138	// ID unique identifier for this result, 1-64 bytes
3139	ID string `json:"id"`
3140	// Title for the result
3141	Title string `json:"title"`
3142	// Caption of the document to be sent, 0-1024 characters after entities parsing
3143	//
3144	// optional
3145	Caption string `json:"caption,omitempty"`
3146	// URL a valid url for the file
3147	URL string `json:"document_url"`
3148	// MimeType of the content of the file, either “application/pdf” or “application/zip”
3149	MimeType string `json:"mime_type"`
3150	// Description short description of the result
3151	//
3152	// optional
3153	Description string `json:"description,omitempty"`
3154	// ReplyMarkup inline keyboard attached to the message
3155	//
3156	// optional
3157	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3158	// InputMessageContent content of the message to be sent instead of the file
3159	//
3160	// optional
3161	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3162	// ThumbURL url of the thumbnail (jpeg only) for the file
3163	//
3164	// optional
3165	ThumbURL string `json:"thumbnail_url,omitempty"`
3166	// ThumbWidth thumbnail width
3167	//
3168	// optional
3169	ThumbWidth int `json:"thumbnail_width,omitempty"`
3170	// ThumbHeight thumbnail height
3171	//
3172	// optional
3173	ThumbHeight int `json:"thumbnail_height,omitempty"`
3174}
3175
3176// InlineQueryResultGIF is an inline query response GIF.
3177type InlineQueryResultGIF struct {
3178	// Type of the result, must be gif.
3179	Type string `json:"type"`
3180	// ID unique identifier for this result, 1-64 bytes.
3181	ID string `json:"id"`
3182	// URL a valid URL for the GIF file. File size must not exceed 1MB.
3183	URL string `json:"gif_url"`
3184	// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
3185	ThumbURL string `json:"thumbnail_url"`
3186	// MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”
3187	ThumbMimeType string `json:"thumbnail_mime_type,omitempty"`
3188	// Width of the GIF
3189	//
3190	// optional
3191	Width int `json:"gif_width,omitempty"`
3192	// Height of the GIF
3193	//
3194	// optional
3195	Height int `json:"gif_height,omitempty"`
3196	// Duration of the GIF
3197	//
3198	// optional
3199	Duration int `json:"gif_duration,omitempty"`
3200	// Title for the result
3201	//
3202	// optional
3203	Title string `json:"title,omitempty"`
3204	// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
3205	//
3206	// optional
3207	Caption string `json:"caption,omitempty"`
3208	// ParseMode mode for parsing entities in the video caption.
3209	// See formatting options for more details
3210	// (https://core.telegram.org/bots/api#formatting-options).
3211	//
3212	// optional
3213	ParseMode string `json:"parse_mode,omitempty"`
3214	// CaptionEntities is a list of special entities that appear in the caption,
3215	// which can be specified instead of parse_mode
3216	//
3217	// optional
3218	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
3219	// ReplyMarkup inline keyboard attached to the message
3220	//
3221	// optional
3222	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3223	// InputMessageContent content of the message to be sent instead of the GIF animation.
3224	//
3225	// optional
3226	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3227}
3228
3229// InlineQueryResultLocation is an inline query response location.
3230type InlineQueryResultLocation struct {
3231	// Type of the result, must be location
3232	Type string `json:"type"`
3233	// ID unique identifier for this result, 1-64 Bytes
3234	ID string `json:"id"`
3235	// Latitude  of the location in degrees
3236	Latitude float64 `json:"latitude"`
3237	// Longitude of the location in degrees
3238	Longitude float64 `json:"longitude"`
3239	// Title of the location
3240	Title string `json:"title"`
3241	// HorizontalAccuracy is the radius of uncertainty for the location,
3242	// measured in meters; 0-1500
3243	//
3244	// optional
3245	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
3246	// LivePeriod is the period in seconds for which the location can be
3247	// updated, should be between 60 and 86400.
3248	//
3249	// optional
3250	LivePeriod int `json:"live_period,omitempty"`
3251	// Heading is for live locations, a direction in which the user is moving,
3252	// in degrees. Must be between 1 and 360 if specified.
3253	//
3254	// optional
3255	Heading int `json:"heading,omitempty"`
3256	// ProximityAlertRadius is for live locations, a maximum distance for
3257	// proximity alerts about approaching another chat member, in meters. Must
3258	// be between 1 and 100000 if specified.
3259	//
3260	// optional
3261	ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
3262	// ReplyMarkup inline keyboard attached to the message
3263	//
3264	// optional
3265	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3266	// InputMessageContent content of the message to be sent instead of the location
3267	//
3268	// optional
3269	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3270	// ThumbURL url of the thumbnail for the result
3271	//
3272	// optional
3273	ThumbURL string `json:"thumbnail_url,omitempty"`
3274	// ThumbWidth thumbnail width
3275	//
3276	// optional
3277	ThumbWidth int `json:"thumbnail_width,omitempty"`
3278	// ThumbHeight thumbnail height
3279	//
3280	// optional
3281	ThumbHeight int `json:"thumbnail_height,omitempty"`
3282}
3283
3284// InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.
3285type InlineQueryResultMPEG4GIF struct {
3286	// Type of the result, must be mpeg4_gif
3287	Type string `json:"type"`
3288	// ID unique identifier for this result, 1-64 bytes
3289	ID string `json:"id"`
3290	// URL a valid URL for the MP4 file. File size must not exceed 1MB
3291	URL string `json:"mpeg4_url"`
3292	// Width video width
3293	//
3294	// optional
3295	Width int `json:"mpeg4_width,omitempty"`
3296	// Height vVideo height
3297	//
3298	// optional
3299	Height int `json:"mpeg4_height,omitempty"`
3300	// Duration video duration
3301	//
3302	// optional
3303	Duration int `json:"mpeg4_duration,omitempty"`
3304	// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
3305	ThumbURL string `json:"thumbnail_url"`
3306	// MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”
3307	ThumbMimeType string `json:"thumbnail_mime_type,omitempty"`
3308	// Title for the result
3309	//
3310	// optional
3311	Title string `json:"title,omitempty"`
3312	// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
3313	//
3314	// optional
3315	Caption string `json:"caption,omitempty"`
3316	// ParseMode mode for parsing entities in the video caption.
3317	// See formatting options for more details
3318	// (https://core.telegram.org/bots/api#formatting-options).
3319	//
3320	// optional
3321	ParseMode string `json:"parse_mode,omitempty"`
3322	// CaptionEntities is a list of special entities that appear in the caption,
3323	// which can be specified instead of parse_mode
3324	//
3325	// optional
3326	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
3327	// ReplyMarkup inline keyboard attached to the message
3328	//
3329	// optional
3330	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3331	// InputMessageContent content of the message to be sent instead of the video animation
3332	//
3333	// optional
3334	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3335}
3336
3337// InlineQueryResultPhoto is an inline query response photo.
3338type InlineQueryResultPhoto struct {
3339	// Type of the result, must be article.
3340	Type string `json:"type"`
3341	// ID unique identifier for this result, 1-64 Bytes.
3342	ID string `json:"id"`
3343	// URL a valid URL of the photo. Photo must be in jpeg format.
3344	// Photo size must not exceed 5MB.
3345	URL string `json:"photo_url"`
3346	// MimeType
3347	MimeType string `json:"mime_type"`
3348	// Width of the photo
3349	//
3350	// optional
3351	Width int `json:"photo_width,omitempty"`
3352	// Height of the photo
3353	//
3354	// optional
3355	Height int `json:"photo_height,omitempty"`
3356	// ThumbURL url of the thumbnail for the photo.
3357	//
3358	// optional
3359	ThumbURL string `json:"thumbnail_url,omitempty"`
3360	// Title for the result
3361	//
3362	// optional
3363	Title string `json:"title,omitempty"`
3364	// Description short description of the result
3365	//
3366	// optional
3367	Description string `json:"description,omitempty"`
3368	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
3369	//
3370	// optional
3371	Caption string `json:"caption,omitempty"`
3372	// ParseMode mode for parsing entities in the photo caption.
3373	// See formatting options for more details
3374	// (https://core.telegram.org/bots/api#formatting-options).
3375	//
3376	// optional
3377	ParseMode string `json:"parse_mode,omitempty"`
3378	// ReplyMarkup inline keyboard attached to the message.
3379	//
3380	// optional
3381	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3382	// CaptionEntities is a list of special entities that appear in the caption,
3383	// which can be specified instead of parse_mode
3384	//
3385	// optional
3386	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
3387	// InputMessageContent content of the message to be sent instead of the photo.
3388	//
3389	// optional
3390	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3391}
3392
3393// InlineQueryResultVenue is an inline query response venue.
3394type InlineQueryResultVenue struct {
3395	// Type of the result, must be venue
3396	Type string `json:"type"`
3397	// ID unique identifier for this result, 1-64 Bytes
3398	ID string `json:"id"`
3399	// Latitude of the venue location in degrees
3400	Latitude float64 `json:"latitude"`
3401	// Longitude of the venue location in degrees
3402	Longitude float64 `json:"longitude"`
3403	// Title of the venue
3404	Title string `json:"title"`
3405	// Address of the venue
3406	Address string `json:"address"`
3407	// FoursquareID foursquare identifier of the venue if known
3408	//
3409	// optional
3410	FoursquareID string `json:"foursquare_id,omitempty"`
3411	// FoursquareType foursquare type of the venue, if known.
3412	// (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
3413	//
3414	// optional
3415	FoursquareType string `json:"foursquare_type,omitempty"`
3416	// GooglePlaceID is the Google Places identifier of the venue
3417	//
3418	// optional
3419	GooglePlaceID string `json:"google_place_id,omitempty"`
3420	// GooglePlaceType is the Google Places type of the venue
3421	//
3422	// optional
3423	GooglePlaceType string `json:"google_place_type,omitempty"`
3424	// ReplyMarkup inline keyboard attached to the message
3425	//
3426	// optional
3427	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3428	// InputMessageContent content of the message to be sent instead of the venue
3429	//
3430	// optional
3431	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3432	// ThumbURL url of the thumbnail for the result
3433	//
3434	// optional
3435	ThumbURL string `json:"thumbnail_url,omitempty"`
3436	// ThumbWidth thumbnail width
3437	//
3438	// optional
3439	ThumbWidth int `json:"thumbnail_width,omitempty"`
3440	// ThumbHeight thumbnail height
3441	//
3442	// optional
3443	ThumbHeight int `json:"thumbnail_height,omitempty"`
3444}
3445
3446// InlineQueryResultVideo is an inline query response video.
3447type InlineQueryResultVideo struct {
3448	// Type of the result, must be video
3449	Type string `json:"type"`
3450	// ID unique identifier for this result, 1-64 bytes
3451	ID string `json:"id"`
3452	// URL a valid url for the embedded video player or video file
3453	URL string `json:"video_url"`
3454	// MimeType of the content of video url, “text/html” or “video/mp4”
3455	MimeType string `json:"mime_type"`
3456	//
3457	// ThumbURL url of the thumbnail (jpeg only) for the video
3458	// optional
3459	ThumbURL string `json:"thumbnail_url,omitempty"`
3460	// Title for the result
3461	Title string `json:"title"`
3462	// Caption of the video to be sent, 0-1024 characters after entities parsing
3463	//
3464	// optional
3465	Caption string `json:"caption,omitempty"`
3466	// Width video width
3467	//
3468	// optional
3469	Width int `json:"video_width,omitempty"`
3470	// Height video height
3471	//
3472	// optional
3473	Height int `json:"video_height,omitempty"`
3474	// Duration video duration in seconds
3475	//
3476	// optional
3477	Duration int `json:"video_duration,omitempty"`
3478	// Description short description of the result
3479	//
3480	// optional
3481	Description string `json:"description,omitempty"`
3482	// ReplyMarkup inline keyboard attached to the message
3483	//
3484	// optional
3485	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3486	// InputMessageContent content of the message to be sent instead of the video.
3487	// This field is required if InlineQueryResultVideo is used to send
3488	// an HTML-page as a result (e.g., a YouTube video).
3489	//
3490	// optional
3491	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3492}
3493
3494// InlineQueryResultVoice is an inline query response voice.
3495type InlineQueryResultVoice struct {
3496	// Type of the result, must be voice
3497	Type string `json:"type"`
3498	// ID unique identifier for this result, 1-64 bytes
3499	ID string `json:"id"`
3500	// URL a valid URL for the voice recording
3501	URL string `json:"voice_url"`
3502	// Title recording title
3503	Title string `json:"title"`
3504	// Caption 0-1024 characters after entities parsing
3505	//
3506	// optional
3507	Caption string `json:"caption,omitempty"`
3508	// ParseMode mode for parsing entities in the video caption.
3509	// See formatting options for more details
3510	// (https://core.telegram.org/bots/api#formatting-options).
3511	//
3512	// optional
3513	ParseMode string `json:"parse_mode,omitempty"`
3514	// CaptionEntities is a list of special entities that appear in the caption,
3515	// which can be specified instead of parse_mode
3516	//
3517	// optional
3518	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
3519	// Duration recording duration in seconds
3520	//
3521	// optional
3522	Duration int `json:"voice_duration,omitempty"`
3523	// ReplyMarkup inline keyboard attached to the message
3524	//
3525	// optional
3526	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3527	// InputMessageContent content of the message to be sent instead of the voice recording
3528	//
3529	// optional
3530	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3531}
3532
3533// ChosenInlineResult is an inline query result chosen by a User
3534type ChosenInlineResult struct {
3535	// ResultID the unique identifier for the result that was chosen
3536	ResultID string `json:"result_id"`
3537	// From the user that chose the result
3538	From *User `json:"from"`
3539	// Location sender location, only for bots that require user location
3540	//
3541	// optional
3542	Location *Location `json:"location,omitempty"`
3543	// InlineMessageID identifier of the sent inline message.
3544	// Available only if there is an inline keyboard attached to the message.
3545	// Will be also received in callback queries and can be used to edit the message.
3546	//
3547	// optional
3548	InlineMessageID string `json:"inline_message_id,omitempty"`
3549	// Query the query that was used to obtain the result
3550	Query string `json:"query"`
3551}
3552
3553// SentWebAppMessage contains information about an inline message sent by a Web App
3554// on behalf of a user.
3555type SentWebAppMessage struct {
3556	// Identifier of the sent inline message. Available only if there is an inline
3557	// keyboard attached to the message.
3558	//
3559	// optional
3560	InlineMessageID string `json:"inline_message_id,omitempty"`
3561}
3562
3563// InputTextMessageContent contains text for displaying
3564// as an inline query result.
3565type InputTextMessageContent struct {
3566	// Text of the message to be sent, 1-4096 characters
3567	Text string `json:"message_text"`
3568	// ParseMode mode for parsing entities in the message text.
3569	// See formatting options for more details
3570	// (https://core.telegram.org/bots/api#formatting-options).
3571	//
3572	// optional
3573	ParseMode string `json:"parse_mode,omitempty"`
3574	// Entities is a list of special entities that appear in message text, which
3575	// can be specified instead of parse_mode
3576	//
3577	// optional
3578	Entities []MessageEntity `json:"entities,omitempty"`
3579	// DisableWebPagePreview disables link previews for links in the sent message
3580	//
3581	// optional
3582	DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"`
3583}
3584
3585// InputLocationMessageContent contains a location for displaying
3586// as an inline query result.
3587type InputLocationMessageContent struct {
3588	// Latitude of the location in degrees
3589	Latitude float64 `json:"latitude"`
3590	// Longitude of the location in degrees
3591	Longitude float64 `json:"longitude"`
3592	// HorizontalAccuracy is the radius of uncertainty for the location,
3593	// measured in meters; 0-1500
3594	//
3595	// optional
3596	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
3597	// LivePeriod is the period in seconds for which the location can be
3598	// updated, should be between 60 and 86400
3599	//
3600	// optional
3601	LivePeriod int `json:"live_period,omitempty"`
3602	// Heading is for live locations, a direction in which the user is moving,
3603	// in degrees. Must be between 1 and 360 if specified.
3604	//
3605	// optional
3606	Heading int `json:"heading,omitempty"`
3607	// ProximityAlertRadius is for live locations, a maximum distance for
3608	// proximity alerts about approaching another chat member, in meters. Must
3609	// be between 1 and 100000 if specified.
3610	//
3611	// optional
3612	ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
3613}
3614
3615// InputVenueMessageContent contains a venue for displaying
3616// as an inline query result.
3617type InputVenueMessageContent struct {
3618	// Latitude of the venue in degrees
3619	Latitude float64 `json:"latitude"`
3620	// Longitude of the venue in degrees
3621	Longitude float64 `json:"longitude"`
3622	// Title name of the venue
3623	Title string `json:"title"`
3624	// Address of the venue
3625	Address string `json:"address"`
3626	// FoursquareID foursquare identifier of the venue, if known
3627	//
3628	// optional
3629	FoursquareID string `json:"foursquare_id,omitempty"`
3630	// FoursquareType Foursquare type of the venue, if known
3631	//
3632	// optional
3633	FoursquareType string `json:"foursquare_type,omitempty"`
3634	// GooglePlaceID is the Google Places identifier of the venue
3635	//
3636	// optional
3637	GooglePlaceID string `json:"google_place_id,omitempty"`
3638	// GooglePlaceType is the Google Places type of the venue
3639	//
3640	// optional
3641	GooglePlaceType string `json:"google_place_type,omitempty"`
3642}
3643
3644// InputContactMessageContent contains a contact for displaying
3645// as an inline query result.
3646type InputContactMessageContent struct {
3647	// 	PhoneNumber contact's phone number
3648	PhoneNumber string `json:"phone_number"`
3649	// FirstName contact's first name
3650	FirstName string `json:"first_name"`
3651	// LastName contact's last name
3652	//
3653	// optional
3654	LastName string `json:"last_name,omitempty"`
3655	// Additional data about the contact in the form of a vCard
3656	//
3657	// optional
3658	VCard string `json:"vcard,omitempty"`
3659}
3660
3661// InputInvoiceMessageContent represents the content of an invoice message to be
3662// sent as the result of an inline query.
3663type InputInvoiceMessageContent struct {
3664	// Product name, 1-32 characters
3665	Title string `json:"title"`
3666	// Product description, 1-255 characters
3667	Description string `json:"description"`
3668	// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to
3669	// the user, use for your internal processes.
3670	Payload string `json:"payload"`
3671	// Payment provider token, obtained via Botfather
3672	ProviderToken string `json:"provider_token"`
3673	// Three-letter ISO 4217 currency code
3674	Currency string `json:"currency"`
3675	// Price breakdown, a JSON-serialized list of components (e.g. product
3676	// price, tax, discount, delivery cost, delivery tax, bonus, etc.)
3677	Prices []LabeledPrice `json:"prices"`
3678	// The maximum accepted amount for tips in the smallest units of the
3679	// currency (integer, not float/double).
3680	//
3681	// optional
3682	MaxTipAmount int `json:"max_tip_amount,omitempty"`
3683	// An array of suggested amounts of tip in the smallest units of the
3684	// currency (integer, not float/double). At most 4 suggested tip amounts can
3685	// be specified. The suggested tip amounts must be positive, passed in a
3686	// strictly increased order and must not exceed max_tip_amount.
3687	//
3688	// optional
3689	SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitempty"`
3690	// A JSON-serialized object for data about the invoice, which will be shared
3691	// with the payment provider. A detailed description of the required fields
3692	// should be provided by the payment provider.
3693	//
3694	// optional
3695	ProviderData string `json:"provider_data,omitempty"`
3696	// URL of the product photo for the invoice. Can be a photo of the goods or
3697	// a marketing image for a service. People like it better when they see what
3698	// they are paying for.
3699	//
3700	// optional
3701	PhotoURL string `json:"photo_url,omitempty"`
3702	// Photo size
3703	//
3704	// optional
3705	PhotoSize int `json:"photo_size,omitempty"`
3706	// Photo width
3707	//
3708	// optional
3709	PhotoWidth int `json:"photo_width,omitempty"`
3710	// Photo height
3711	//
3712	// optional
3713	PhotoHeight int `json:"photo_height,omitempty"`
3714	// Pass True, if you require the user's full name to complete the order
3715	//
3716	// optional
3717	NeedName bool `json:"need_name,omitempty"`
3718	// Pass True, if you require the user's phone number to complete the order
3719	//
3720	// optional
3721	NeedPhoneNumber bool `json:"need_phone_number,omitempty"`
3722	// Pass True, if you require the user's email address to complete the order
3723	//
3724	// optional
3725	NeedEmail bool `json:"need_email,omitempty"`
3726	// Pass True, if you require the user's shipping address to complete the order
3727	//
3728	// optional
3729	NeedShippingAddress bool `json:"need_shipping_address,omitempty"`
3730	// Pass True, if user's phone number should be sent to provider
3731	//
3732	// optional
3733	SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"`
3734	// Pass True, if user's email address should be sent to provider
3735	//
3736	// optional
3737	SendEmailToProvider bool `json:"send_email_to_provider,omitempty"`
3738	// Pass True, if the final price depends on the shipping method
3739	//
3740	// optional
3741	IsFlexible bool `json:"is_flexible,omitempty"`
3742}
3743
3744// LabeledPrice represents a portion of the price for goods or services.
3745type LabeledPrice struct {
3746	// Label portion label
3747	Label string `json:"label"`
3748	// Amount price of the product in the smallest units of the currency (integer, not float/double).
3749	// For example, for a price of US$ 1.45 pass amount = 145.
3750	// See the exp parameter in currencies.json
3751	// (https://core.telegram.org/bots/payments/currencies.json),
3752	// it shows the number of digits past the decimal point
3753	// for each currency (2 for the majority of currencies).
3754	Amount int `json:"amount"`
3755}
3756
3757// Invoice contains basic information about an invoice.
3758type Invoice struct {
3759	// Title product name
3760	Title string `json:"title"`
3761	// Description product description
3762	Description string `json:"description"`
3763	// StartParameter unique bot deep-linking parameter that can be used to generate this invoice
3764	StartParameter string `json:"start_parameter"`
3765	// Currency three-letter ISO 4217 currency code
3766	// (see https://core.telegram.org/bots/payments#supported-currencies)
3767	Currency string `json:"currency"`
3768	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
3769	// For example, for a price of US$ 1.45 pass amount = 145.
3770	// See the exp parameter in currencies.json
3771	// (https://core.telegram.org/bots/payments/currencies.json),
3772	// it shows the number of digits past the decimal point
3773	// for each currency (2 for the majority of currencies).
3774	TotalAmount int `json:"total_amount"`
3775}
3776
3777// ShippingAddress represents a shipping address.
3778type ShippingAddress struct {
3779	// CountryCode ISO 3166-1 alpha-2 country code
3780	CountryCode string `json:"country_code"`
3781	// State if applicable
3782	State string `json:"state"`
3783	// City city
3784	City string `json:"city"`
3785	// StreetLine1 first line for the address
3786	StreetLine1 string `json:"street_line1"`
3787	// StreetLine2 second line for the address
3788	StreetLine2 string `json:"street_line2"`
3789	// PostCode address post code
3790	PostCode string `json:"post_code"`
3791}
3792
3793// OrderInfo represents information about an order.
3794type OrderInfo struct {
3795	// Name user name
3796	//
3797	// optional
3798	Name string `json:"name,omitempty"`
3799	// PhoneNumber user's phone number
3800	//
3801	// optional
3802	PhoneNumber string `json:"phone_number,omitempty"`
3803	// Email user email
3804	//
3805	// optional
3806	Email string `json:"email,omitempty"`
3807	// ShippingAddress user shipping address
3808	//
3809	// optional
3810	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
3811}
3812
3813// ShippingOption represents one shipping option.
3814type ShippingOption struct {
3815	// ID shipping option identifier
3816	ID string `json:"id"`
3817	// Title option title
3818	Title string `json:"title"`
3819	// Prices list of price portions
3820	Prices []LabeledPrice `json:"prices"`
3821}
3822
3823// SuccessfulPayment contains basic information about a successful payment.
3824type SuccessfulPayment struct {
3825	// Currency three-letter ISO 4217 currency code
3826	// (see https://core.telegram.org/bots/payments#supported-currencies)
3827	Currency string `json:"currency"`
3828	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
3829	// For example, for a price of US$ 1.45 pass amount = 145.
3830	// See the exp parameter in currencies.json,
3831	// (https://core.telegram.org/bots/payments/currencies.json)
3832	// it shows the number of digits past the decimal point
3833	// for each currency (2 for the majority of currencies).
3834	TotalAmount int `json:"total_amount"`
3835	// InvoicePayload bot specified invoice payload
3836	InvoicePayload string `json:"invoice_payload"`
3837	// ShippingOptionID identifier of the shipping option chosen by the user
3838	//
3839	// optional
3840	ShippingOptionID string `json:"shipping_option_id,omitempty"`
3841	// OrderInfo order info provided by the user
3842	//
3843	// optional
3844	OrderInfo *OrderInfo `json:"order_info,omitempty"`
3845	// TelegramPaymentChargeID telegram payment identifier
3846	TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
3847	// ProviderPaymentChargeID provider payment identifier
3848	ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
3849}
3850
3851// ShippingQuery contains information about an incoming shipping query.
3852type ShippingQuery struct {
3853	// ID unique query identifier
3854	ID string `json:"id"`
3855	// From user who sent the query
3856	From *User `json:"from"`
3857	// InvoicePayload bot specified invoice payload
3858	InvoicePayload string `json:"invoice_payload"`
3859	// ShippingAddress user specified shipping address
3860	ShippingAddress *ShippingAddress `json:"shipping_address"`
3861}
3862
3863// PreCheckoutQuery contains information about an incoming pre-checkout query.
3864type PreCheckoutQuery struct {
3865	// ID unique query identifier
3866	ID string `json:"id"`
3867	// From user who sent the query
3868	From *User `json:"from"`
3869	// Currency three-letter ISO 4217 currency code
3870	//	// (see https://core.telegram.org/bots/payments#supported-currencies)
3871	Currency string `json:"currency"`
3872	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
3873	//	// For example, for a price of US$ 1.45 pass amount = 145.
3874	//	// See the exp parameter in currencies.json,
3875	//	// (https://core.telegram.org/bots/payments/currencies.json)
3876	//	// it shows the number of digits past the decimal point
3877	//	// for each currency (2 for the majority of currencies).
3878	TotalAmount int `json:"total_amount"`
3879	// InvoicePayload bot specified invoice payload
3880	InvoicePayload string `json:"invoice_payload"`
3881	// ShippingOptionID identifier of the shipping option chosen by the user
3882	//
3883	// optional
3884	ShippingOptionID string `json:"shipping_option_id,omitempty"`
3885	// OrderInfo order info provided by the user
3886	//
3887	// optional
3888	OrderInfo *OrderInfo `json:"order_info,omitempty"`
3889}