all repos — telegram-bot-api @ 303c6995b9cf12f9d4dbdbb41348b83e31dd3784

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