all repos — telegram-bot-api @ fb1de2fb48ddd996b71aac24ec4aa2f5d87a9c31

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