all repos — telegram-bot-api @ fde05dd128a5e2c022eb2236bfa1c99f6f8e1d82

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