all repos — telegram-bot-api @ 2d0a34c34b2947e8f12372d6e1c56fd5bed01673

Golang bindings for the Telegram Bot API

types.go (view raw)

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