all repos — telegram-bot-api @ 5e115c98c785b5aefa00552c0c366eb6940078f1

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