all repos — telegram-bot-api @ e404d8bf5e706c521788ab59082f289a3afb551e

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