all repos — telegram-bot-api @ 10078d149287c57e4eb9bf34848ebf872324b001

Golang bindings for the Telegram Bot API

types.go (view raw)

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