all repos — telegram-bot-api @ 68663614af0037ee08d7175763002ee9b07a22e5

Golang bindings for the Telegram Bot API

types.go (view raw)

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