all repos — telegram-bot-api @ f9ab9c0a4df305dcfc111e96a8b92c6fda442a39

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	// BusinessConnection the bot was connected to or disconnected from a
  65	// business account, or a user edited an existing connection with the bot
  66	//
  67	// optional
  68	BusinessConnection *BusinessConnection `json:"business_connection,omitempty"`
  69	// BusinessMessage is a new non-service message from a
  70	// connected business account
  71	//
  72	// optional
  73	BusinessMessage *Message `json:"business_message,omitempty"`
  74	// EditedBusinessMessage is a new version of a message from a
  75	// connected business account
  76	//
  77	// optional
  78	EditedBusinessMessage *Message `json:"edited_business_message,omitempty"`
  79	// DeletedBusinessMessages are the messages were deleted from a
  80	// connected business account
  81	//
  82	// optional
  83	DeletedBusinessMessages *BusinessMessagesDeleted `json:"deleted_business_messages,omitempty"`
  84	// MessageReaction is a reaction to a message was changed by a user.
  85	//
  86	// optional
  87	MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"`
  88	// MessageReactionCount reactions to a message with anonymous reactions were changed.
  89	//
  90	// optional
  91	MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`
  92	// InlineQuery new incoming inline query
  93	//
  94	// optional
  95	InlineQuery *InlineQuery `json:"inline_query,omitempty"`
  96	// ChosenInlineResult is the result of an inline query
  97	// that was chosen by a user and sent to their chat partner.
  98	// Please see our documentation on the feedback collecting
  99	// for details on how to enable these updates for your bot.
 100	//
 101	// optional
 102	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
 103	// CallbackQuery new incoming callback query
 104	//
 105	// optional
 106	CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
 107	// ShippingQuery new incoming shipping query. Only for invoices with
 108	// flexible price
 109	//
 110	// optional
 111	ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`
 112	// PreCheckoutQuery new incoming pre-checkout query. Contains full
 113	// information about checkout
 114	//
 115	// optional
 116	PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
 117	// Pool new poll state. Bots receive only updates about stopped polls and
 118	// polls, which are sent by the bot
 119	//
 120	// optional
 121	Poll *Poll `json:"poll,omitempty"`
 122	// PollAnswer user changed their answer in a non-anonymous poll. Bots
 123	// receive new votes only in polls that were sent by the bot itself.
 124	//
 125	// optional
 126	PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
 127	// MyChatMember is the bot's chat member status was updated in a chat. For
 128	// private chats, this update is received only when the bot is blocked or
 129	// unblocked by the user.
 130	//
 131	// optional
 132	MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`
 133	// ChatMember is a chat member's status was updated in a chat. The bot must
 134	// be an administrator in the chat and must explicitly specify "chat_member"
 135	// in the list of allowed_updates to receive these updates.
 136	//
 137	// optional
 138	ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`
 139	// ChatJoinRequest is a request to join the chat has been sent. The bot must
 140	// have the can_invite_users administrator right in the chat to receive
 141	// these updates.
 142	//
 143	// optional
 144	ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"`
 145	// ChatBoostUpdated represents a boost added to a chat or changed.
 146	//
 147	// optional
 148	ChatBoost *ChatBoostUpdated `json:"chat_boost,omitempty"`
 149	// ChatBoostRemoved represents a boost removed from a chat.
 150	//
 151	// optional
 152	ChatBoostRemoved *ChatBoostRemoved `json:"removed_chat_boost,omitempty"`
 153}
 154
 155// SentFrom returns the user who sent an update. Can be nil, if Telegram did not provide information
 156// about the user in the update object.
 157func (u *Update) SentFrom() *User {
 158	switch {
 159	case u.Message != nil:
 160		return u.Message.From
 161	case u.EditedMessage != nil:
 162		return u.EditedMessage.From
 163	case u.InlineQuery != nil:
 164		return u.InlineQuery.From
 165	case u.ChosenInlineResult != nil:
 166		return u.ChosenInlineResult.From
 167	case u.CallbackQuery != nil:
 168		return u.CallbackQuery.From
 169	case u.ShippingQuery != nil:
 170		return u.ShippingQuery.From
 171	case u.PreCheckoutQuery != nil:
 172		return u.PreCheckoutQuery.From
 173	default:
 174		return nil
 175	}
 176}
 177
 178// CallbackData returns the callback query data, if it exists.
 179func (u *Update) CallbackData() string {
 180	if u.CallbackQuery != nil {
 181		return u.CallbackQuery.Data
 182	}
 183	return ""
 184}
 185
 186// FromChat returns the chat where an update occurred.
 187func (u *Update) FromChat() *Chat {
 188	switch {
 189	case u.Message != nil:
 190		return &u.Message.Chat
 191	case u.EditedMessage != nil:
 192		return &u.EditedMessage.Chat
 193	case u.ChannelPost != nil:
 194		return &u.ChannelPost.Chat
 195	case u.EditedChannelPost != nil:
 196		return &u.EditedChannelPost.Chat
 197	case u.CallbackQuery != nil && u.CallbackQuery.Message != nil:
 198		return &u.CallbackQuery.Message.Chat
 199	default:
 200		return nil
 201	}
 202}
 203
 204// UpdatesChannel is the channel for getting updates.
 205type UpdatesChannel <-chan Update
 206
 207// Clear discards all unprocessed incoming updates.
 208func (ch UpdatesChannel) Clear() {
 209	for len(ch) != 0 {
 210		<-ch
 211	}
 212}
 213
 214// User represents a Telegram user or bot.
 215type User struct {
 216	// ID is a unique identifier for this user or bot
 217	ID int64 `json:"id"`
 218	// IsBot true, if this user is a bot
 219	//
 220	// optional
 221	IsBot bool `json:"is_bot,omitempty"`
 222	// IsPremium true, if user has Telegram Premium
 223	//
 224	// optional
 225	IsPremium bool `json:"is_premium,omitempty"`
 226	// AddedToAttachmentMenu true, if this user added the bot to the attachment menu
 227	//
 228	// optional
 229	AddedToAttachmentMenu bool `json:"added_to_attachment_menu,omitempty"`
 230	// FirstName user's or bot's first name
 231	FirstName string `json:"first_name"`
 232	// LastName user's or bot's last name
 233	//
 234	// optional
 235	LastName string `json:"last_name,omitempty"`
 236	// UserName user's or bot's username
 237	//
 238	// optional
 239	UserName string `json:"username,omitempty"`
 240	// LanguageCode IETF language tag of the user's language
 241	// more info: https://en.wikipedia.org/wiki/IETF_language_tag
 242	//
 243	// optional
 244	LanguageCode string `json:"language_code,omitempty"`
 245	// CanJoinGroups is true, if the bot can be invited to groups.
 246	// Returned only in getMe.
 247	//
 248	// optional
 249	CanJoinGroups bool `json:"can_join_groups,omitempty"`
 250	// CanReadAllGroupMessages is true, if privacy mode is disabled for the bot.
 251	// Returned only in getMe.
 252	//
 253	// optional
 254	CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`
 255	// SupportsInlineQueries is true, if the bot supports inline queries.
 256	// Returned only in getMe.
 257	//
 258	// optional
 259	SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
 260	// CanConnectToBusiness is true, if the bot can be connected to a
 261	// Telegram Business account to receive its messages.
 262	// Returned only in getMe.
 263	//
 264	// optional
 265	CanConnectToBusiness bool `json:"can_connect_to_business,omitempty"`
 266	// True, if the bot has a main Web App. Returned only in getMe.
 267	//
 268	// optional
 269	HasMainWebApp bool `json:"has_main_web_app,omitempty"`
 270}
 271
 272// String displays a simple text version of a user.
 273//
 274// It is normally a user's username, but falls back to a first/last
 275// name as available.
 276func (u *User) String() string {
 277	if u == nil {
 278		return ""
 279	}
 280	if u.UserName != "" {
 281		return u.UserName
 282	}
 283
 284	name := u.FirstName
 285	if u.LastName != "" {
 286		name += " " + u.LastName
 287	}
 288
 289	return name
 290}
 291
 292// Chat represents a chat.
 293type Chat struct {
 294	// ID is a unique identifier for this chat
 295	ID int64 `json:"id"`
 296	// Type of chat, can be either “private”, “group”, “supergroup” or “channel”
 297	Type string `json:"type"`
 298	// Title for supergroups, channels and group chats
 299	//
 300	// optional
 301	Title string `json:"title,omitempty"`
 302	// UserName for private chats, supergroups and channels if available
 303	//
 304	// optional
 305	UserName string `json:"username,omitempty"`
 306	// FirstName of the other party in a private chat
 307	//
 308	// optional
 309	FirstName string `json:"first_name,omitempty"`
 310	// LastName of the other party in a private chat
 311	//
 312	// optional
 313	LastName string `json:"last_name,omitempty"`
 314	// IsForum is true if the supergroup chat is a forum (has topics enabled)
 315	//
 316	// optional
 317	IsForum bool `json:"is_forum,omitempty"`
 318}
 319
 320// ChatFullInfo contains full information about a chat.
 321type ChatFullInfo struct {
 322	Chat
 323	// Photo is a chat photo
 324	Photo *ChatPhoto `json:"photo"`
 325	// If non-empty, the list of all active chat usernames;
 326	// for private chats, supergroups and channels. Returned only in getChat.
 327	//
 328	// optional
 329	ActiveUsernames []string `json:"active_usernames,omitempty"`
 330	// Birthdate for private chats, the date of birth of the user.
 331	// Returned only in getChat.
 332	//
 333	// optional
 334	Birthdate *Birthdate `json:"birthdate,omitempty"`
 335	// BusinessIntro is for private chats with business accounts, the intro of the business.
 336	// Returned only in getChat.
 337	//
 338	// optional
 339	BusinessIntro *BusinessIntro `json:"business_intro,omitempty"`
 340	// BusinessLocation is for private chats with business accounts, the location
 341	// of the business. Returned only in getChat.
 342	//
 343	// optional
 344	BusinessLocation *BusinessLocation `json:"business_location,omitempty"`
 345	// BusinessOpeningHours is for private chats with business accounts,
 346	// the opening hours of the business. Returned only in getChat.
 347	//
 348	// optional
 349	BusinessOpeningHours *BusinessOpeningHours `json:"business_opening_hours,omitempty"`
 350	// PersonalChat is for private chats, the personal channel of the user.
 351	// Returned only in getChat.
 352	//
 353	// optional
 354	PersonalChat *Chat `json:"personal_chat,omitempty"`
 355	// AvailableReactions is a list of available reactions allowed in the chat.
 356	// If omitted, then all emoji reactions are allowed. Returned only in getChat.
 357	//
 358	// optional
 359	AvailableReactions []ReactionType `json:"available_reactions,omitempty"`
 360	// AccentColorID is an identifier of the accent color for the chat name and backgrounds of
 361	// the chat photo, reply header, and link preview.
 362	// See accent colors for more details. Returned only in getChat.
 363	// Always returned in getChat.
 364	//
 365	// optional
 366	AccentColorID int `json:"accent_color_id,omitempty"`
 367	// The maximum number of reactions that can be set on a message in the chat
 368	MaxReactionCount int `json:"max_reaction_count"`
 369	// BackgroundCustomEmojiID is a custom emoji identifier of emoji chosen by
 370	// the chat for the reply header and link preview background.
 371	// Returned only in getChat.
 372	//
 373	// optional
 374	BackgroundCustomEmojiID string `json:"background_custom_emoji_id,omitempty"`
 375	// ProfileAccentColorID is ani dentifier of the accent color for the chat's profile background.
 376	// See profile accent colors for more details. Returned only in getChat.
 377	//
 378	// optional
 379	ProfileAccentColorID int `json:"profile_accent_color_id,omitempty"`
 380	// ProfileBackgroundCustomEmojiID is a custom emoji identifier of the emoji chosen by
 381	// the chat for its profile background. Returned only in getChat.
 382	//
 383	// optional
 384	ProfileBackgroundCustomEmojiID string `json:"profile_background_custom_emoji_id,omitempty"`
 385	// EmojiStatusCustomEmojiID is a custom emoji identifier of emoji status of the other party
 386	// in a private chat. Returned only in getChat.
 387	//
 388	// optional
 389	EmojiStatusCustomEmojiID string `json:"emoji_status_custom_emoji_id,omitempty"`
 390	// EmojiStatusExpirationDate is a date of the emoji status of the chat or the other party
 391	// in a private chat, in Unix time, if any. Returned only in getChat.
 392	//
 393	// optional
 394	EmojiStatusExpirationDate int64 `json:"emoji_status_expiration_date,omitempty"`
 395	// Bio is the bio of the other party in a private chat. Returned only in
 396	// getChat
 397	//
 398	// optional
 399	Bio string `json:"bio,omitempty"`
 400	// HasPrivateForwards is true if privacy settings of the other party in the
 401	// private chat allows to use tg://user?id=<user_id> links only in chats
 402	// with the user. Returned only in getChat.
 403	//
 404	// optional
 405	HasPrivateForwards bool `json:"has_private_forwards,omitempty"`
 406	// HasRestrictedVoiceAndVideoMessages if the privacy settings of the other party
 407	// restrict sending voice and video note messages
 408	// in the private chat. Returned only in getChat.
 409	//
 410	// optional
 411	HasRestrictedVoiceAndVideoMessages bool `json:"has_restricted_voice_and_video_messages,omitempty"`
 412	// JoinToSendMessages is true, if users need to join the supergroup
 413	// before they can send messages.
 414	// Returned only in getChat
 415	//
 416	// optional
 417	JoinToSendMessages bool `json:"join_to_send_messages,omitempty"`
 418	// JoinByRequest is true, if all users directly joining the supergroup
 419	// need to be approved by supergroup administrators.
 420	// Returned only in getChat.
 421	//
 422	// optional
 423	JoinByRequest bool `json:"join_by_request,omitempty"`
 424	// Description for groups, supergroups and channel chats
 425	//
 426	// optional
 427	Description string `json:"description,omitempty"`
 428	// InviteLink is a chat invite link, for groups, supergroups and channel chats.
 429	// Each administrator in a chat generates their own invite links,
 430	// so the bot must first generate the link using exportChatInviteLink
 431	//
 432	// optional
 433	InviteLink string `json:"invite_link,omitempty"`
 434	// PinnedMessage is the pinned message, for groups, supergroups and channels
 435	//
 436	// optional
 437	PinnedMessage *Message `json:"pinned_message,omitempty"`
 438	// Permissions are default chat member permissions, for groups and
 439	// supergroups. Returned only in getChat.
 440	//
 441	// optional
 442	Permissions *ChatPermissions `json:"permissions,omitempty"`
 443	// True, if paid media messages can be sent or forwarded to the channel chat.
 444	// The field is available only for channel chats.
 445	//
 446	// optional
 447	CanSendPaidMedia bool `json:"can_send_paid_media,omitempty"`
 448	// SlowModeDelay is for supergroups, the minimum allowed delay between
 449	// consecutive messages sent by each unprivileged user. Returned only in
 450	// getChat.
 451	//
 452	// optional
 453	SlowModeDelay int `json:"slow_mode_delay,omitempty"`
 454	// UnrestrictBoostCount  is for supergroups, the minimum number of boosts that
 455	// a non-administrator user needs to add in order to
 456	// ignore slow mode and chat permissions. Returned only in getChat.
 457	//
 458	// optional
 459	UnrestrictBoostCount int `json:"unrestrict_boost_count,omitempty"`
 460	// MessageAutoDeleteTime is the time after which all messages sent to the
 461	// chat will be automatically deleted; in seconds. Returned only in getChat.
 462	//
 463	// optional
 464	MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"`
 465	// HasAggressiveAntiSpamEnabled is true if aggressive anti-spam checks are enabled
 466	// in the supergroup. The field is only available to chat administrators.
 467	// Returned only in getChat.
 468	//
 469	// optional
 470	HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled,omitempty"`
 471	// HasHiddenMembers is true if non-administrators can only get
 472	// the list of bots and administrators in the chat.
 473	//
 474	// optional
 475	HasHiddenMembers bool `json:"has_hidden_members,omitempty"`
 476	// HasProtectedContent is true if messages from the chat can't be forwarded
 477	// to other chats. Returned only in getChat.
 478	//
 479	// optional
 480	HasProtectedContent bool `json:"has_protected_content,omitempty"`
 481	// HasVisibleHistory is True, if new chat members will have access to old messages;
 482	// available only to chat administrators. Returned only in getChat.
 483	//
 484	// optional
 485	HasVisibleHistory bool `json:"has_visible_history,omitempty"`
 486	// StickerSetName is for supergroups, name of group sticker set.Returned
 487	// only in getChat.
 488	//
 489	// optional
 490	StickerSetName string `json:"sticker_set_name,omitempty"`
 491	// CanSetStickerSet is true, if the bot can change the group sticker set.
 492	// Returned only in getChat.
 493	//
 494	// optional
 495	CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
 496	// CustomEmojiStickerSetName is for supergroups, the name of the group's
 497	// custom emoji sticker set. Custom emoji from this set can be used by all
 498	// users and bots in the group. Returned only in getChat.
 499	//
 500	// optional
 501	CustomEmojiStickerSetName string `json:"custom_emoji_sticker_set_name,omitempty"`
 502	// LinkedChatID is a unique identifier for the linked chat, i.e. the
 503	// discussion group identifier for a channel and vice versa; for supergroups
 504	// and channel chats.
 505	//
 506	// optional
 507	LinkedChatID int64 `json:"linked_chat_id,omitempty"`
 508	// Location is for supergroups, the location to which the supergroup is
 509	// connected. Returned only in getChat.
 510	//
 511	// optional
 512	Location *ChatLocation `json:"location,omitempty"`
 513}
 514
 515// IsPrivate returns if the Chat is a private conversation.
 516func (c Chat) IsPrivate() bool {
 517	return c.Type == "private"
 518}
 519
 520// IsGroup returns if the Chat is a group.
 521func (c Chat) IsGroup() bool {
 522	return c.Type == "group"
 523}
 524
 525// IsSuperGroup returns if the Chat is a supergroup.
 526func (c Chat) IsSuperGroup() bool {
 527	return c.Type == "supergroup"
 528}
 529
 530// IsChannel returns if the Chat is a channel.
 531func (c Chat) IsChannel() bool {
 532	return c.Type == "channel"
 533}
 534
 535// ChatConfig returns a ChatConfig struct for chat related methods.
 536func (c Chat) ChatConfig() ChatConfig {
 537	return ChatConfig{ChatID: c.ID}
 538}
 539
 540// InaccessibleMessage describes a message that was deleted or is otherwise inaccessible to the bot.
 541type InaccessibleMessage struct {
 542	// Chat the message belonged to
 543	Chat Chat `json:"chat"`
 544	// MessageID is unique message identifier inside the chat
 545	MessageID int `json:"message_id"`
 546	// Date is always 0. The field can be used to differentiate regular and inaccessible messages.
 547	Date int `json:"date"`
 548}
 549
 550// Message represents a message.
 551type Message struct {
 552	// MessageID is a unique message identifier inside this chat
 553	MessageID int `json:"message_id"`
 554	// Unique identifier of a message thread to which the message belongs;
 555	// for supergroups only
 556	//
 557	// optional
 558	MessageThreadID int `json:"message_thread_id,omitempty"`
 559	// From is a sender, empty for messages sent to channels;
 560	//
 561	// optional
 562	From *User `json:"from,omitempty"`
 563	// SenderChat is the sender of the message, sent on behalf of a chat. The
 564	// channel itself for channel messages. The supergroup itself for messages
 565	// from anonymous group administrators. The linked channel for messages
 566	// automatically forwarded to the discussion group
 567	//
 568	// optional
 569	SenderChat *Chat `json:"sender_chat,omitempty"`
 570	// SenderBoostCount is the number of boosts added by the user,
 571	// if the sender of the message boosted the chat
 572	//
 573	// optional
 574	SenderBoostCount int `json:"sender_boost_count,omitempty"`
 575	// SenderBusinessBot is the bot that actually sent the message on behalf of
 576	// the business account. Available only for outgoing messages sent on
 577	// behalf of the connected business account.
 578	//
 579	// optional
 580	SenderBusinessBot *User `json:"sender_business_bot,omitempty"`
 581	// Date of the message was sent in Unix time
 582	Date int `json:"date"`
 583	// BusinessConnectionID is an unique identifier of the business connection
 584	// from which the message was received. If non-empty, the message belongs to
 585	// a chat of the corresponding business account that is independent from
 586	// any potential bot chat which might share the same identifier.
 587	//
 588	// optional
 589	BusinessConnectionID string `json:"business_connection_id,omitempty"`
 590	// Chat is the conversation the message belongs to
 591	Chat Chat `json:"chat"`
 592	// ForwardOrigin is information about the original message for forwarded messages
 593	//
 594	// optional
 595	ForwardOrigin *MessageOrigin `json:"forward_origin,omitempty"`
 596	// IsTopicMessage true if the message is sent to a forum topic
 597	//
 598	// optional
 599	IsTopicMessage bool `json:"is_topic_message,omitempty"`
 600	// IsAutomaticForward is true if the message is a channel post that was
 601	// automatically forwarded to the connected discussion group.
 602	//
 603	// optional
 604	IsAutomaticForward bool `json:"is_automatic_forward,omitempty"`
 605	// ReplyToMessage for replies, the original message.
 606	// Note that the Message object in this field will not contain further ReplyToMessage fields
 607	// even if it itself is a reply;
 608	//
 609	// optional
 610	ReplyToMessage *Message `json:"reply_to_message,omitempty"`
 611	// ExternalReply is an information about the message that is being replied to,
 612	// which may come from another chat or forum topic.
 613	//
 614	// optional
 615	ExternalReply *ExternalReplyInfo `json:"external_reply,omitempty"`
 616	// Quote for replies that quote part of the original message, the quoted part of the message
 617	//
 618	// optional
 619	Quote *TextQuote `json:"text_quote,omitempty"`
 620	// ReplyToStory for replies to a story, the original story
 621	//
 622	// ReplyToStory
 623	ReplyToStory *Story `json:"reply_to_story"`
 624	// ViaBot through which the message was sent;
 625	//
 626	// optional
 627	ViaBot *User `json:"via_bot,omitempty"`
 628	// EditDate of the message was last edited in Unix time;
 629	//
 630	// optional
 631	EditDate int `json:"edit_date,omitempty"`
 632	// HasProtectedContent is true if the message can't be forwarded.
 633	//
 634	// optional
 635	HasProtectedContent bool `json:"has_protected_content,omitempty"`
 636	// IsFromOffline is True, if the message was sent by an implicit action,
 637	// for example, as an away or a greeting business message, or as a scheduled message
 638	//
 639	// optional
 640	IsFromOffline bool `json:"is_from_offline,omitempty"`
 641	// MediaGroupID is the unique identifier of a media message group this message belongs to;
 642	//
 643	// optional
 644	MediaGroupID string `json:"media_group_id,omitempty"`
 645	// AuthorSignature is the signature of the post author for messages in channels;
 646	//
 647	// optional
 648	AuthorSignature string `json:"author_signature,omitempty"`
 649	// Text is for text messages, the actual UTF-8 text of the message, 0-4096 characters;
 650	//
 651	// optional
 652	Text string `json:"text,omitempty"`
 653	// Entities are for text messages, special entities like usernames,
 654	// URLs, bot commands, etc. that appear in the text;
 655	//
 656	// optional
 657	Entities []MessageEntity `json:"entities,omitempty"`
 658	// LinkPreviewOptions are options used for link preview generation for the message,
 659	// if it is a text message and link preview options were changed
 660	//
 661	// Optional
 662	LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
 663	// EffectID is the unique identifier of the message effect added to the message
 664	//
 665	// optional
 666	EffectID string `json:"effect_id,omitempty"`
 667	// Animation message is an animation, information about the animation.
 668	// For backward compatibility, when this field is set, the document field will also be set;
 669	//
 670	// optional
 671	Animation *Animation `json:"animation,omitempty"`
 672	// PremiumAnimation message is an animation, information about the animation.
 673	// For backward compatibility, when this field is set, the document field will also be set;
 674	//
 675	// optional
 676	PremiumAnimation *Animation `json:"premium_animation,omitempty"`
 677	// Audio message is an audio file, information about the file;
 678	//
 679	// optional
 680	Audio *Audio `json:"audio,omitempty"`
 681	// Document message is a general file, information about the file;
 682	//
 683	// optional
 684	Document *Document `json:"document,omitempty"`
 685	// Message contains paid media; information about the paid media
 686	//
 687	// optional
 688	PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"`
 689	// Photo message is a photo, available sizes of the photo;
 690	//
 691	// optional
 692	Photo []PhotoSize `json:"photo,omitempty"`
 693	// Sticker message is a sticker, information about the sticker;
 694	//
 695	// optional
 696	Sticker *Sticker `json:"sticker,omitempty"`
 697	// Story message is a forwarded story;
 698	//
 699	// optional
 700	Story *Story `json:"story,omitempty"`
 701	// Video message is a video, information about the video;
 702	//
 703	// optional
 704	Video *Video `json:"video,omitempty"`
 705	// VideoNote message is a video note, information about the video message;
 706	//
 707	// optional
 708	VideoNote *VideoNote `json:"video_note,omitempty"`
 709	// Voice message is a voice message, information about the file;
 710	//
 711	// optional
 712	Voice *Voice `json:"voice,omitempty"`
 713	// Caption for the animation, audio, document, photo, video or voice, 0-1024 characters;
 714	//
 715	// optional
 716	Caption string `json:"caption,omitempty"`
 717	// CaptionEntities;
 718	//
 719	// optional
 720	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
 721	// ShowCaptionAboveMedia is True, if the caption must be shown above the message media
 722	//
 723	// optional
 724	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
 725	// HasSpoiler True, if the message media is covered by a spoiler animation
 726	//
 727	// optional
 728	HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`
 729	// Contact message is a shared contact, information about the contact;
 730	//
 731	// optional
 732	Contact *Contact `json:"contact,omitempty"`
 733	// Dice is a dice with random value;
 734	//
 735	// optional
 736	Dice *Dice `json:"dice,omitempty"`
 737	// Game message is a game, information about the game;
 738	//
 739	// optional
 740	Game *Game `json:"game,omitempty"`
 741	// Poll is a native poll, information about the poll;
 742	//
 743	// optional
 744	Poll *Poll `json:"poll,omitempty"`
 745	// Venue message is a venue, information about the venue.
 746	// For backward compatibility, when this field is set, the location field
 747	// will also be set;
 748	//
 749	// optional
 750	Venue *Venue `json:"venue,omitempty"`
 751	// Location message is a shared location, information about the location;
 752	//
 753	// optional
 754	Location *Location `json:"location,omitempty"`
 755	// NewChatMembers that were added to the group or supergroup
 756	// and information about them (the bot itself may be one of these members);
 757	//
 758	// optional
 759	NewChatMembers []User `json:"new_chat_members,omitempty"`
 760	// LeftChatMember is a member was removed from the group,
 761	// information about them (this member may be the bot itself);
 762	//
 763	// optional
 764	LeftChatMember *User `json:"left_chat_member,omitempty"`
 765	// NewChatTitle is a chat title was changed to this value;
 766	//
 767	// optional
 768	NewChatTitle string `json:"new_chat_title,omitempty"`
 769	// NewChatPhoto is a chat photo was change to this value;
 770	//
 771	// optional
 772	NewChatPhoto []PhotoSize `json:"new_chat_photo,omitempty"`
 773	// DeleteChatPhoto is a service message: the chat photo was deleted;
 774	//
 775	// optional
 776	DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"`
 777	// GroupChatCreated is a service message: the group has been created;
 778	//
 779	// optional
 780	GroupChatCreated bool `json:"group_chat_created,omitempty"`
 781	// SuperGroupChatCreated is a service message: the supergroup has been created.
 782	// This field can't be received in a message coming through updates,
 783	// because bot can't be a member of a supergroup when it is created.
 784	// It can only be found in ReplyToMessage if someone replies to a very first message
 785	// in a directly created supergroup;
 786	//
 787	// optional
 788	SuperGroupChatCreated bool `json:"supergroup_chat_created,omitempty"`
 789	// ChannelChatCreated is a service message: the channel has been created.
 790	// This field can't be received in a message coming through updates,
 791	// because bot can't be a member of a channel when it is created.
 792	// It can only be found in ReplyToMessage
 793	// if someone replies to a very first message in a channel;
 794	//
 795	// optional
 796	ChannelChatCreated bool `json:"channel_chat_created,omitempty"`
 797	// MessageAutoDeleteTimerChanged is a service message: auto-delete timer
 798	// settings changed in the chat.
 799	//
 800	// optional
 801	MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"`
 802	// MigrateToChatID is the group has been migrated to a supergroup with the specified identifier.
 803	// This number may be greater than 32 bits and some programming languages
 804	// may have difficulty/silent defects in interpreting it.
 805	// But it is smaller than 52 bits, so a signed 64-bit integer
 806	// or double-precision float type are safe for storing this identifier;
 807	//
 808	// optional
 809	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
 810	// MigrateFromChatID is the supergroup has been migrated from a group with the specified identifier.
 811	// This number may be greater than 32 bits and some programming languages
 812	// may have difficulty/silent defects in interpreting it.
 813	// But it is smaller than 52 bits, so a signed 64-bit integer
 814	// or double-precision float type are safe for storing this identifier;
 815	//
 816	// optional
 817	MigrateFromChatID int64 `json:"migrate_from_chat_id,omitempty"`
 818	// Specified message was pinned.
 819	// Note that the Message object in this field will not contain
 820	// further reply_to_message fields even if it itself is a reply.
 821	//
 822	// optional
 823	PinnedMessage *Message `json:"pinned_message,omitempty"`
 824	// Invoice message is an invoice for a payment;
 825	//
 826	// optional
 827	Invoice *Invoice `json:"invoice,omitempty"`
 828	// SuccessfulPayment message is a service message about a successful payment,
 829	// information about the payment;
 830	//
 831	// optional
 832	SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`
 833	// Message is a service message about a refunded payment, information about the payment
 834	//
 835	// optional
 836	RefundedPayment *RefundedPayment `json:"refunded_payment,omitempty"`
 837	// UsersShared is a service message: the users were shared with the bot
 838	//
 839	// optional
 840	UsersShared *UsersShared `json:"users_shared,omitempty"`
 841	// ChatShared is a service message: a chat was shared with the bot
 842	//
 843	// optional
 844	ChatShared *ChatShared `json:"chat_shared,omitempty"`
 845	// ConnectedWebsite is the domain name of the website on which the user has
 846	// logged in;
 847	//
 848	// optional
 849	ConnectedWebsite string `json:"connected_website,omitempty"`
 850	// WriteAccessAllowed is a service message: the user allowed the bot
 851	// added to the attachment menu to write messages
 852	//
 853	// optional
 854	WriteAccessAllowed *WriteAccessAllowed `json:"write_access_allowed,omitempty"`
 855	// PassportData is a Telegram Passport data;
 856	//
 857	// optional
 858	PassportData *PassportData `json:"passport_data,omitempty"`
 859	// ProximityAlertTriggered is a service message. A user in the chat
 860	// triggered another user's proximity alert while sharing Live Location
 861	//
 862	// optional
 863	ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"`
 864	// BoostAdded is a service message: user boosted the chat
 865	//
 866	// optional
 867	BoostAdded *ChatBoostAdded `json:"boost_added,omitempty"`
 868	// Service message: chat background set
 869	//
 870	// optional
 871	ChatBackgroundSet *ChatBackground `json:"chat_background_set,omitempty"`
 872	// ForumTopicCreated is a service message: forum topic created
 873	//
 874	// optional
 875	ForumTopicCreated *ForumTopicCreated `json:"forum_topic_created,omitempty"`
 876	// ForumTopicClosed is a service message: forum topic edited
 877	//
 878	// optional
 879	ForumTopicEdited *ForumTopicEdited `json:"forum_topic_edited,omitempty"`
 880	// ForumTopicClosed is a service message: forum topic closed
 881	//
 882	// optional
 883	ForumTopicClosed *ForumTopicClosed `json:"forum_topic_closed,omitempty"`
 884	// ForumTopicReopened is a service message: forum topic reopened
 885	//
 886	// optional
 887	ForumTopicReopened *ForumTopicReopened `json:"forum_topic_reopened,omitempty"`
 888	// GeneralForumTopicHidden is a service message: the 'General' forum topic hidden
 889	//
 890	// optional
 891	GeneralForumTopicHidden *GeneralForumTopicHidden `json:"general_forum_topic_hidden,omitempty"`
 892	// GeneralForumTopicUnhidden is a service message: the 'General' forum topic unhidden
 893	//
 894	// optional
 895	GeneralForumTopicUnhidden *GeneralForumTopicUnhidden `json:"general_forum_topic_unhidden,omitempty"`
 896	// GiveawayCreated is as service message: a scheduled giveaway was created
 897	//
 898	// optional
 899	GiveawayCreated *GiveawayCreated `json:"giveaway_created,omitempty"`
 900	// Giveaway is a scheduled giveaway message
 901	//
 902	// optional
 903	Giveaway *Giveaway `json:"giveaway,omitempty"`
 904	// GiveawayWinners is a giveaway with public winners was completed
 905	//
 906	// optional
 907	GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`
 908	// GiveawayCompleted is a service message: a giveaway without public winners was completed
 909	//
 910	// optional
 911	GiveawayCompleted *GiveawayCompleted `json:"giveaway_completed,omitempty"`
 912	// VideoChatScheduled is a service message: video chat scheduled.
 913	//
 914	// optional
 915	VideoChatScheduled *VideoChatScheduled `json:"video_chat_scheduled,omitempty"`
 916	// VideoChatStarted is a service message: video chat started.
 917	//
 918	// optional
 919	VideoChatStarted *VideoChatStarted `json:"video_chat_started,omitempty"`
 920	// VideoChatEnded is a service message: video chat ended.
 921	//
 922	// optional
 923	VideoChatEnded *VideoChatEnded `json:"video_chat_ended,omitempty"`
 924	// VideoChatParticipantsInvited is a service message: new participants
 925	// invited to a video chat.
 926	//
 927	// optional
 928	VideoChatParticipantsInvited *VideoChatParticipantsInvited `json:"video_chat_participants_invited,omitempty"`
 929	// WebAppData is a service message: data sent by a Web App.
 930	//
 931	// optional
 932	WebAppData *WebAppData `json:"web_app_data,omitempty"`
 933	// ReplyMarkup is the Inline keyboard attached to the message.
 934	// login_url buttons are represented as ordinary url buttons.
 935	//
 936	// optional
 937	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 938}
 939
 940// Time converts the message timestamp into a Time.
 941func (m *Message) Time() time.Time {
 942	return time.Unix(int64(m.Date), 0)
 943}
 944
 945// IsCommand returns true if message starts with a "bot_command" entity.
 946func (m *Message) IsCommand() bool {
 947	if m.Entities == nil || len(m.Entities) == 0 {
 948		return false
 949	}
 950
 951	entity := m.Entities[0]
 952	return entity.Offset == 0 && entity.IsCommand()
 953}
 954
 955// Command checks if the message was a command and if it was, returns the
 956// command. If the Message was not a command, it returns an empty string.
 957//
 958// If the command contains the at name syntax, it is removed. Use
 959// CommandWithAt() if you do not want that.
 960func (m *Message) Command() string {
 961	command := m.CommandWithAt()
 962
 963	if i := strings.Index(command, "@"); i != -1 {
 964		command = command[:i]
 965	}
 966
 967	return command
 968}
 969
 970// CommandWithAt checks if the message was a command and if it was, returns the
 971// command. If the Message was not a command, it returns an empty string.
 972//
 973// If the command contains the at name syntax, it is not removed. Use Command()
 974// if you want that.
 975func (m *Message) CommandWithAt() string {
 976	if !m.IsCommand() {
 977		return ""
 978	}
 979
 980	// IsCommand() checks that the message begins with a bot_command entity
 981	entity := m.Entities[0]
 982	return m.Text[1:entity.Length]
 983}
 984
 985// CommandArguments checks if the message was a command and if it was,
 986// returns all text after the command name. If the Message was not a
 987// command, it returns an empty string.
 988//
 989// Note: The first character after the command name is omitted:
 990// - "/foo bar baz" yields "bar baz", not " bar baz"
 991// - "/foo-bar baz" yields "bar baz", too
 992// Even though the latter is not a command conforming to the spec, the API
 993// marks "/foo" as command entity.
 994func (m *Message) CommandArguments() string {
 995	if !m.IsCommand() {
 996		return ""
 997	}
 998
 999	// IsCommand() checks that the message begins with a bot_command entity
1000	entity := m.Entities[0]
1001
1002	if len(m.Text) == entity.Length {
1003		return "" // The command makes up the whole message
1004	}
1005
1006	return m.Text[entity.Length+1:]
1007}
1008
1009// MessageID represents a unique message identifier.
1010type MessageID struct {
1011	MessageID int `json:"message_id"`
1012}
1013
1014// MessageEntity represents one special entity in a text message.
1015type MessageEntity struct {
1016	// Type of the entity.
1017	// Can be:
1018	//  “mention” (@username),
1019	//  “hashtag” (#hashtag),
1020	//  “cashtag” ($USD),
1021	//  “bot_command” (/start@jobs_bot),
1022	//  “url” (https://telegram.org),
1023	//  “email” (do-not-reply@telegram.org),
1024	//  “phone_number” (+1-212-555-0123),
1025	//  “bold” (bold text),
1026	//  “italic” (italic text),
1027	//  “underline” (underlined text),
1028	//  “strikethrough” (strikethrough text),
1029	//  "spoiler" (spoiler message),
1030	//  “blockquote” (block quotation),
1031	//  “expandable_blockquote” (collapsed-by-default block quotation),
1032	//  “code” (monowidth string),
1033	//  “pre” (monowidth block),
1034	//  “text_link” (for clickable text URLs),
1035	//  “text_mention” (for users without usernames)
1036	//  “text_mention” (for inline custom emoji stickers)
1037	Type string `json:"type"`
1038	// Offset in UTF-16 code units to the start of the entity
1039	Offset int `json:"offset"`
1040	// Length
1041	Length int `json:"length"`
1042	// URL for “text_link” only, url that will be opened after user taps on the text
1043	//
1044	// optional
1045	URL string `json:"url,omitempty"`
1046	// User for “text_mention” only, the mentioned user
1047	//
1048	// optional
1049	User *User `json:"user,omitempty"`
1050	// Language for “pre” only, the programming language of the entity text
1051	//
1052	// optional
1053	Language string `json:"language,omitempty"`
1054	// CustomEmojiID for “custom_emoji” only, unique identifier of the custom emoji
1055	//
1056	// optional
1057	CustomEmojiID string `json:"custom_emoji_id"`
1058}
1059
1060// ParseURL attempts to parse a URL contained within a MessageEntity.
1061func (e MessageEntity) ParseURL() (*url.URL, error) {
1062	if e.URL == "" {
1063		return nil, errors.New(ErrBadURL)
1064	}
1065
1066	return url.Parse(e.URL)
1067}
1068
1069// IsMention returns true if the type of the message entity is "mention" (@username).
1070func (e MessageEntity) IsMention() bool {
1071	return e.Type == "mention"
1072}
1073
1074// IsTextMention returns true if the type of the message entity is "text_mention"
1075// (At this time, the user field exists, and occurs when tagging a member without a username)
1076func (e MessageEntity) IsTextMention() bool {
1077	return e.Type == "text_mention"
1078}
1079
1080// IsHashtag returns true if the type of the message entity is "hashtag".
1081func (e MessageEntity) IsHashtag() bool {
1082	return e.Type == "hashtag"
1083}
1084
1085// IsCommand returns true if the type of the message entity is "bot_command".
1086func (e MessageEntity) IsCommand() bool {
1087	return e.Type == "bot_command"
1088}
1089
1090// IsURL returns true if the type of the message entity is "url".
1091func (e MessageEntity) IsURL() bool {
1092	return e.Type == "url"
1093}
1094
1095// IsEmail returns true if the type of the message entity is "email".
1096func (e MessageEntity) IsEmail() bool {
1097	return e.Type == "email"
1098}
1099
1100// IsBold returns true if the type of the message entity is "bold" (bold text).
1101func (e MessageEntity) IsBold() bool {
1102	return e.Type == "bold"
1103}
1104
1105// IsItalic returns true if the type of the message entity is "italic" (italic text).
1106func (e MessageEntity) IsItalic() bool {
1107	return e.Type == "italic"
1108}
1109
1110// IsCode returns true if the type of the message entity is "code" (monowidth string).
1111func (e MessageEntity) IsCode() bool {
1112	return e.Type == "code"
1113}
1114
1115// IsPre returns true if the type of the message entity is "pre" (monowidth block).
1116func (e MessageEntity) IsPre() bool {
1117	return e.Type == "pre"
1118}
1119
1120// IsTextLink returns true if the type of the message entity is "text_link" (clickable text URL).
1121func (e MessageEntity) IsTextLink() bool {
1122	return e.Type == "text_link"
1123}
1124
1125// TextQuote contains information about the quoted part of a message
1126// that is replied to by the given message
1127type TextQuote struct {
1128	// Text of the quoted part of a message that is replied to by the given message
1129	Text string `json:"text"`
1130	// Entities special entities that appear in the quote.
1131	// Currently, only bold, italic, underline, strikethrough, spoiler,
1132	// and custom_emoji entities are kept in quotes.
1133	//
1134	// optional
1135	Entities []MessageEntity `json:"entities,omitempty"`
1136	// Position is approximate quote position in the original message
1137	// in UTF-16 code units as specified by the sender
1138	Position int `json:"position"`
1139	// IsManual True, if the quote was chosen manually by the message sender.
1140	// Otherwise, the quote was added automatically by the server.
1141	//
1142	// optional
1143	IsManual bool `json:"is_manual,omitempty"`
1144}
1145
1146// ExternalReplyInfo contains information about a message that is being replied to,
1147// which may come from another chat or forum topic.
1148type ExternalReplyInfo struct {
1149	// Origin of the message replied to by the given message
1150	Origin MessageOrigin `json:"origin"`
1151	// Chat is the conversation the message belongs to
1152	Chat *Chat `json:"chat"`
1153	// MessageID is a unique message identifier inside this chat
1154	MessageID int `json:"message_id"`
1155	// LinkPreviewOptions used for link preview generation for the original message,
1156	// if it is a text message
1157	//
1158	// Optional
1159	LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
1160	// Animation message is an animation, information about the animation.
1161	// For backward compatibility, when this field is set, the document field will also be set;
1162	//
1163	// optional
1164	Animation *Animation `json:"animation,omitempty"`
1165	// Audio message is an audio file, information about the file;
1166	//
1167	// optional
1168	Audio *Audio `json:"audio,omitempty"`
1169	// Document message is a general file, information about the file;
1170	//
1171	// optional
1172	Document *Document `json:"document,omitempty"`
1173	// Message contains paid media; information about the paid media
1174	//
1175	// optional
1176	PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"`
1177	// Photo message is a photo, available sizes of the photo;
1178	//
1179	// optional
1180	Photo []PhotoSize `json:"photo,omitempty"`
1181	// Sticker message is a sticker, information about the sticker;
1182	//
1183	// optional
1184	Sticker *Sticker `json:"sticker,omitempty"`
1185	// Story message is a forwarded story;
1186	//
1187	// optional
1188	Story *Story `json:"story,omitempty"`
1189	// Video message is a video, information about the video;
1190	//
1191	// optional
1192	Video *Video `json:"video,omitempty"`
1193	// VideoNote message is a video note, information about the video message;
1194	//
1195	// optional
1196	VideoNote *VideoNote `json:"video_note,omitempty"`
1197	// Voice message is a voice message, information about the file;
1198	//
1199	// optional
1200	Voice *Voice `json:"voice,omitempty"`
1201	// HasMediaSpoiler True, if the message media is covered by a spoiler animation
1202	//
1203	// optional
1204	HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`
1205	// Contact message is a shared contact, information about the contact;
1206	//
1207	// optional
1208	Contact *Contact `json:"contact,omitempty"`
1209	// Dice is a dice with random value;
1210	//
1211	// optional
1212	Dice *Dice `json:"dice,omitempty"`
1213	// Game message is a game, information about the game;
1214	//
1215	// optional
1216	Game *Game `json:"game,omitempty"`
1217	// Giveaway is information about the giveaway
1218	//
1219	// optional
1220	Giveaway *Giveaway `json:"giveaway,omitempty"`
1221	// GiveawayWinners a giveaway with public winners was completed
1222	//
1223	// optional
1224	GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`
1225	// Invoice message is an invoice for a payment;
1226	//
1227	// optional
1228	Invoice *Invoice `json:"invoice,omitempty"`
1229	// Location message is a shared location, information about the location;
1230	//
1231	// optional
1232	Location *Location `json:"location,omitempty"`
1233	// Poll is a native poll, information about the poll;
1234	//
1235	// optional
1236	Poll *Poll `json:"poll,omitempty"`
1237	// Venue message is a venue, information about the venue.
1238	// For backward compatibility, when this field is set, the location field
1239	// will also be set;
1240	//
1241	// optional
1242	Venue *Venue `json:"venue,omitempty"`
1243}
1244
1245// ReplyParameters describes reply parameters for the message that is being sent.
1246type ReplyParameters struct {
1247	// MessageID identifier of the message that will be replied to in
1248	// the current chat, or in the chat chat_id if it is specified
1249	MessageID int `json:"message_id"`
1250	// ChatID if the message to be replied to is from a different chat,
1251	// unique identifier for the chat or username of the channel (in the format @channelusername)
1252	//
1253	// optional
1254	ChatID interface{} `json:"chat_id,omitempty"`
1255	// AllowSendingWithoutReply true if the message should be sent even
1256	// if the specified message to be replied to is not found;
1257	// can be used only for replies in the same chat and forum topic.
1258	//
1259	// optional
1260	AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"`
1261	// Quote is a quoted part of the message to be replied to;
1262	// 0-1024 characters after entities parsing. The quote must be
1263	// an exact substring of the message to be replied to,
1264	// including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities.
1265	// The message will fail to send if the quote isn't found in the original message.
1266	//
1267	// optional
1268	Quote string `json:"quote,omitempty"`
1269	// QuoteParseMode mode for parsing entities in the quote.
1270	//
1271	// optional
1272	QuoteParseMode string `json:"quote_parse_mode,omitempty"`
1273	// QuoteEntities a JSON-serialized list of special entities that appear in the quote.
1274	// It can be specified instead of quote_parse_mode.
1275	//
1276	// optional
1277	QuoteEntities []MessageEntity `json:"quote_entities,omitempty"`
1278	// QuotePosition is a position of the quote in the original message in UTF-16 code units
1279	//
1280	// optional
1281	QuotePosition int `json:"quote_position,omitempty"`
1282}
1283
1284const (
1285	MessageOriginUser       = "user"
1286	MessageOriginHiddenUser = "hidden_user"
1287	MessageOriginChat       = "chat"
1288	MessageOriginChannel    = "channel"
1289)
1290
1291// MessageOrigin describes the origin of a message. It can be one of: "user", "hidden_user", "origin_chat", "origin_channel"
1292type MessageOrigin struct {
1293	// Type of the message origin.
1294	Type string `json:"type"`
1295	// Date the message was sent originally in Unix time
1296	Date int64 `json:"date"`
1297	// SenderUser "user" only.
1298	// Is a user that sent the message originally
1299	SenderUser *User `json:"sender_user,omitempty"`
1300	// SenderUserName "hidden_user" only.
1301	// Name of the user that sent the message originally
1302	SenderUserName string `json:"sender_user_name,omitempty"`
1303	// SenderChat "chat" only.
1304	// Chat that sent the message originally
1305	SenderChat *Chat `json:"sender_chat,omitempty"`
1306	// Chat "channel" only.
1307	// Channel chat to which the message was originally sent
1308	Chat *Chat `json:"chat,omitempty"`
1309	// AuthorSignature "chat" and "channel".
1310	// For "chat": For messages originally sent by an anonymous chat administrator,
1311	// original message author signature.
1312	// For "channel": Signature of the original post author
1313	//
1314	// Optional
1315	AuthorSignature string `json:"author_signature,omitempty"`
1316	// MessageID "channel" only.
1317	// Unique message identifier inside the chat
1318	//
1319	// Optional
1320	MessageID int `json:"message_id,omitempty"`
1321}
1322
1323func (m MessageOrigin) IsUser() bool {
1324	return m.Type == MessageOriginUser
1325}
1326
1327func (m MessageOrigin) IsHiddenUser() bool {
1328	return m.Type == MessageOriginHiddenUser
1329}
1330
1331func (m MessageOrigin) IsChat() bool {
1332	return m.Type == MessageOriginChat
1333}
1334
1335func (m MessageOrigin) IsChannel() bool {
1336	return m.Type == MessageOriginChannel
1337}
1338
1339// PhotoSize represents one size of a photo or a file / sticker thumbnail.
1340type PhotoSize struct {
1341	// FileID identifier for this file, which can be used to download or reuse
1342	// the file
1343	FileID string `json:"file_id"`
1344	// FileUniqueID is the unique identifier for this file, which is supposed to
1345	// be the same over time and for different bots. Can't be used to download
1346	// or reuse the file.
1347	FileUniqueID string `json:"file_unique_id"`
1348	// Width photo width
1349	Width int `json:"width"`
1350	// Height photo height
1351	Height int `json:"height"`
1352	// FileSize file size
1353	//
1354	// optional
1355	FileSize int `json:"file_size,omitempty"`
1356}
1357
1358// Animation represents an animation file.
1359type Animation struct {
1360	// FileID is the identifier for this file, which can be used to download or reuse
1361	// the file
1362	FileID string `json:"file_id"`
1363	// FileUniqueID is the unique identifier for this file, which is supposed to
1364	// be the same over time and for different bots. Can't be used to download
1365	// or reuse the file.
1366	FileUniqueID string `json:"file_unique_id"`
1367	// Width video width as defined by sender
1368	Width int `json:"width"`
1369	// Height video height as defined by sender
1370	Height int `json:"height"`
1371	// Duration of the video in seconds as defined by sender
1372	Duration int `json:"duration"`
1373	// Thumbnail animation thumbnail as defined by sender
1374	//
1375	// optional
1376	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
1377	// FileName original animation filename as defined by sender
1378	//
1379	// optional
1380	FileName string `json:"file_name,omitempty"`
1381	// MimeType of the file as defined by sender
1382	//
1383	// optional
1384	MimeType string `json:"mime_type,omitempty"`
1385	// FileSize file size
1386	//
1387	// optional
1388	FileSize int64 `json:"file_size,omitempty"`
1389}
1390
1391// Audio represents an audio file to be treated as music by the Telegram clients.
1392type Audio struct {
1393	// FileID is an identifier for this file, which can be used to download or
1394	// reuse the file
1395	FileID string `json:"file_id"`
1396	// FileUniqueID is the unique identifier for this file, which is supposed to
1397	// be the same over time and for different bots. Can't be used to download
1398	// or reuse the file.
1399	FileUniqueID string `json:"file_unique_id"`
1400	// Duration of the audio in seconds as defined by sender
1401	Duration int `json:"duration"`
1402	// Performer of the audio as defined by sender or by audio tags
1403	//
1404	// optional
1405	Performer string `json:"performer,omitempty"`
1406	// Title of the audio as defined by sender or by audio tags
1407	//
1408	// optional
1409	Title string `json:"title,omitempty"`
1410	// FileName is the original filename as defined by sender
1411	//
1412	// optional
1413	FileName string `json:"file_name,omitempty"`
1414	// MimeType of the file as defined by sender
1415	//
1416	// optional
1417	MimeType string `json:"mime_type,omitempty"`
1418	// FileSize file size
1419	//
1420	// optional
1421	FileSize int64 `json:"file_size,omitempty"`
1422	// Thumbnail is the album cover to which the music file belongs
1423	//
1424	// optional
1425	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
1426}
1427
1428// Document represents a general file.
1429type Document struct {
1430	// FileID is an identifier for this file, which can be used to download or
1431	// reuse the file
1432	FileID string `json:"file_id"`
1433	// FileUniqueID is the unique identifier for this file, which is supposed to
1434	// be the same over time and for different bots. Can't be used to download
1435	// or reuse the file.
1436	FileUniqueID string `json:"file_unique_id"`
1437	// Thumbnail document thumbnail as defined by sender
1438	//
1439	// optional
1440	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
1441	// FileName original filename as defined by sender
1442	//
1443	// optional
1444	FileName string `json:"file_name,omitempty"`
1445	// MimeType  of the file as defined by sender
1446	//
1447	// optional
1448	MimeType string `json:"mime_type,omitempty"`
1449	// FileSize file size
1450	//
1451	// optional
1452	FileSize int64 `json:"file_size,omitempty"`
1453}
1454
1455// Story represents a message about a forwarded story in the chat.
1456type Story struct {
1457	// Chat that posted the story
1458	Chat Chat `json:"chat"`
1459	// ID is an unique identifier for the story in the chat
1460	ID int `json:"id"`
1461}
1462
1463// Video represents a video file.
1464type Video struct {
1465	// FileID identifier for this file, which can be used to download or reuse
1466	// the file
1467	FileID string `json:"file_id"`
1468	// FileUniqueID is the unique identifier for this file, which is supposed to
1469	// be the same over time and for different bots. Can't be used to download
1470	// or reuse the file.
1471	FileUniqueID string `json:"file_unique_id"`
1472	// Width video width as defined by sender
1473	Width int `json:"width"`
1474	// Height video height as defined by sender
1475	Height int `json:"height"`
1476	// Duration of the video in seconds as defined by sender
1477	Duration int `json:"duration"`
1478	// Thumbnail video thumbnail
1479	//
1480	// optional
1481	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
1482	// FileName is the original filename as defined by sender
1483	//
1484	// optional
1485	FileName string `json:"file_name,omitempty"`
1486	// MimeType of a file as defined by sender
1487	//
1488	// optional
1489	MimeType string `json:"mime_type,omitempty"`
1490	// FileSize file size
1491	//
1492	// optional
1493	FileSize int64 `json:"file_size,omitempty"`
1494}
1495
1496// VideoNote object represents a video message.
1497type VideoNote struct {
1498	// FileID identifier for this file, which can be used to download or reuse the file
1499	FileID string `json:"file_id"`
1500	// FileUniqueID is the unique identifier for this file, which is supposed to
1501	// be the same over time and for different bots. Can't be used to download
1502	// or reuse the file.
1503	FileUniqueID string `json:"file_unique_id"`
1504	// Length video width and height (diameter of the video message) as defined by sender
1505	Length int `json:"length"`
1506	// Duration of the video in seconds as defined by sender
1507	Duration int `json:"duration"`
1508	// Thumbnail video thumbnail
1509	//
1510	// optional
1511	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
1512	// FileSize file size
1513	//
1514	// optional
1515	FileSize int `json:"file_size,omitempty"`
1516}
1517
1518// Voice represents a voice note.
1519type Voice struct {
1520	// FileID identifier for this file, which can be used to download or reuse the file
1521	FileID string `json:"file_id"`
1522	// FileUniqueID is the unique identifier for this file, which is supposed to
1523	// be the same over time and for different bots. Can't be used to download
1524	// or reuse the file.
1525	FileUniqueID string `json:"file_unique_id"`
1526	// Duration of the audio in seconds as defined by sender
1527	Duration int `json:"duration"`
1528	// MimeType of the file as defined by sender
1529	//
1530	// optional
1531	MimeType string `json:"mime_type,omitempty"`
1532	// FileSize file size
1533	//
1534	// optional
1535	FileSize int64 `json:"file_size,omitempty"`
1536}
1537
1538// PaidMediaInfo describes the paid media added to a message.
1539type PaidMediaInfo struct {
1540	// The number of Telegram Stars that must be paid to buy access to the media
1541	StarCount int64 `json:"star_count"`
1542	// Information about the paid media
1543	PaidMedia []PaidMedia `json:"paid_media"`
1544}
1545
1546// This object describes paid media. Currently, it can be one of
1547//   - PaidMediaPreview
1548//   - PaidMediaPhoto
1549//   - PaidMediaVideo
1550type PaidMedia struct {
1551	// Type of the paid media, should be one of:
1552	//   - "photo"
1553	//   - "video"
1554	//   - "preview"
1555	Type string `json:"type"`
1556	// PaidMediaPreview only.
1557	// Media width as defined by the sender.
1558	//
1559	// optional
1560	Width int64 `json:"width,omitempty"`
1561	// PaidMediaPreview only.
1562	// Media height as defined by the sender
1563	//
1564	// optional
1565	Height int64 `json:"height,omitempty"`
1566	// PaidMediaPreview only.
1567	// Duration of the media in seconds as defined by the sender
1568	//
1569	// optional
1570	Duration int64 `json:"duration,omitempty"`
1571	// PaidMediaPhoto only.
1572	// The photo
1573	Photo []PhotoSize `json:"photo,omitempty"`
1574	// PaidMediaVideo only.
1575	// The video
1576	Video *Video `json:"video,omitempty"`
1577}
1578
1579// Contact represents a phone contact.
1580//
1581// Note that LastName and UserID may be empty.
1582type Contact struct {
1583	// PhoneNumber contact's phone number
1584	PhoneNumber string `json:"phone_number"`
1585	// FirstName contact's first name
1586	FirstName string `json:"first_name"`
1587	// LastName contact's last name
1588	//
1589	// optional
1590	LastName string `json:"last_name,omitempty"`
1591	// UserID contact's user identifier in Telegram
1592	//
1593	// optional
1594	UserID int64 `json:"user_id,omitempty"`
1595	// VCard is additional data about the contact in the form of a vCard.
1596	//
1597	// optional
1598	VCard string `json:"vcard,omitempty"`
1599}
1600
1601// Dice represents an animated emoji that displays a random value.
1602type Dice struct {
1603	// Emoji on which the dice throw animation is based
1604	Emoji string `json:"emoji"`
1605	// Value of the dice
1606	Value int `json:"value"`
1607}
1608
1609// PollOption contains information about one answer option in a poll.
1610type PollOption struct {
1611	// Text is the option text, 1-100 characters
1612	Text string `json:"text"`
1613	// Special entities that appear in the option text.
1614	// Currently, only custom emoji entities are allowed in poll option texts
1615	//
1616	// optional
1617	TextEntities []MessageEntity `json:"text_entities,omitempty"`
1618	// VoterCount is the number of users that voted for this option
1619	VoterCount int `json:"voter_count"`
1620}
1621
1622// InputPollOption contains information about one answer option in a poll to send.
1623type InputPollOption struct {
1624	// Option text, 1-100 characters
1625	Text string `json:"text"`
1626	// Mode for parsing entities in the text. See formatting options for more details.
1627	// Currently, only custom emoji entities are allowed
1628	//
1629	// optional
1630	TextParseMode string `json:"text_parse_mode,omitempty"`
1631	// A JSON-serialized list of special entities that appear in the poll option text.
1632	// It can be specified instead of text_parse_mode
1633	//
1634	// optional
1635	TextEntities []MessageEntity `json:"text_entities,omitempty"`
1636}
1637
1638// PollAnswer represents an answer of a user in a non-anonymous poll.
1639type PollAnswer struct {
1640	// PollID is the unique poll identifier
1641	PollID string `json:"poll_id"`
1642	// Chat that changed the answer to the poll, if the voter is anonymous.
1643	//
1644	// Optional
1645	VoterChat *Chat `json:"voter_chat,omitempty"`
1646	// User who changed the answer to the poll, if the voter isn't anonymous
1647	// For backward compatibility, the field user in such objects
1648	// will contain the user 136817688 (@Channel_Bot).
1649	//
1650	// Optional
1651	User *User `json:"user,omitempty"`
1652	// OptionIDs is the 0-based identifiers of poll options chosen by the user.
1653	// May be empty if user retracted vote.
1654	OptionIDs []int `json:"option_ids"`
1655}
1656
1657// Poll contains information about a poll.
1658type Poll struct {
1659	// ID is the unique poll identifier
1660	ID string `json:"id"`
1661	// Question is the poll question, 1-255 characters
1662	Question string `json:"question"`
1663	// Special entities that appear in the question.
1664	// Currently, only custom emoji entities are allowed in poll questions
1665	//
1666	// optional
1667	QuestionEntities []MessageEntity `json:"question_entities,omitempty"`
1668	// Options is the list of poll options
1669	Options []PollOption `json:"options"`
1670	// TotalVoterCount is the total numbers of users who voted in the poll
1671	TotalVoterCount int `json:"total_voter_count"`
1672	// IsClosed is if the poll is closed
1673	IsClosed bool `json:"is_closed"`
1674	// IsAnonymous is if the poll is anonymous
1675	IsAnonymous bool `json:"is_anonymous"`
1676	// Type is the poll type, currently can be "regular" or "quiz"
1677	Type string `json:"type"`
1678	// AllowsMultipleAnswers is true, if the poll allows multiple answers
1679	AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
1680	// CorrectOptionID is the 0-based identifier of the correct answer option.
1681	// Available only for polls in quiz mode, which are closed, or was sent (not
1682	// forwarded) by the bot or to the private chat with the bot.
1683	//
1684	// optional
1685	CorrectOptionID int `json:"correct_option_id,omitempty"`
1686	// Explanation is text that is shown when a user chooses an incorrect answer
1687	// or taps on the lamp icon in a quiz-style poll, 0-200 characters
1688	//
1689	// optional
1690	Explanation string `json:"explanation,omitempty"`
1691	// ExplanationEntities are special entities like usernames, URLs, bot
1692	// commands, etc. that appear in the explanation
1693	//
1694	// optional
1695	ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`
1696	// OpenPeriod is the amount of time in seconds the poll will be active
1697	// after creation
1698	//
1699	// optional
1700	OpenPeriod int `json:"open_period,omitempty"`
1701	// CloseDate is the point in time (unix timestamp) when the poll will be
1702	// automatically closed
1703	//
1704	// optional
1705	CloseDate int `json:"close_date,omitempty"`
1706}
1707
1708// Location represents a point on the map.
1709type Location struct {
1710	// Longitude as defined by sender
1711	Longitude float64 `json:"longitude"`
1712	// Latitude as defined by sender
1713	Latitude float64 `json:"latitude"`
1714	// HorizontalAccuracy is the radius of uncertainty for the location,
1715	// measured in meters; 0-1500
1716	//
1717	// optional
1718	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
1719	// LivePeriod is time relative to the message sending date, during which the
1720	// location can be updated, in seconds. For active live locations only.
1721	// Use 0x7FFFFFFF (2147483647 - max positive Int) to edit indefinitely
1722	//
1723	// optional
1724	LivePeriod int `json:"live_period,omitempty"`
1725	// Heading is the direction in which user is moving, in degrees; 1-360. For
1726	// active live locations only.
1727	//
1728	// optional
1729	Heading int `json:"heading,omitempty"`
1730	// ProximityAlertRadius is the maximum distance for proximity alerts about
1731	// approaching another chat member, in meters. For sent live locations only.
1732	//
1733	// optional
1734	ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
1735}
1736
1737// Venue represents a venue.
1738type Venue struct {
1739	// Location is the venue location
1740	Location Location `json:"location"`
1741	// Title is the name of the venue
1742	Title string `json:"title"`
1743	// Address of the venue
1744	Address string `json:"address"`
1745	// FoursquareID is the foursquare identifier of the venue
1746	//
1747	// optional
1748	FoursquareID string `json:"foursquare_id,omitempty"`
1749	// FoursquareType is the foursquare type of the venue
1750	//
1751	// optional
1752	FoursquareType string `json:"foursquare_type,omitempty"`
1753	// GooglePlaceID is the Google Places identifier of the venue
1754	//
1755	// optional
1756	GooglePlaceID string `json:"google_place_id,omitempty"`
1757	// GooglePlaceType is the Google Places type of the venue
1758	//
1759	// optional
1760	GooglePlaceType string `json:"google_place_type,omitempty"`
1761}
1762
1763// WebAppData Contains data sent from a Web App to the bot.
1764type WebAppData struct {
1765	// Data is the data. Be aware that a bad client can send arbitrary data in this field.
1766	Data string `json:"data"`
1767	// ButtonText is the text of the web_app keyboard button, from which the Web App
1768	// was opened. Be aware that a bad client can send arbitrary data in this field.
1769	ButtonText string `json:"button_text"`
1770}
1771
1772// ProximityAlertTriggered represents a service message sent when a user in the
1773// chat triggers a proximity alert sent by another user.
1774type ProximityAlertTriggered struct {
1775	// Traveler is the user that triggered the alert
1776	Traveler User `json:"traveler"`
1777	// Watcher is the user that set the alert
1778	Watcher User `json:"watcher"`
1779	// Distance is the distance between the users
1780	Distance int `json:"distance"`
1781}
1782
1783// MessageAutoDeleteTimerChanged represents a service message about a change in
1784// auto-delete timer settings.
1785type MessageAutoDeleteTimerChanged struct {
1786	// New auto-delete time for messages in the chat.
1787	MessageAutoDeleteTime int `json:"message_auto_delete_time"`
1788}
1789
1790// ChatBoostAdded represents a service message about a user boosting a chat.
1791type ChatBoostAdded struct {
1792	// BoostCount is a number of boosts added by the user
1793	BoostCount int `json:"boost_count"`
1794}
1795
1796// BackgroundFill describes the way a background is filled based on the selected colors.
1797// Currently, it can be one of:
1798//   - BackgroundFillSolid
1799//   - BackgroundFillGradient
1800//   - BackgroundFillFreeformGradient
1801type BackgroundFill struct {
1802	// Type of the background fill, can be:
1803	//  - solid
1804	//  - gradient
1805	//  - freeform_gradient
1806	Type string `json:"type"`
1807	// BackgroundFillSolid only.
1808	// The color of the background fill in the RGB24 format
1809	Color int `json:"color"`
1810	// BackgroundFillGradient only.
1811	// Top color of the gradient in the RGB24 format
1812	TopColor int `json:"top_color"`
1813	// BackgroundFillGradient only.
1814	// Bottom color of the gradient in the RGB24 format
1815	BottomColor int `json:"bottom_color"`
1816	// BackgroundFillGradient only.
1817	// Clockwise rotation angle of the background fill in degrees; 0-359
1818	RotationAngle int `json:"rotation_angle"`
1819	// BackgroundFillFreeformGradient only.
1820	// A list of the 3 or 4 base colors that are used to generate the freeform gradient in the RGB24 format
1821	Colors []int `json:"colors"`
1822}
1823
1824// BackgroundType describes the type of a background. Currently, it can be one of:
1825//   - BackgroundTypeFill
1826//   - BackgroundTypeWallpaper
1827//   - BackgroundTypePattern
1828//   - BackgroundTypeChatTheme
1829type BackgroundType struct {
1830	// Type of the background.
1831	// Currently, it can be one of:
1832	//  - fill
1833	//  - wallpaper
1834	//  - pattern
1835	//  - chat_theme
1836	Type string `json:"type"`
1837	// BackgroundTypeFill and BackgroundTypePattern only.
1838	// The background fill or fill that is combined with the pattern
1839	Fill BackgroundFill `json:"fill"`
1840	// BackgroundTypeFill and BackgroundTypeWallpaper only.
1841	// Dimming of the background in dark themes, as a percentage; 0-100
1842	DarkThemeDimming int `json:"dark_theme_dimming"`
1843	// BackgroundTypeWallpaper and BackgroundTypePattern only.
1844	// Document with the wallpaper / pattern
1845	Document Document `json:"document"`
1846	// BackgroundTypeWallpaper only.
1847	// True, if the wallpaper is downscaled to fit in a 450x450 square and then box-blurred with radius 12
1848	//
1849	// optional
1850	IsBlurred bool `json:"is_blurred,omitempty"`
1851	// BackgroundTypeWallpaper and BackgroundTypePattern only.
1852	// True, if the background moves slightly when the device is tilted
1853	//
1854	// optional
1855	IsMoving bool `json:"is_moving,omitempty"`
1856	// BackgroundTypePattern only.
1857	// Intensity of the pattern when it is shown above the filled background; 0-100
1858	Intensity int `json:"intensity"`
1859	// BackgroundTypePattern only.
1860	// True, if the background fill must be applied only to the pattern itself.
1861	// All other pixels are black in this case. For dark themes only
1862	//
1863	// optional
1864	IsInverted bool `json:"is_inverted,omitempty"`
1865	// BackgroundTypeChatTheme only.
1866	// Name of the chat theme, which is usually an emoji
1867	ThemeName string `json:"theme_name"`
1868}
1869
1870// ChatBackground represents a chat background.
1871type ChatBackground struct {
1872	// Type of the background
1873	Type BackgroundType `json:"type"`
1874}
1875
1876// ForumTopicCreated represents a service message about a new forum topic
1877// created in the chat.
1878type ForumTopicCreated struct {
1879	// Name is the name of topic
1880	Name string `json:"name"`
1881	// IconColor is the color of the topic icon in RGB format
1882	IconColor int `json:"icon_color"`
1883	// IconCustomEmojiID is the unique identifier of the custom emoji
1884	// shown as the topic icon
1885	//
1886	// optional
1887	IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
1888}
1889
1890// ForumTopicClosed represents a service message about a forum topic
1891// closed in the chat. Currently holds no information.
1892type ForumTopicClosed struct {
1893}
1894
1895// ForumTopicEdited object represents a service message about an edited forum topic.
1896type ForumTopicEdited struct {
1897	// Name is the new name of the topic, if it was edited
1898	//
1899	// optional
1900	Name string `json:"name,omitempty"`
1901	// IconCustomEmojiID is the new identifier of the custom emoji
1902	// shown as the topic icon, if it was edited;
1903	// an empty string if the icon was removed
1904	//
1905	// optional
1906	IconCustomEmojiID *string `json:"icon_custom_emoji_id,omitempty"`
1907}
1908
1909// ForumTopicReopened represents a service message about a forum topic
1910// reopened in the chat. Currently holds no information.
1911type ForumTopicReopened struct {
1912}
1913
1914// GeneralForumTopicHidden represents a service message about General forum topic
1915// hidden in the chat. Currently holds no information.
1916type GeneralForumTopicHidden struct {
1917}
1918
1919// GeneralForumTopicUnhidden represents a service message about General forum topic
1920// unhidden in the chat. Currently holds no information.
1921type GeneralForumTopicUnhidden struct {
1922}
1923
1924// SharedUser contains information about a user that was
1925// shared with the bot using a KeyboardButtonRequestUsers button.
1926type SharedUser struct {
1927	// UserID is the identifier of the shared user.
1928	UserID int64 `json:"user_id"`
1929	// FirstName of the user, if the name was requested by the bot.
1930	//
1931	// optional
1932	FirstName *string `json:"first_name,omitempty"`
1933	// LastName of the user, if the name was requested by the bot.
1934	//
1935	// optional
1936	LastName *string `json:"last_name,omitempty"`
1937	// Username of the user, if the username was requested by the bot.
1938	//
1939	// optional
1940	UserName *string `json:"username,omitempty"`
1941	// Photo is array of available sizes of the chat photo,
1942	// if the photo was requested by the bot
1943	//
1944	// optional
1945	Photo []PhotoSize `json:"photo,omitempty"`
1946}
1947
1948// UsersShared object contains information about the user whose identifier
1949// was shared with the bot using a KeyboardButtonRequestUser button.
1950type UsersShared struct {
1951	// RequestID is an indentifier of the request.
1952	RequestID int `json:"request_id"`
1953	// Users shared with the bot.
1954	Users []SharedUser `json:"users"`
1955}
1956
1957// ChatShared contains information about the chat whose identifier
1958// was shared with the bot using a KeyboardButtonRequestChat button.
1959type ChatShared struct {
1960	// RequestID is an indentifier of the request.
1961	RequestID int `json:"request_id"`
1962	// ChatID is an identifier of the shared chat.
1963	ChatID int64 `json:"chat_id"`
1964	// Title of the chat, if the title was requested by the bot.
1965	//
1966	// optional
1967	Title *string `json:"title,omitempty"`
1968	// UserName of the chat, if the username was requested by
1969	// the bot and available.
1970	//
1971	// optional
1972	UserName *string `json:"username,omitempty"`
1973	// Photo is array of available sizes of the chat photo,
1974	// if the photo was requested by the bot
1975	//
1976	// optional
1977	Photo []PhotoSize `json:"photo,omitempty"`
1978}
1979
1980// WriteAccessAllowed represents a service message about a user allowing a bot
1981// to write messages after adding the bot to the attachment menu or launching
1982// a Web App from a link.
1983type WriteAccessAllowed struct {
1984	// FromRequest is true, if the access was granted after
1985	// the user accepted an explicit request from a Web App
1986	// sent by the method requestWriteAccess.
1987	//
1988	// Optional
1989	FromRequest bool `json:"from_request,omitempty"`
1990	// Name of the Web App which was launched from a link
1991	//
1992	// Optional
1993	WebAppName string `json:"web_app_name,omitempty"`
1994	// FromAttachmentMenu is true, if the access was granted when
1995	// the bot was added to the attachment or side menu
1996	//
1997	// Optional
1998	FromAttachmentMenu bool `json:"from_attachment_menu,omitempty"`
1999}
2000
2001// VideoChatScheduled represents a service message about a voice chat scheduled
2002// in the chat.
2003type VideoChatScheduled struct {
2004	// Point in time (Unix timestamp) when the voice chat is supposed to be
2005	// started by a chat administrator
2006	StartDate int `json:"start_date"`
2007}
2008
2009// Time converts the scheduled start date into a Time.
2010func (m *VideoChatScheduled) Time() time.Time {
2011	return time.Unix(int64(m.StartDate), 0)
2012}
2013
2014// VideoChatStarted represents a service message about a voice chat started in
2015// the chat.
2016type VideoChatStarted struct{}
2017
2018// VideoChatEnded represents a service message about a voice chat ended in the
2019// chat.
2020type VideoChatEnded struct {
2021	// Voice chat duration; in seconds.
2022	Duration int `json:"duration"`
2023}
2024
2025// VideoChatParticipantsInvited represents a service message about new members
2026// invited to a voice chat.
2027type VideoChatParticipantsInvited struct {
2028	// New members that were invited to the voice chat.
2029	//
2030	// optional
2031	Users []User `json:"users,omitempty"`
2032}
2033
2034// This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.
2035type GiveawayCreated struct{}
2036
2037// Giveaway represents a message about a scheduled giveaway.
2038type Giveaway struct {
2039	// Chats is the list of chats which the user must join to participate in the giveaway
2040	Chats []Chat `json:"chats"`
2041	// WinnersSelectionDate is point in time (Unix timestamp) when
2042	// winners of the giveaway will be selected
2043	WinnersSelectionDate int64 `json:"winners_selection_date"`
2044	// WinnerCount is the number of users which are supposed
2045	// to be selected as winners of the giveaway
2046	WinnerCount int `json:"winner_count"`
2047	// OnlyNewMembers True, if only users who join the chats after
2048	// the giveaway started should be eligible to win
2049	//
2050	// optional
2051	OnlyNewMembers bool `json:"only_new_members,omitempty"`
2052	// HasPublicWinners True, if the list of giveaway winners will be visible to everyone
2053	//
2054	// optional
2055	HasPublicWinners bool `json:"has_public_winners,omitempty"`
2056	// PrizeDescription is description of additional giveaway prize
2057	//
2058	// optional
2059	PrizeDescription string `json:"prize_description,omitempty"`
2060	// CountryCodes is a list of two-letter ISO 3166-1 alpha-2 country codes
2061	// indicating the countries from which eligible users for the giveaway must come.
2062	// If empty, then all users can participate in the giveaway.
2063	//
2064	// optional
2065	CountryCodes []string `json:"country_codes,omitempty"`
2066	// PremiumSubscriptionMonthCount the number of months the Telegram Premium
2067	// subscription won from the giveaway will be active for
2068	//
2069	// optional
2070	PremiumSubscriptionMonthCount int `json:"premium_subscription_month_count,omitempty"`
2071}
2072
2073// Giveaway represents a message about a scheduled giveaway.
2074type GiveawayWinners struct {
2075	// Chat that created the giveaway
2076	Chat Chat `json:"chat"`
2077	// GiveawayMessageID is the identifier of the messsage with the giveaway in the chat
2078	GiveawayMessageID int `json:"giveaway_message_id"`
2079	// WinnersSelectionDate is point in time (Unix timestamp) when
2080	// winners of the giveaway will be selected
2081	WinnersSelectionDate int64 `json:"winners_selection_date"`
2082	// WinnerCount is the number of users which are supposed
2083	// to be selected as winners of the giveaway
2084	WinnerCount int `json:"winner_count"`
2085	// Winners is a list of up to 100 winners of the giveaway
2086	Winners []User `json:"winners"`
2087	// AdditionalChatCount is the number of other chats
2088	// the user had to join in order to be eligible for the giveaway
2089	//
2090	// optional
2091	AdditionalChatCount int `json:"additional_chat_count,omitempty"`
2092	// PremiumSubscriptionMonthCount the number of months the Telegram Premium
2093	// subscription won from the giveaway will be active for
2094	//
2095	// optional
2096	PremiumSubscriptionMonthCount int `json:"premium_subscription_month_count,omitempty"`
2097	// UnclaimedPrizeCount is the number of undistributed prizes
2098	//
2099	// optional
2100	UnclaimedPrizeCount int `json:"unclaimed_prize_count,omitempty"`
2101	// OnlyNewMembers True, if only users who join the chats after
2102	// the giveaway started should be eligible to win
2103	//
2104	// optional
2105	OnlyNewMembers bool `json:"only_new_members,omitempty"`
2106	// WasRefunded True, if the giveaway was canceled because the payment for it was refunded
2107	//
2108	// optional
2109	WasRefunded bool `json:"was_refunded,omitempty"`
2110	// PrizeDescription is description of additional giveaway prize
2111	//
2112	// optional
2113	PrizeDescription string `json:"prize_description,omitempty"`
2114}
2115
2116// This object represents a service message about the completion of a giveaway without public winners.
2117type GiveawayCompleted struct {
2118	// Number of winners in the giveaway
2119	WinnerCount int `json:"winner_count"`
2120	// Number of undistributed prizes
2121	//
2122	// optional
2123	UnclaimedPrizeCount int `json:"unclaimed_prize_count,omitempty"`
2124	// Message with the giveaway that was completed, if it wasn't deleted
2125	//
2126	// optional
2127	GiveawayMessage *Message `json:"giveaway_message,omitempty"`
2128}
2129
2130// LinkPreviewOptions describes the options used for link preview generation.
2131type LinkPreviewOptions struct {
2132	// IsDisabled True, if the link preview is disabled
2133	//
2134	// optional
2135	IsDisabled bool `json:"is_disabled,omitempty"`
2136	// URL to use for the link preview. If empty,
2137	// then the first URL found in the message text will be used
2138	//
2139	// optional
2140	URL string `json:"url,omitempty"`
2141	// PreferSmallMedia True, if the media in the link preview is suppposed
2142	//  to be shrunk; ignored if the URL isn't explicitly specified
2143	// or media size change isn't supported for the preview
2144	//
2145	// optional
2146	PreferSmallMedia bool `json:"prefer_small_media,omitempty"`
2147	// PreferLargeMedia True, if the media in the link preview is suppposed
2148	// to be enlarged; ignored if the URL isn't explicitly specified
2149	// or media size change isn't supported for the preview
2150	//
2151	// optional
2152	PreferLargeMedia bool `json:"prefer_large_media,omitempty"`
2153	// ShowAboveText True, if the link preview must be shown above the message text;
2154	// otherwise, the link preview will be shown below the message text
2155	//
2156	// optional
2157	ShowAboveText bool `json:"show_above_text,omitempty"`
2158}
2159
2160// UserProfilePhotos contains a set of user profile photos.
2161type UserProfilePhotos struct {
2162	// TotalCount total number of profile pictures the target user has
2163	TotalCount int `json:"total_count"`
2164	// Photos requested profile pictures (in up to 4 sizes each)
2165	Photos [][]PhotoSize `json:"photos"`
2166}
2167
2168// File contains information about a file to download from Telegram.
2169type File struct {
2170	// FileID identifier for this file, which can be used to download or reuse
2171	// the file
2172	FileID string `json:"file_id"`
2173	// FileUniqueID is the unique identifier for this file, which is supposed to
2174	// be the same over time and for different bots. Can't be used to download
2175	// or reuse the file.
2176	FileUniqueID string `json:"file_unique_id"`
2177	// FileSize file size, if known
2178	//
2179	// optional
2180	FileSize int64 `json:"file_size,omitempty"`
2181	// FilePath file path
2182	//
2183	// optional
2184	FilePath string `json:"file_path,omitempty"`
2185}
2186
2187// Link returns a full path to the download URL for a File.
2188//
2189// It requires the Bot token to create the link.
2190func (f *File) Link(token string) string {
2191	return fmt.Sprintf(FileEndpoint, token, f.FilePath)
2192}
2193
2194// WebAppInfo contains information about a Web App.
2195type WebAppInfo struct {
2196	// URL is the HTTPS URL of a Web App to be opened with additional data as
2197	// specified in Initializing Web Apps.
2198	URL string `json:"url"`
2199}
2200
2201// ReplyKeyboardMarkup represents a custom keyboard with reply options.
2202type ReplyKeyboardMarkup struct {
2203	// Keyboard is an array of button rows, each represented by an Array of KeyboardButton objects
2204	Keyboard [][]KeyboardButton `json:"keyboard"`
2205	// IsPersistent requests clients to always show the keyboard
2206	// when the regular keyboard is hidden.
2207	// Defaults to false, in which case the custom keyboard can be hidden
2208	// and opened with a keyboard icon.
2209	//
2210	// optional
2211	IsPersistent bool `json:"is_persistent"`
2212	// ResizeKeyboard requests clients to resize the keyboard vertically for optimal fit
2213	// (e.g., make the keyboard smaller if there are just two rows of buttons).
2214	// Defaults to false, in which case the custom keyboard
2215	// is always of the same height as the app's standard keyboard.
2216	//
2217	// optional
2218	ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
2219	// OneTimeKeyboard requests clients to hide the keyboard as soon as it's been used.
2220	// The keyboard will still be available, but clients will automatically display
2221	// the usual letter-keyboard in the chat – the user can press a special button
2222	// in the input field to see the custom keyboard again.
2223	// Defaults to false.
2224	//
2225	// optional
2226	OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
2227	// InputFieldPlaceholder is the placeholder to be shown in the input field when
2228	// the keyboard is active; 1-64 characters.
2229	//
2230	// optional
2231	InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
2232	// Selective use this parameter if you want to show the keyboard to specific users only.
2233	// Targets:
2234	//  1) users that are @mentioned in the text of the Message object;
2235	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
2236	//
2237	// Example: A user requests to change the bot's language,
2238	// bot replies to the request with a keyboard to select the new language.
2239	// Other users in the group don't see the keyboard.
2240	//
2241	// optional
2242	Selective bool `json:"selective,omitempty"`
2243}
2244
2245// KeyboardButton represents one button of the reply keyboard. For simple text
2246// buttons String can be used instead of this object to specify text of the
2247// button. Optional fields request_contact, request_location, and request_poll
2248// are mutually exclusive.
2249type KeyboardButton struct {
2250	// Text of the button. If none of the optional fields are used,
2251	// it will be sent as a message when the button is pressed.
2252	Text string `json:"text"`
2253	// RequestUsers if specified, pressing the button will open
2254	// a list of suitable users. Tapping on any user will send
2255	// their identifier to the bot in a "user_shared" service message.
2256	// Available in private chats only.
2257	//
2258	// optional
2259	RequestUsers *KeyboardButtonRequestUsers `json:"request_users,omitempty"`
2260	// RequestChat if specified, pressing the button will open
2261	// a list of suitable chats. Tapping on a chat will send
2262	// its identifier to the bot in a "chat_shared" service message.
2263	// Available in private chats only.
2264	//
2265	// optional
2266	RequestChat *KeyboardButtonRequestChat `json:"request_chat,omitempty"`
2267	// RequestContact if True, the user's phone number will be sent
2268	// as a contact when the button is pressed.
2269	// Available in private chats only.
2270	//
2271	// optional
2272	RequestContact bool `json:"request_contact,omitempty"`
2273	// RequestLocation if True, the user's current location will be sent when
2274	// the button is pressed.
2275	// Available in private chats only.
2276	//
2277	// optional
2278	RequestLocation bool `json:"request_location,omitempty"`
2279	// RequestPoll if specified, the user will be asked to create a poll and send it
2280	// to the bot when the button is pressed. Available in private chats only
2281	//
2282	// optional
2283	RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
2284	// WebApp if specified, the described Web App will be launched when the button
2285	// is pressed. The Web App will be able to send a “web_app_data” service
2286	// message. Available in private chats only.
2287	//
2288	// optional
2289	WebApp *WebAppInfo `json:"web_app,omitempty"`
2290}
2291
2292// KeyboardButtonRequestUsers defines the criteria used to request
2293// a suitable user. The identifier of the selected user will be shared
2294// with the bot when the corresponding button is pressed.
2295type KeyboardButtonRequestUsers struct {
2296	// RequestID is a signed 32-bit identifier of the request.
2297	RequestID int `json:"request_id"`
2298	// UserIsBot pass True to request a bot,
2299	// pass False to request a regular user.
2300	// If not specified, no additional restrictions are applied.
2301	//
2302	// optional
2303	UserIsBot *bool `json:"user_is_bot,omitempty"`
2304	// UserIsPremium pass True to request a premium user,
2305	// pass False to request a non-premium user.
2306	// If not specified, no additional restrictions are applied.
2307	//
2308	// optional
2309	UserIsPremium *bool `json:"user_is_premium,omitempty"`
2310	// MaxQuantity is the maximum number of users to be selected.
2311	// 1-10. Defaults to 1
2312	//
2313	// optional
2314	MaxQuantity int `json:"max_quantity,omitempty"`
2315	// RequestName pass True to request the users' first and last names
2316	//
2317	// optional
2318	RequestName bool `json:"request_name,omitempty"`
2319	// RequestUsername pass True to request the users' usernames
2320	//
2321	// optional
2322	RequestUsername bool `json:"request_username,omitempty"`
2323	// RequestPhoto pass True to request the users' photos
2324	//
2325	// optional
2326	RequestPhoto bool `json:"request_photo,omitempty"`
2327}
2328
2329// KeyboardButtonRequestChat defines the criteria used to request
2330// a suitable chat. The identifier of the selected chat will be shared
2331// with the bot when the corresponding button is pressed.
2332type KeyboardButtonRequestChat struct {
2333	// RequestID is a signed 32-bit identifier of the request.
2334	RequestID int `json:"request_id"`
2335	// ChatIsChannel pass True to request a channel chat,
2336	// pass False to request a group or a supergroup chat.
2337	ChatIsChannel bool `json:"chat_is_channel"`
2338	// ChatIsForum pass True to request a forum supergroup,
2339	// pass False to request a non-forum chat.
2340	// If not specified, no additional restrictions are applied.
2341	//
2342	// optional
2343	ChatIsForum bool `json:"chat_is_forum,omitempty"`
2344	// ChatHasUsername pass True to request a supergroup or a channel with a username,
2345	// pass False to request a chat without a username.
2346	// If not specified, no additional restrictions are applied.
2347	//
2348	// optional
2349	ChatHasUsername bool `json:"chat_has_username,omitempty"`
2350	// ChatIsCreated pass True to request a chat owned by the user.
2351	// Otherwise, no additional restrictions are applied.
2352	//
2353	// optional
2354	ChatIsCreated bool `json:"chat_is_created,omitempty"`
2355	// UserAdministratorRights is a JSON-serialized object listing
2356	// the required administrator rights of the user in the chat.
2357	// If not specified, no additional restrictions are applied.
2358	//
2359	// optional
2360	UserAdministratorRights *ChatAdministratorRights `json:"user_administrator_rights,omitempty"`
2361	// BotAdministratorRights is a JSON-serialized object listing
2362	// the required administrator rights of the bot in the chat.
2363	// The rights must be a subset of user_administrator_rights.
2364	// If not specified, no additional restrictions are applied.
2365	//
2366	// optional
2367	BotAdministratorRights *ChatAdministratorRights `json:"bot_administrator_rights,omitempty"`
2368	// BotIsMember pass True to request a chat with the bot as a member.
2369	// Otherwise, no additional restrictions are applied.
2370	//
2371	// optional
2372	BotIsMember bool `json:"bot_is_member,omitempty"`
2373	// RequestTitle pass True to request the chat's title
2374	//
2375	// optional
2376	RequestTitle bool `json:"request_title,omitempty"`
2377	// RequestUsername pass True to request the chat's username
2378	//
2379	// optional
2380	RequestUsername bool `json:"request_username,omitempty"`
2381	// RequestPhoto pass True to request the chat's photo
2382	//
2383	// optional
2384	RequestPhoto bool `json:"request_photo,omitempty"`
2385}
2386
2387// KeyboardButtonPollType represents type of poll, which is allowed to
2388// be created and sent when the corresponding button is pressed.
2389type KeyboardButtonPollType struct {
2390	// Type is if quiz is passed, the user will be allowed to create only polls
2391	// in the quiz mode. If regular is passed, only regular polls will be
2392	// allowed. Otherwise, the user will be allowed to create a poll of any type.
2393	Type string `json:"type"`
2394}
2395
2396// ReplyKeyboardRemove Upon receiving a message with this object, Telegram
2397// clients will remove the current custom keyboard and display the default
2398// letter-keyboard. By default, custom keyboards are displayed until a new
2399// keyboard is sent by a bot. An exception is made for one-time keyboards
2400// that are hidden immediately after the user presses a button.
2401type ReplyKeyboardRemove struct {
2402	// RemoveKeyboard requests clients to remove the custom keyboard
2403	// (user will not be able to summon this keyboard;
2404	// if you want to hide the keyboard from sight but keep it accessible,
2405	// use one_time_keyboard in ReplyKeyboardMarkup).
2406	RemoveKeyboard bool `json:"remove_keyboard"`
2407	// Selective use this parameter if you want to remove the keyboard for specific users only.
2408	// Targets:
2409	//  1) users that are @mentioned in the text of the Message object;
2410	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
2411	//
2412	// Example: A user votes in a poll, bot returns confirmation message
2413	// in reply to the vote and removes the keyboard for that user,
2414	// while still showing the keyboard with poll options to users who haven't voted yet.
2415	//
2416	// optional
2417	Selective bool `json:"selective,omitempty"`
2418}
2419
2420// InlineKeyboardMarkup represents an inline keyboard that appears right next to
2421// the message it belongs to.
2422type InlineKeyboardMarkup struct {
2423	// InlineKeyboard array of button rows, each represented by an Array of
2424	// InlineKeyboardButton objects
2425	InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
2426}
2427
2428// InlineKeyboardButton represents one button of an inline keyboard. You must
2429// use exactly one of the optional fields.
2430//
2431// Note that some values are references as even an empty string
2432// will change behavior.
2433//
2434// CallbackGame, if set, MUST be first button in first row.
2435type InlineKeyboardButton struct {
2436	// Text label text on the button
2437	Text string `json:"text"`
2438	// URL HTTP or tg:// url to be opened when button is pressed.
2439	// Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username,
2440	// if this is allowed by their privacy settings.
2441	//
2442	// optional
2443	URL *string `json:"url,omitempty"`
2444	// LoginURL is an HTTP URL used to automatically authorize the user. Can be
2445	// used as a replacement for the Telegram Login Widget
2446	//
2447	// optional
2448	LoginURL *LoginURL `json:"login_url,omitempty"`
2449	// CallbackData data to be sent in a callback query to the bot when button is pressed, 1-64 bytes.
2450	//
2451	// optional
2452	CallbackData *string `json:"callback_data,omitempty"`
2453	// WebApp is the Description of the Web App that will be launched when the user presses the button.
2454	// The Web App will be able to send an arbitrary message on behalf of the user using the method
2455	// answerWebAppQuery. Available only in private chats between a user and the bot.
2456	// Not supported for messages sent on behalf of a Telegram Business account.
2457	//
2458	// optional
2459	WebApp *WebAppInfo `json:"web_app,omitempty"`
2460	// SwitchInlineQuery if set, pressing the button will prompt the user to select one of their chats,
2461	// open that chat and insert the bot's username and the specified inline query in the input field.
2462	// Can be empty, in which case just the bot's username will be inserted.
2463	//
2464	// This offers an easy way for users to start using your bot
2465	// in inline mode when they are currently in a private chat with it.
2466	// Especially useful when combined with switch_pm… actions – in this case
2467	// the user will be automatically returned to the chat they switched from,
2468	// skipping the chat selection screen.
2469	// Not supported for messages sent on behalf of a Telegram Business account.
2470	//
2471	// optional
2472	SwitchInlineQuery *string `json:"switch_inline_query,omitempty"`
2473	// SwitchInlineQueryCurrentChat if set, pressing the button will insert the bot's username
2474	// and the specified inline query in the current chat's input field.
2475	// Can be empty, in which case only the bot's username will be inserted.
2476	//
2477	// This offers a quick way for the user to open your bot in inline mode
2478	// in the same chat – good for selecting something from multiple options.
2479	// Not supported for messages sent on behalf of a Telegram Business account.
2480	//
2481	// optional
2482	SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"`
2483	//SwitchInlineQueryChosenChat If set, pressing the button will prompt the user to
2484	//select one of their chats of the specified type, open that chat and insert the bot's
2485	//username and the specified inline query in the input field.
2486	// Not supported for messages sent on behalf of a Telegram Business account.
2487	//
2488	//optional
2489	SwitchInlineQueryChosenChat *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`
2490	// CallbackGame description of the game that will be launched when the user presses the button.
2491	//
2492	// optional
2493	CallbackGame *CallbackGame `json:"callback_game,omitempty"`
2494	// Pay specify True, to send a Pay button.
2495	// Substrings “⭐” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.
2496	//
2497	// NOTE: This type of button must always be the first button in the first row.
2498	//
2499	// optional
2500	Pay bool `json:"pay,omitempty"`
2501}
2502
2503// LoginURL represents a parameter of the inline keyboard button used to
2504// automatically authorize a user. Serves as a great replacement for the
2505// Telegram Login Widget when the user is coming from Telegram. All the user
2506// needs to do is tap/click a button and confirm that they want to log in.
2507type LoginURL struct {
2508	// URL is an HTTP URL to be opened with user authorization data added to the
2509	// query string when the button is pressed. If the user refuses to provide
2510	// authorization data, the original URL without information about the user
2511	// will be opened. The data added is the same as described in Receiving
2512	// authorization data.
2513	//
2514	// NOTE: You must always check the hash of the received data to verify the
2515	// authentication and the integrity of the data as described in Checking
2516	// authorization.
2517	URL string `json:"url"`
2518	// ForwardText is the new text of the button in forwarded messages
2519	//
2520	// optional
2521	ForwardText string `json:"forward_text,omitempty"`
2522	// BotUsername is the username of a bot, which will be used for user
2523	// authorization. See Setting up a bot for more details. If not specified,
2524	// the current bot's username will be assumed. The url's domain must be the
2525	// same as the domain linked with the bot. See Linking your domain to the
2526	// bot for more details.
2527	//
2528	// optional
2529	BotUsername string `json:"bot_username,omitempty"`
2530	// RequestWriteAccess if true requests permission for your bot to send
2531	// messages to the user
2532	//
2533	// optional
2534	RequestWriteAccess bool `json:"request_write_access,omitempty"`
2535}
2536
2537// CallbackQuery represents an incoming callback query from a callback button in
2538// an inline keyboard. If the button that originated the query was attached to a
2539// message sent by the bot, the field message will be present. If the button was
2540// attached to a message sent via the bot (in inline mode), the field
2541// inline_message_id will be present. Exactly one of the fields data or
2542// game_short_name will be present.
2543type CallbackQuery struct {
2544	// ID unique identifier for this query
2545	ID string `json:"id"`
2546	// From sender
2547	From *User `json:"from"`
2548	// Message sent by the bot with the callback button that originated the query
2549	//
2550	// optional
2551	Message *Message `json:"message,omitempty"`
2552	// InlineMessageID identifier of the message sent via the bot in inline
2553	// mode, that originated the query.
2554	//
2555	// optional
2556	InlineMessageID string `json:"inline_message_id,omitempty"`
2557	// ChatInstance global identifier, uniquely corresponding to the chat to
2558	// which the message with the callback button was sent. Useful for high
2559	// scores in games.
2560	ChatInstance string `json:"chat_instance"`
2561	// Data associated with the callback button. Be aware that
2562	// a bad client can send arbitrary data in this field.
2563	//
2564	// optional
2565	Data string `json:"data,omitempty"`
2566	// GameShortName short name of a Game to be returned, serves as the unique identifier for the game.
2567	//
2568	// optional
2569	GameShortName string `json:"game_short_name,omitempty"`
2570}
2571
2572// IsInaccessibleMessage method that shows whether message is inaccessible
2573func (c CallbackQuery) IsInaccessibleMessage() bool {
2574	return c.Message != nil && c.Message.Date == 0
2575}
2576
2577func (c CallbackQuery) GetInaccessibleMessage() InaccessibleMessage {
2578	if c.Message == nil {
2579		return InaccessibleMessage{}
2580	}
2581	return InaccessibleMessage{
2582		Chat:      c.Message.Chat,
2583		MessageID: c.Message.MessageID,
2584	}
2585}
2586
2587// ForceReply when receiving a message with this object, Telegram clients will
2588// display a reply interface to the user (act as if the user has selected the
2589// bot's message and tapped 'Reply'). This can be extremely useful if you  want
2590// to create user-friendly step-by-step interfaces without having to sacrifice
2591// privacy mode.
2592type ForceReply struct {
2593	// ForceReply shows reply interface to the user,
2594	// as if they manually selected the bot's message and tapped 'Reply'.
2595	ForceReply bool `json:"force_reply"`
2596	// InputFieldPlaceholder is the placeholder to be shown in the input field when
2597	// the reply is active; 1-64 characters.
2598	//
2599	// optional
2600	InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
2601	// Selective use this parameter if you want to force reply from specific users only.
2602	// Targets:
2603	//  1) users that are @mentioned in the text of the Message object;
2604	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
2605	//
2606	// optional
2607	Selective bool `json:"selective,omitempty"`
2608}
2609
2610// ChatPhoto represents a chat photo.
2611type ChatPhoto struct {
2612	// SmallFileID is a file identifier of small (160x160) chat photo.
2613	// This file_id can be used only for photo download and
2614	// only for as long as the photo is not changed.
2615	SmallFileID string `json:"small_file_id"`
2616	// SmallFileUniqueID is a unique file identifier of small (160x160) chat
2617	// photo, which is supposed to be the same over time and for different bots.
2618	// Can't be used to download or reuse the file.
2619	SmallFileUniqueID string `json:"small_file_unique_id"`
2620	// BigFileID is a file identifier of big (640x640) chat photo.
2621	// This file_id can be used only for photo download and
2622	// only for as long as the photo is not changed.
2623	BigFileID string `json:"big_file_id"`
2624	// BigFileUniqueID is a file identifier of big (640x640) chat photo, which
2625	// is supposed to be the same over time and for different bots. Can't be
2626	// used to download or reuse the file.
2627	BigFileUniqueID string `json:"big_file_unique_id"`
2628}
2629
2630// ChatInviteLink represents an invite link for a chat.
2631type ChatInviteLink struct {
2632	// InviteLink is the invite link. If the link was created by another chat
2633	// administrator, then the second part of the link will be replaced with “…”.
2634	InviteLink string `json:"invite_link"`
2635	// Creator of the link.
2636	Creator User `json:"creator"`
2637	// CreatesJoinRequest is true if users joining the chat via the link need to
2638	// be approved by chat administrators.
2639	//
2640	// optional
2641	CreatesJoinRequest bool `json:"creates_join_request,omitempty"`
2642	// IsPrimary is true, if the link is primary.
2643	IsPrimary bool `json:"is_primary"`
2644	// IsRevoked is true, if the link is revoked.
2645	IsRevoked bool `json:"is_revoked"`
2646	// Name is the name of the invite link.
2647	//
2648	// optional
2649	Name string `json:"name,omitempty"`
2650	// ExpireDate is the point in time (Unix timestamp) when the link will
2651	// expire or has been expired.
2652	//
2653	// optional
2654	ExpireDate int `json:"expire_date,omitempty"`
2655	// MemberLimit is the maximum number of users that can be members of the
2656	// chat simultaneously after joining the chat via this invite link; 1-99999.
2657	//
2658	// optional
2659	MemberLimit int `json:"member_limit,omitempty"`
2660	// PendingJoinRequestCount is the number of pending join requests created
2661	// using this link.
2662	//
2663	// optional
2664	PendingJoinRequestCount int `json:"pending_join_request_count,omitempty"`
2665}
2666
2667type ChatAdministratorRights struct {
2668	IsAnonymous         bool `json:"is_anonymous"`
2669	CanManageChat       bool `json:"can_manage_chat"`
2670	CanDeleteMessages   bool `json:"can_delete_messages"`
2671	CanManageVideoChats bool `json:"can_manage_video_chats"`
2672	CanRestrictMembers  bool `json:"can_restrict_members"`
2673	CanPromoteMembers   bool `json:"can_promote_members"`
2674	CanChangeInfo       bool `json:"can_change_info"`
2675	CanInviteUsers      bool `json:"can_invite_users"`
2676	CanPostMessages     bool `json:"can_post_messages"`
2677	CanEditMessages     bool `json:"can_edit_messages"`
2678	CanPinMessages      bool `json:"can_pin_messages"`
2679	CanPostStories      bool `json:"can_post_stories"`
2680	CanEditStories      bool `json:"can_edit_stories"`
2681	CanDeleteStories    bool `json:"can_delete_stories"`
2682	CanManageTopics     bool `json:"can_manage_topics"`
2683}
2684
2685// ChatMember contains information about one member of a chat.
2686type ChatMember struct {
2687	// User information about the user
2688	User *User `json:"user"`
2689	// Status the member's status in the chat.
2690	// Can be
2691	//  “creator”,
2692	//  “administrator”,
2693	//  “member”,
2694	//  “restricted”,
2695	//  “left” or
2696	//  “kicked”
2697	Status string `json:"status"`
2698	// CustomTitle owner and administrators only. Custom title for this user
2699	//
2700	// optional
2701	CustomTitle string `json:"custom_title,omitempty"`
2702	// IsAnonymous owner and administrators only. True, if the user's presence
2703	// in the chat is hidden
2704	//
2705	// optional
2706	IsAnonymous bool `json:"is_anonymous,omitempty"`
2707	// UntilDate restricted and kicked only.
2708	// Date when restrictions will be lifted for this user;
2709	// unix time.
2710	//
2711	// optional
2712	UntilDate int64 `json:"until_date,omitempty"`
2713	// CanBeEdited administrators only.
2714	// True, if the bot is allowed to edit administrator privileges of that user.
2715	//
2716	// optional
2717	CanBeEdited bool `json:"can_be_edited,omitempty"`
2718	// CanManageChat administrators only.
2719	// True, if the administrator can access the chat event log, chat
2720	// statistics, message statistics in channels, see channel members, see
2721	// anonymous administrators in supergroups and ignore slow mode. Implied by
2722	// any other administrator privilege.
2723	//
2724	// optional
2725	CanManageChat bool `json:"can_manage_chat,omitempty"`
2726	// CanPostMessages administrators only.
2727	// True, if the administrator can post in the channel;
2728	// channels only.
2729	//
2730	// optional
2731	CanPostMessages bool `json:"can_post_messages,omitempty"`
2732	// CanEditMessages administrators only.
2733	// True, if the administrator can edit messages of other users and can pin messages;
2734	// channels only.
2735	//
2736	// optional
2737	CanEditMessages bool `json:"can_edit_messages,omitempty"`
2738	// CanDeleteMessages administrators only.
2739	// True, if the administrator can delete messages of other users.
2740	//
2741	// optional
2742	CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
2743	// CanManageVideoChats administrators only.
2744	// True, if the administrator can manage video chats.
2745	//
2746	// optional
2747	CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"`
2748	// CanRestrictMembers administrators only.
2749	// True, if the administrator can restrict, ban or unban chat members.
2750	//
2751	// optional
2752	CanRestrictMembers bool `json:"can_restrict_members,omitempty"`
2753	// CanPromoteMembers administrators only.
2754	// True, if the administrator can add new administrators
2755	// with a subset of their own privileges or demote administrators that he has promoted,
2756	// directly or indirectly (promoted by administrators that were appointed by the user).
2757	//
2758	// optional
2759	CanPromoteMembers bool `json:"can_promote_members,omitempty"`
2760	// CanChangeInfo administrators and restricted only.
2761	// True, if the user is allowed to change the chat title, photo and other settings.
2762	//
2763	// optional
2764	CanChangeInfo bool `json:"can_change_info,omitempty"`
2765	// CanInviteUsers administrators and restricted only.
2766	// True, if the user is allowed to invite new users to the chat.
2767	//
2768	// optional
2769	CanInviteUsers bool `json:"can_invite_users,omitempty"`
2770	// CanPinMessages administrators and restricted only.
2771	// True, if the user is allowed to pin messages; groups and supergroups only
2772	//
2773	// optional
2774	CanPinMessages bool `json:"can_pin_messages,omitempty"`
2775	// CanPostStories administrators only.
2776	// True, if the administrator can post stories in the channel; channels only
2777	//
2778	// optional
2779	CanPostStories bool `json:"can_post_stories,omitempty"`
2780	// CanEditStories administrators only.
2781	// True, if the administrator can edit stories posted by other users; channels only
2782	//
2783	// optional
2784	CanEditStories bool `json:"can_edit_stories,omitempty"`
2785	// CanDeleteStories administrators only.
2786	// True, if the administrator can delete stories posted by other users; channels only
2787	//
2788	// optional
2789	CanDeleteStories bool `json:"can_delete_stories,omitempty"`
2790	// CanManageTopics administrators and restricted only.
2791	// True, if the user is allowed to create, rename,
2792	// close, and reopen forum topics; supergroups only
2793	//
2794	// optional
2795	CanManageTopics bool `json:"can_manage_topics,omitempty"`
2796	// IsMember is true, if the user is a member of the chat at the moment of
2797	// the request
2798	IsMember bool `json:"is_member"`
2799	// CanSendMessages
2800	//
2801	// optional
2802	CanSendMessages bool `json:"can_send_messages,omitempty"`
2803	// CanSendAudios restricted only.
2804	// True, if the user is allowed to send audios
2805	//
2806	// optional
2807	CanSendAudios bool `json:"can_send_audios,omitempty"`
2808	// CanSendDocuments restricted only.
2809	// True, if the user is allowed to send documents
2810	//
2811	// optional
2812	CanSendDocuments bool `json:"can_send_documents,omitempty"`
2813	// CanSendPhotos is restricted only.
2814	// True, if the user is allowed to send photos
2815	//
2816	// optional
2817	CanSendPhotos bool `json:"can_send_photos,omitempty"`
2818	// CanSendVideos restricted only.
2819	// True, if the user is allowed to send videos
2820	//
2821	// optional
2822	CanSendVideos bool `json:"can_send_videos,omitempty"`
2823	// CanSendVideoNotes restricted only.
2824	// True, if the user is allowed to send video notes
2825	//
2826	// optional
2827	CanSendVideoNotes bool `json:"can_send_video_notes,omitempty"`
2828	// CanSendVoiceNotes restricted only.
2829	// True, if the user is allowed to send voice notes
2830	//
2831	// optional
2832	CanSendVoiceNotes bool `json:"can_send_voice_notes,omitempty"`
2833	// CanSendPolls restricted only.
2834	// True, if the user is allowed to send polls
2835	//
2836	// optional
2837	CanSendPolls bool `json:"can_send_polls,omitempty"`
2838	// CanSendOtherMessages restricted only.
2839	// True, if the user is allowed to send audios, documents,
2840	// photos, videos, video notes and voice notes.
2841	//
2842	// optional
2843	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
2844	// CanAddWebPagePreviews restricted only.
2845	// True, if the user is allowed to add web page previews to their messages.
2846	//
2847	// optional
2848	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
2849}
2850
2851// IsCreator returns if the ChatMember was the creator of the chat.
2852func (chat ChatMember) IsCreator() bool { return chat.Status == "creator" }
2853
2854// IsAdministrator returns if the ChatMember is a chat administrator.
2855func (chat ChatMember) IsAdministrator() bool { return chat.Status == "administrator" }
2856
2857// HasLeft returns if the ChatMember left the chat.
2858func (chat ChatMember) HasLeft() bool { return chat.Status == "left" }
2859
2860// WasKicked returns if the ChatMember was kicked from the chat.
2861func (chat ChatMember) WasKicked() bool { return chat.Status == "kicked" }
2862
2863// SetCanSendMediaMessages is a method to replace field "can_send_media_messages".
2864// It sets CanSendAudio, CanSendDocuments, CanSendPhotos, CanSendVideos,
2865// CanSendVideoNotes, CanSendVoiceNotes to passed value.
2866func (chat *ChatMember) SetCanSendMediaMessages(b bool) {
2867	chat.CanSendAudios = b
2868	chat.CanSendDocuments = b
2869	chat.CanSendPhotos = b
2870	chat.CanSendVideos = b
2871	chat.CanSendVideoNotes = b
2872	chat.CanSendVoiceNotes = b
2873}
2874
2875// CanSendMediaMessages method to replace field "can_send_media_messages".
2876// It returns true if CanSendAudio and CanSendDocuments and CanSendPhotos and CanSendVideos and
2877// CanSendVideoNotes and CanSendVoiceNotes are true.
2878func (chat *ChatMember) CanSendMediaMessages() bool {
2879	return chat.CanSendAudios && chat.CanSendDocuments &&
2880		chat.CanSendPhotos && chat.CanSendVideos &&
2881		chat.CanSendVideoNotes && chat.CanSendVoiceNotes
2882}
2883
2884// ChatMemberUpdated represents changes in the status of a chat member.
2885type ChatMemberUpdated struct {
2886	// Chat the user belongs to.
2887	Chat Chat `json:"chat"`
2888	// From is the performer of the action, which resulted in the change.
2889	From User `json:"from"`
2890	// Date the change was done in Unix time.
2891	Date int `json:"date"`
2892	// Previous information about the chat member.
2893	OldChatMember ChatMember `json:"old_chat_member"`
2894	// New information about the chat member.
2895	NewChatMember ChatMember `json:"new_chat_member"`
2896	// InviteLink is the link which was used by the user to join the chat;
2897	// for joining by invite link events only.
2898	//
2899	// optional
2900	InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
2901	// ViaJoinRequest is true, if the user joined the chat
2902	// after sending a direct join request
2903	// and being approved by an administrator
2904	//
2905	// optional
2906	ViaJoinRequest bool `json:"via_join_request,omitempty"`
2907	// ViaChatFolderInviteLink is True, if the user joined the chat
2908	// via a chat folder invite link
2909	//
2910	// optional
2911	ViaChatFolderInviteLink bool `json:"via_chat_folder_invite_link,omitempty"`
2912}
2913
2914// ChatJoinRequest represents a join request sent to a chat.
2915type ChatJoinRequest struct {
2916	// Chat to which the request was sent.
2917	Chat Chat `json:"chat"`
2918	// User that sent the join request.
2919	From User `json:"from"`
2920	// UserChatID identifier of a private chat with the user who sent the join request.
2921	UserChatID int64 `json:"user_chat_id"`
2922	// Date the request was sent in Unix time.
2923	Date int `json:"date"`
2924	// Bio of the user.
2925	//
2926	// optional
2927	Bio string `json:"bio,omitempty"`
2928	// InviteLink is the link that was used by the user to send the join request.
2929	//
2930	// optional
2931	InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
2932}
2933
2934// ChatPermissions describes actions that a non-administrator user is
2935// allowed to take in a chat. All fields are optional.
2936type ChatPermissions struct {
2937	// CanSendMessages is true, if the user is allowed to send text messages,
2938	// contacts, locations and venues
2939	//
2940	// optional
2941	CanSendMessages bool `json:"can_send_messages,omitempty"`
2942	// CanSendAudios is true, if the user is allowed to send audios
2943	//
2944	// optional
2945	CanSendAudios bool `json:"can_send_audios,omitempty"`
2946	// CanSendDocuments is true, if the user is allowed to send documents
2947	//
2948	// optional
2949	CanSendDocuments bool `json:"can_send_documents,omitempty"`
2950	// CanSendPhotos is true, if the user is allowed to send photos
2951	//
2952	// optional
2953	CanSendPhotos bool `json:"can_send_photos,omitempty"`
2954	// CanSendVideos is true, if the user is allowed to send videos
2955	//
2956	// optional
2957	CanSendVideos bool `json:"can_send_videos,omitempty"`
2958	// CanSendVideoNotes is true, if the user is allowed to send video notes
2959	//
2960	// optional
2961	CanSendVideoNotes bool `json:"can_send_video_notes,omitempty"`
2962	// CanSendVoiceNotes is true, if the user is allowed to send voice notes
2963	//
2964	// optional
2965	CanSendVoiceNotes bool `json:"can_send_voice_notes,omitempty"`
2966	// CanSendPolls is true, if the user is allowed to send polls, implies
2967	// can_send_messages
2968	//
2969	// optional
2970	CanSendPolls bool `json:"can_send_polls,omitempty"`
2971	// CanSendOtherMessages is true, if the user is allowed to send animations,
2972	// games, stickers and use inline bots, implies can_send_media_messages
2973	//
2974	// optional
2975	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
2976	// CanAddWebPagePreviews is true, if the user is allowed to add web page
2977	// previews to their messages, implies can_send_media_messages
2978	//
2979	// optional
2980	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
2981	// CanChangeInfo is true, if the user is allowed to change the chat title,
2982	// photo and other settings. Ignored in public supergroups
2983	//
2984	// optional
2985	CanChangeInfo bool `json:"can_change_info,omitempty"`
2986	// CanInviteUsers is true, if the user is allowed to invite new users to the
2987	// chat
2988	//
2989	// optional
2990	CanInviteUsers bool `json:"can_invite_users,omitempty"`
2991	// CanPinMessages is true, if the user is allowed to pin messages. Ignored
2992	// in public supergroups
2993	//
2994	// optional
2995	CanPinMessages bool `json:"can_pin_messages,omitempty"`
2996	// CanManageTopics is true, if the user is allowed to create forum topics.
2997	// If omitted defaults to the value of can_pin_messages
2998	//
2999	// optional
3000	CanManageTopics bool `json:"can_manage_topics,omitempty"`
3001}
3002
3003// SetCanSendMediaMessages is a method to replace field "can_send_media_messages".
3004// It sets CanSendAudio, CanSendDocuments, CanSendPhotos, CanSendVideos,
3005// CanSendVideoNotes, CanSendVoiceNotes to passed value.
3006func (c *ChatPermissions) SetCanSendMediaMessages(b bool) {
3007	c.CanSendAudios = b
3008	c.CanSendDocuments = b
3009	c.CanSendPhotos = b
3010	c.CanSendVideos = b
3011	c.CanSendVideoNotes = b
3012	c.CanSendVoiceNotes = b
3013}
3014
3015// CanSendMediaMessages method to replace field "can_send_media_messages".
3016// It returns true if CanSendAudio and CanSendDocuments and CanSendPhotos and CanSendVideos and
3017// CanSendVideoNotes and CanSendVoiceNotes are true.
3018func (c *ChatPermissions) CanSendMediaMessages() bool {
3019	return c.CanSendAudios && c.CanSendDocuments &&
3020		c.CanSendPhotos && c.CanSendVideos &&
3021		c.CanSendVideoNotes && c.CanSendVoiceNotes
3022}
3023
3024// Birthdate represents a user's birthdate
3025type Birthdate struct {
3026	// Day of the user's birth; 1-31
3027	Day int `json:"day"`
3028	// Month of the user's birth; 1-12
3029	Month int `json:"month"`
3030	// Year of the user's birth
3031	//
3032	// optional
3033	Year *int `json:"year,omitempty"`
3034}
3035
3036// BusinessIntro represents a basic information about your business
3037type BusinessIntro struct {
3038	// Title text of the business intro
3039	//
3040	// optional
3041	Title *string `json:"title,omitempty"`
3042	// Message text of the business intro
3043	//
3044	// optional
3045	Message *string `json:"message,omitempty"`
3046	// Sticker of the business intro
3047	//
3048	// optional
3049	Sticker *Sticker `json:"sticker,omitempty"`
3050}
3051
3052// BusinessLocation represents a business geodata
3053type BusinessLocation struct {
3054	// Address of the business
3055	Address string `json:"address"`
3056	// Location of the business
3057	//
3058	// optional
3059	Location *Location `json:"location,omitempty"`
3060}
3061
3062// BusinessOpeningHoursInterval represents a business working interval
3063type BusinessOpeningHoursInterval struct {
3064	// OpeningMinute is the minute's sequence number in a week, starting on Monday,
3065	// marking the start of the time interval during which the business is open; 0 - 7 * 24 * 60
3066	OpeningMinute int `json:"opening_minute"`
3067	// ClosingMinute is the minute's sequence number in a week, starting on Monday,
3068	// marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60
3069	ClosingMinute int `json:"closing_minute"`
3070}
3071
3072// BusinessOpeningHours represents a set of business working intervals
3073type BusinessOpeningHours struct {
3074	// TimeZoneName is the unique name of the time zone
3075	// for which the opening hours are defined
3076	TimeZoneName string `json:"time_zone_name"`
3077	// OpeningHours is the list of time intervals describing
3078	// business opening hours
3079	OpeningHours []BusinessOpeningHoursInterval `json:"opening_hours"`
3080}
3081
3082// ChatLocation represents a location to which a chat is connected.
3083type ChatLocation struct {
3084	// Location is the location to which the supergroup is connected. Can't be a
3085	// live location.
3086	Location Location `json:"location"`
3087	// Address is the location address; 1-64 characters, as defined by the chat
3088	// owner
3089	Address string `json:"address"`
3090}
3091
3092const (
3093	ReactionTypeEmoji       = "emoji"
3094	ReactionTypeCustomEmoji = "custom_emoji"
3095)
3096
3097// ReactionType describes the type of a reaction. Currently, it can be one of: "emoji", "custom_emoji"
3098type ReactionType struct {
3099	// Type of the reaction. Can be "emoji", "custom_emoji"
3100	Type string `json:"type"`
3101	// Emoji type "emoji" only. Is a reaction emoji.
3102	Emoji string `json:"emoji"`
3103	// CustomEmoji type "custom_emoji" only. Is a custom emoji identifier.
3104	CustomEmoji string `json:"custom_emoji"`
3105}
3106
3107func (r ReactionType) IsEmoji() bool {
3108	return r.Type == ReactionTypeEmoji
3109}
3110
3111func (r ReactionType) IsCustomEmoji() bool {
3112	return r.Type == ReactionTypeCustomEmoji
3113}
3114
3115// ReactionCount represents a reaction added to a message along with the number of times it was added.
3116type ReactionCount struct {
3117	// Type of the reaction
3118	Type ReactionType `json:"type"`
3119	// TotalCount number of times the reaction was added
3120	TotalCount int `json:"total_count"`
3121}
3122
3123// MessageReactionUpdated represents a change of a reaction on a message performed by a user.
3124type MessageReactionUpdated struct {
3125	// Chat containing the message the user reacted to.
3126	Chat Chat `json:"chat"`
3127	// MessageID unique identifier of the message inside the chat.
3128	MessageID int `json:"message_id"`
3129	// User that changed the reaction, if the user isn't anonymous.
3130	//
3131	// optional
3132	User *User `json:"user"`
3133	// ActorChat the chat on behalf of which the reaction was changed,
3134	// if the user is anonymous.
3135	//
3136	// optional
3137	ActorChat *Chat `json:"actor_chat"`
3138	// Date of the change in Unix time.
3139	Date int64 `json:"date"`
3140	// OldReaction is a previous list of reaction types that were set by the user.
3141	OldReaction []ReactionType `json:"old_reaction"`
3142	// NewReaction is a new list of reaction types that have been set by the user.
3143	NewReaction []ReactionType `json:"new_reaction"`
3144}
3145
3146// MessageReactionCountUpdated represents reaction changes on a message with anonymous reactions.
3147type MessageReactionCountUpdated struct {
3148	// Chat containing the message.
3149	Chat Chat `json:"chat"`
3150	// MessageID unique identifier of the message inside the chat.
3151	MessageID int `json:"message_id"`
3152	// Date of the change in Unix time.
3153	Date int64 `json:"date"`
3154	// Reactions is a list of reactions that are present on the message.
3155	Reactions []ReactionCount `json:"reactions"`
3156}
3157
3158// ForumTopic represents a forum topic.
3159type ForumTopic struct {
3160	// MessageThreadID is the unique identifier of the forum topic
3161	MessageThreadID int `json:"message_thread_id"`
3162	// Name is the name of the topic
3163	Name string `json:"name"`
3164	// IconColor is the color of the topic icon in RGB format
3165	IconColor int `json:"icon_color"`
3166	// IconCustomEmojiID is the unique identifier of the custom emoji
3167	// shown as the topic icon
3168	//
3169	// optional
3170	IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
3171}
3172
3173// BotCommand represents a bot command.
3174type BotCommand struct {
3175	// Command text of the command, 1-32 characters.
3176	// Can contain only lowercase English letters, digits and underscores.
3177	Command string `json:"command"`
3178	// Description of the command, 3-256 characters.
3179	Description string `json:"description"`
3180}
3181
3182// BotCommandScope represents the scope to which bot commands are applied.
3183//
3184// It contains the fields for all types of scopes, different types only support
3185// specific (or no) fields.
3186type BotCommandScope struct {
3187	Type   string `json:"type"`
3188	ChatID int64  `json:"chat_id,omitempty"`
3189	UserID int64  `json:"user_id,omitempty"`
3190}
3191
3192// BotName represents the bot's name.
3193type BotName struct {
3194	Name string `json:"name"`
3195}
3196
3197// BotDescription represents the bot's description.
3198type BotDescription struct {
3199	Description string `json:"description"`
3200}
3201
3202// BotShortDescription represents the bot's short description
3203type BotShortDescription struct {
3204	ShortDescription string `json:"short_description"`
3205}
3206
3207// MenuButton describes the bot's menu button in a private chat.
3208type MenuButton struct {
3209	// Type is the type of menu button, must be one of:
3210	// - `commands`
3211	// - `web_app`
3212	// - `default`
3213	Type string `json:"type"`
3214	// Text is the text on the button, for `web_app` type.
3215	Text string `json:"text,omitempty"`
3216	// WebApp is the description of the Web App that will be launched when the
3217	// user presses the button for the `web_app` type.
3218	//
3219	// Alternatively, a t.me link to a Web App of the bot can be specified in the object instead of the Web App's URL,
3220	// in which case the Web App will be opened as if the user pressed the link.
3221	WebApp *WebAppInfo `json:"web_app,omitempty"`
3222}
3223
3224const (
3225	ChatBoostSourcePremium  = "premium"
3226	ChatBoostSourceGiftCode = "gift_code"
3227	ChatBoostSourceGiveaway = "giveaway"
3228)
3229
3230// ChatBoostSource describes the source of a chat boost
3231type ChatBoostSource struct {
3232	// Source of the boost, It can be one of:
3233	// "premium", "gift_code", "giveaway"
3234	Source string `json:"source"`
3235	// For "premium": User that boosted the chat
3236	// For "gift_code": User for which the gift code was created
3237	// Optional for "giveaway": User that won the prize in the giveaway if any
3238	User *User `json:"user,omitempty"`
3239	// GiveawayMessageID "giveaway" only.
3240	// Is an identifier of a message in the chat with the giveaway;
3241	// the message could have been deleted already. May be 0 if the message isn't sent yet.
3242	GiveawayMessageID int `json:"giveaway_message_id,omitempty"`
3243	// IsUnclaimed "giveaway" only.
3244	// True, if the giveaway was completed, but there was no user to win the prize
3245	//
3246	// optional
3247	IsUnclaimed bool `json:"is_unclaimed,omitempty"`
3248}
3249
3250func (c ChatBoostSource) IsPremium() bool {
3251	return c.Source == ChatBoostSourcePremium
3252}
3253
3254func (c ChatBoostSource) IsGiftCode() bool {
3255	return c.Source == ChatBoostSourceGiftCode
3256}
3257
3258func (c ChatBoostSource) IsGiveaway() bool {
3259	return c.Source == ChatBoostSourceGiveaway
3260}
3261
3262// ChatBoost contains information about a chat boost.
3263type ChatBoost struct {
3264	// BoostID is an unique identifier of the boost
3265	BoostID string `json:"boost_id"`
3266	// AddDate is a point in time (Unix timestamp) when the chat was boosted
3267	AddDate int64 `json:"add_date"`
3268	// ExpirationDate is a point in time (Unix timestamp) when the boost will
3269	// automatically expire, unless the booster's Telegram Premium subscription is prolonged
3270	ExpirationDate int64 `json:"expiration_date"`
3271	// Source of the added boost
3272	Source ChatBoostSource `json:"source"`
3273}
3274
3275// ChatBoostUpdated represents a boost added to a chat or changed.
3276type ChatBoostUpdated struct {
3277	// Chat which was boosted
3278	Chat Chat `json:"chat"`
3279	// Boost infomation about the chat boost
3280	Boost ChatBoost `json:"boost"`
3281}
3282
3283// ChatBoostRemoved represents a boost removed from a chat.
3284type ChatBoostRemoved struct {
3285	// Chat which was boosted
3286	Chat Chat `json:"chat"`
3287	// BoostID unique identifier of the boost
3288	BoostID string `json:"boost_id"`
3289	// RemoveDate point in time (Unix timestamp) when the boost was removed
3290	RemoveDate int64 `json:"remove_date"`
3291	// Source of the removed boost
3292	Source ChatBoostSource `json:"source"`
3293}
3294
3295// UserChatBoosts represents a list of boosts added to a chat by a user.
3296type UserChatBoosts struct {
3297	// Boosts is the list of boosts added to the chat by the user
3298	Boosts []ChatBoost `json:"boosts"`
3299}
3300
3301// BusinessConnection describes the connection of the bot with a business account.
3302type BusinessConnection struct {
3303	// ID is an unique identifier of the business connection
3304	ID string `json:"id"`
3305	// User is a business account user that created the business connection
3306	User User `json:"user"`
3307	// UserChatID identifier of a private chat with the user who
3308	// created the business connection.
3309	UserChatID int64 `json:"user_chat_id"`
3310	// Date the connection was established in Unix time
3311	Date int64 `json:"date"`
3312	// CanReply is True, if the bot can act on behalf of the
3313	// business account in chats that were active in the last 24 hours
3314	CanReply bool `json:"can_reply"`
3315	// IsEnabled is True, if the connection is active
3316	IsEnabled bool `json:"is_enabled"`
3317}
3318
3319// BusinessMessagesDeleted is received when messages are deleted
3320// from a connected business account.
3321type BusinessMessagesDeleted struct {
3322	// BusinessConnectionID is an unique identifier
3323	// of the business connection
3324	BusinessConnectionID string `json:"business_connection_id"`
3325	// Chat is the information about a chat in the business account.
3326	// The bot may not have access to the chat or the corresponding user.
3327	Chat Chat `json:"chat"`
3328	// MessageIDs is a JSON-serialized list of identifiers of deleted messages
3329	// in the chat of the business account
3330	MessageIDs []int `json:"message_ids"`
3331}
3332
3333// ResponseParameters are various errors that can be returned in APIResponse.
3334type ResponseParameters struct {
3335	// The group has been migrated to a supergroup with the specified identifier.
3336	//
3337	// optional
3338	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
3339	// In case of exceeding flood control, the number of seconds left to wait
3340	// before the request can be repeated.
3341	//
3342	// optional
3343	RetryAfter int `json:"retry_after,omitempty"`
3344}
3345
3346// BaseInputMedia is a base type for the InputMedia types.
3347type BaseInputMedia struct {
3348	// Type of the result.
3349	Type string `json:"type"`
3350	// Media file to send. Pass a file_id to send a file
3351	// that exists on the Telegram servers (recommended),
3352	// pass an HTTP URL for Telegram to get a file from the Internet,
3353	// or pass “attach://<file_attach_name>” to upload a new one
3354	// using multipart/form-data under <file_attach_name> name.
3355	Media RequestFileData `json:"media"`
3356	// thumb intentionally missing as it is not currently compatible
3357
3358	// Caption of the video to be sent, 0-1024 characters after entities parsing.
3359	//
3360	// optional
3361	Caption string `json:"caption,omitempty"`
3362	// ParseMode mode for parsing entities in the video caption.
3363	// See formatting options for more details
3364	// (https://core.telegram.org/bots/api#formatting-options).
3365	//
3366	// optional
3367	ParseMode string `json:"parse_mode,omitempty"`
3368	// CaptionEntities is a list of special entities that appear in the caption,
3369	// which can be specified instead of parse_mode
3370	//
3371	// optional
3372	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
3373	// Pass True, if the caption must be shown above the message media
3374	//
3375	// optional
3376	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
3377	// HasSpoiler pass True, if the photo needs to be covered with a spoiler animation
3378	//
3379	// optional
3380	HasSpoiler bool `json:"has_spoiler,omitempty"`
3381}
3382
3383// InputMediaPhoto is a photo to send as part of a media group.
3384type InputMediaPhoto struct {
3385	BaseInputMedia
3386}
3387
3388// InputMediaVideo is a video to send as part of a media group.
3389type InputMediaVideo struct {
3390	BaseInputMedia
3391	// Thumbnail of the file sent; can be ignored if thumbnail generation for
3392	// the file is supported server-side.
3393	//
3394	// optional
3395	Thumb RequestFileData `json:"thumbnail,omitempty"`
3396	// Width video width
3397	//
3398	// optional
3399	Width int `json:"width,omitempty"`
3400	// Height video height
3401	//
3402	// optional
3403	Height int `json:"height,omitempty"`
3404	// Duration video duration
3405	//
3406	// optional
3407	Duration int `json:"duration,omitempty"`
3408	// SupportsStreaming pass True, if the uploaded video is suitable for streaming.
3409	//
3410	// optional
3411	SupportsStreaming bool `json:"supports_streaming,omitempty"`
3412	// HasSpoiler pass True, if the video needs to be covered with a spoiler animation
3413	//
3414	// optional
3415	HasSpoiler bool `json:"has_spoiler,omitempty"`
3416}
3417
3418// InputMediaAnimation is an animation to send as part of a media group.
3419type InputMediaAnimation struct {
3420	BaseInputMedia
3421	// Thumbnail of the file sent; can be ignored if thumbnail generation for
3422	// the file is supported server-side.
3423	//
3424	// optional
3425	Thumb RequestFileData `json:"thumbnail,omitempty"`
3426	// Width video width
3427	//
3428	// optional
3429	Width int `json:"width,omitempty"`
3430	// Height video height
3431	//
3432	// optional
3433	Height int `json:"height,omitempty"`
3434	// Duration video duration
3435	//
3436	// optional
3437	Duration int `json:"duration,omitempty"`
3438	// HasSpoiler pass True, if the photo needs to be covered with a spoiler animation
3439	//
3440	// optional
3441	HasSpoiler bool `json:"has_spoiler,omitempty"`
3442}
3443
3444// InputMediaAudio is an audio to send as part of a media group.
3445type InputMediaAudio struct {
3446	BaseInputMedia
3447	// Thumbnail of the file sent; can be ignored if thumbnail generation for
3448	// the file is supported server-side.
3449	//
3450	// optional
3451	Thumb RequestFileData `json:"thumbnail,omitempty"`
3452	// Duration of the audio in seconds
3453	//
3454	// optional
3455	Duration int `json:"duration,omitempty"`
3456	// Performer of the audio
3457	//
3458	// optional
3459	Performer string `json:"performer,omitempty"`
3460	// Title of the audio
3461	//
3462	// optional
3463	Title string `json:"title,omitempty"`
3464}
3465
3466// InputMediaDocument is a general file to send as part of a media group.
3467type InputMediaDocument struct {
3468	BaseInputMedia
3469	// Thumbnail of the file sent; can be ignored if thumbnail generation for
3470	// the file is supported server-side.
3471	//
3472	// optional
3473	Thumb RequestFileData `json:"thumbnail,omitempty"`
3474	// DisableContentTypeDetection disables automatic server-side content type
3475	// detection for files uploaded using multipart/form-data. Always true, if
3476	// the document is sent as part of an album
3477	//
3478	// optional
3479	DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"`
3480}
3481
3482// This object describes the paid media to be sent. Currently, it can be one of:
3483//   - InputPaidMediaPhoto
3484//   - InputPaidMediaVideo
3485type InputPaidMedia struct {
3486	// Type of the media, must be one of:
3487	//  - "photo"
3488	//  - "video"
3489	Type string `json:"type"`
3490	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended),
3491	// pass an HTTP URL for Telegram to get a file from the Internet,
3492	// or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name.
3493	// More information on https://core.telegram.org/bots/api#sending-files
3494	Media RequestFileData `json:"media"`
3495	// InputPaidMediaVideo only.
3496	// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
3497	// The thumbnail should be in JPEG format and less than 200 kB in size.
3498	// A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data.
3499	// Thumbnails can't be reused and can be only uploaded as a new file,
3500	//  so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
3501	//
3502	// optional
3503	Thumb RequestFileData `json:"thumbnail"`
3504	// InputPaidMediaVideo only.
3505	// Video width
3506	//
3507	// optional
3508	Width int64 `json:"width,omitempty"`
3509	// InputPaidMediaVideo only.
3510	// Video height
3511	//
3512	// optional
3513	Height int64 `json:"height,omitempty"`
3514	// InputPaidMediaVideo only.
3515	// Video duration in seconds
3516	//
3517	// optional
3518	Duration int64 `json:"duration,omitempty"`
3519	// InputPaidMediaVideo only.
3520	// Pass True if the uploaded video is suitable for streaming
3521	SupportsStreaming bool `json:"supports_streaming,omitempty"`
3522}
3523
3524// Constant values for sticker types
3525const (
3526	StickerTypeRegular     = "regular"
3527	StickerTypeMask        = "mask"
3528	StickerTypeCustomEmoji = "custom_emoji"
3529)
3530
3531// Sticker represents a sticker.
3532type Sticker struct {
3533	// FileID is an identifier for this file, which can be used to download or
3534	// reuse the file
3535	FileID string `json:"file_id"`
3536	// FileUniqueID is a unique identifier for this file,
3537	// which is supposed to be the same over time and for different bots.
3538	// Can't be used to download or reuse the file.
3539	FileUniqueID string `json:"file_unique_id"`
3540	// Type is a type of the sticker, currently one of “regular”,
3541	// “mask”, “custom_emoji”. The type of the sticker is independent
3542	// from its format, which is determined by the fields is_animated and is_video.
3543	Type string `json:"type"`
3544	// Width sticker width
3545	Width int `json:"width"`
3546	// Height sticker height
3547	Height int `json:"height"`
3548	// IsAnimated true, if the sticker is animated
3549	//
3550	// optional
3551	IsAnimated bool `json:"is_animated,omitempty"`
3552	// IsVideo true, if the sticker is a video sticker
3553	//
3554	// optional
3555	IsVideo bool `json:"is_video,omitempty"`
3556	// Thumbnail sticker thumbnail in the .WEBP or .JPG format
3557	//
3558	// optional
3559	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
3560	// Emoji associated with the sticker
3561	//
3562	// optional
3563	Emoji string `json:"emoji,omitempty"`
3564	// SetName of the sticker set to which the sticker belongs
3565	//
3566	// optional
3567	SetName string `json:"set_name,omitempty"`
3568	// PremiumAnimation for premium regular stickers, premium animation for the sticker
3569	//
3570	// optional
3571	PremiumAnimation *File `json:"premium_animation,omitempty"`
3572	// MaskPosition is for mask stickers, the position where the mask should be
3573	// placed
3574	//
3575	// optional
3576	MaskPosition *MaskPosition `json:"mask_position,omitempty"`
3577	// CustomEmojiID for custom emoji stickers, unique identifier of the custom emoji
3578	//
3579	// optional
3580	CustomEmojiID string `json:"custom_emoji_id,omitempty"`
3581	// NeedsRepainting True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places
3582	//
3583	//optional
3584	NeedsRepainting bool `json:"needs_reainting,omitempty"`
3585	// FileSize
3586	//
3587	// optional
3588	FileSize int `json:"file_size,omitempty"`
3589}
3590
3591// IsRegular returns if the Sticker is regular
3592func (s Sticker) IsRegular() bool {
3593	return s.Type == StickerTypeRegular
3594}
3595
3596// IsMask returns if the Sticker is mask
3597func (s Sticker) IsMask() bool {
3598	return s.Type == StickerTypeMask
3599}
3600
3601// IsCustomEmoji returns if the Sticker is custom emoji
3602func (s Sticker) IsCustomEmoji() bool {
3603	return s.Type == StickerTypeCustomEmoji
3604}
3605
3606// StickerSet represents a sticker set.
3607type StickerSet struct {
3608	// Name sticker set name
3609	Name string `json:"name"`
3610	// Title sticker set title
3611	Title string `json:"title"`
3612	// StickerType of stickers in the set, currently one of “regular”, “mask”, “custom_emoji”
3613	StickerType string `json:"sticker_type"`
3614	// ContainsMasks true, if the sticker set contains masks
3615	//
3616	// deprecated. Use sticker_type instead
3617	ContainsMasks bool `json:"contains_masks"`
3618	// Stickers list of all set stickers
3619	Stickers []Sticker `json:"stickers"`
3620	// Thumb is the sticker set thumbnail in the .WEBP or .TGS format
3621	Thumbnail *PhotoSize `json:"thumbnail"`
3622}
3623
3624// IsRegular returns if the StickerSet is regular
3625func (s StickerSet) IsRegular() bool {
3626	return s.StickerType == StickerTypeRegular
3627}
3628
3629// IsMask returns if the StickerSet is mask
3630func (s StickerSet) IsMask() bool {
3631	return s.StickerType == StickerTypeMask
3632}
3633
3634// IsCustomEmoji returns if the StickerSet is custom emoji
3635func (s StickerSet) IsCustomEmoji() bool {
3636	return s.StickerType == StickerTypeCustomEmoji
3637}
3638
3639// MaskPosition describes the position on faces where a mask should be placed
3640// by default.
3641type MaskPosition struct {
3642	// The part of the face relative to which the mask should be placed.
3643	// One of “forehead”, “eyes”, “mouth”, or “chin”.
3644	Point string `json:"point"`
3645	// Shift by X-axis measured in widths of the mask scaled to the face size,
3646	// from left to right. For example, choosing -1.0 will place mask just to
3647	// the left of the default mask position.
3648	XShift float64 `json:"x_shift"`
3649	// Shift by Y-axis measured in heights of the mask scaled to the face size,
3650	// from top to bottom. For example, 1.0 will place the mask just below the
3651	// default mask position.
3652	YShift float64 `json:"y_shift"`
3653	// Mask scaling coefficient. For example, 2.0 means double size.
3654	Scale float64 `json:"scale"`
3655}
3656
3657// InputSticker describes a sticker to be added to a sticker set.
3658type InputSticker struct {
3659	// The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL.
3660	Sticker RequestFile `json:"sticker"`
3661	// 	Format of the added sticker, must be one of “static” for a
3662	// .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a WEBM video
3663	Format string `json:"format"`
3664	// List of 1-20 emoji associated with the sticker
3665	EmojiList []string `json:"emoji_list"`
3666	// Position where the mask should be placed on faces. For “mask” stickers only.
3667	//
3668	// optional
3669	MaskPosition *MaskPosition `json:"mask_position"`
3670	// List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom_emoji” stickers only.
3671	//
3672	// optional
3673	Keywords []string `json:"keywords"`
3674}
3675
3676// Game represents a game. Use BotFather to create and edit games, their short
3677// names will act as unique identifiers.
3678type Game struct {
3679	// Title of the game
3680	Title string `json:"title"`
3681	// Description of the game
3682	Description string `json:"description"`
3683	// Photo that will be displayed in the game message in chats.
3684	Photo []PhotoSize `json:"photo"`
3685	// Text a brief description of the game or high scores included in the game message.
3686	// Can be automatically edited to include current high scores for the game
3687	// when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
3688	//
3689	// optional
3690	Text string `json:"text,omitempty"`
3691	// TextEntities special entities that appear in text, such as usernames, URLs, bot commands, etc.
3692	//
3693	// optional
3694	TextEntities []MessageEntity `json:"text_entities,omitempty"`
3695	// Animation is an animation that will be displayed in the game message in chats.
3696	// Upload via BotFather (https://t.me/botfather).
3697	//
3698	// optional
3699	Animation Animation `json:"animation,omitempty"`
3700}
3701
3702// GameHighScore is a user's score and position on the leaderboard.
3703type GameHighScore struct {
3704	// Position in high score table for the game
3705	Position int `json:"position"`
3706	// User user
3707	User User `json:"user"`
3708	// Score score
3709	Score int `json:"score"`
3710}
3711
3712// CallbackGame is for starting a game in an inline keyboard button.
3713type CallbackGame struct{}
3714
3715// SwitchInlineQueryChosenChat represents an inline button that switches the current
3716// user to inline mode in a chosen chat, with an optional default inline query.
3717type SwitchInlineQueryChosenChat struct {
3718	// Query is default inline query to be inserted in the input field.
3719	// If left empty, only the bot's username will be inserted
3720	//
3721	// optional
3722	Query string `json:"query,omitempty"`
3723	// AllowUserChats is True, if private chats with users can be chosen
3724	//
3725	// optional
3726	AllowUserChats bool `json:"allow_user_chats,omitempty"`
3727	// AllowBotChats is True, if private chats with bots can be chosen
3728	//
3729	// optional
3730	AllowBotChats bool `json:"allow_bot_chats,omitempty"`
3731	// AllowGroupChats is True, if group and supergroup chats can be chosen
3732	//
3733	// optional
3734	AllowGroupChats bool `json:"allow_group_chats,omitempty"`
3735	// AllowChannelChats is True, if channel chats can be chosen
3736	//
3737	// optional
3738	AllowChannelChats bool `json:"allow_channel_chats,omitempty"`
3739}
3740
3741// WebhookInfo is information about a currently set webhook.
3742type WebhookInfo struct {
3743	// URL webhook URL, may be empty if webhook is not set up.
3744	URL string `json:"url"`
3745	// HasCustomCertificate true, if a custom certificate was provided for webhook certificate checks.
3746	HasCustomCertificate bool `json:"has_custom_certificate"`
3747	// PendingUpdateCount number of updates awaiting delivery.
3748	PendingUpdateCount int `json:"pending_update_count"`
3749	// IPAddress is the currently used webhook IP address
3750	//
3751	// optional
3752	IPAddress string `json:"ip_address,omitempty"`
3753	// LastErrorDate unix time for the most recent error
3754	// that happened when trying to deliver an update via webhook.
3755	//
3756	// optional
3757	LastErrorDate int `json:"last_error_date,omitempty"`
3758	// LastErrorMessage error message in human-readable format for the most recent error
3759	// that happened when trying to deliver an update via webhook.
3760	//
3761	// optional
3762	LastErrorMessage string `json:"last_error_message,omitempty"`
3763	// LastSynchronizationErrorDate is the unix time of the most recent error that
3764	// happened when trying to synchronize available updates with Telegram datacenters.
3765	LastSynchronizationErrorDate int `json:"last_synchronization_error_date,omitempty"`
3766	// MaxConnections maximum allowed number of simultaneous
3767	// HTTPS connections to the webhook for update delivery.
3768	//
3769	// optional
3770	MaxConnections int `json:"max_connections,omitempty"`
3771	// AllowedUpdates is a list of update types the bot is subscribed to.
3772	// Defaults to all update types
3773	//
3774	// optional
3775	AllowedUpdates []string `json:"allowed_updates,omitempty"`
3776}
3777
3778// IsSet returns true if a webhook is currently set.
3779func (info WebhookInfo) IsSet() bool {
3780	return info.URL != ""
3781}
3782
3783// InlineQuery is a Query from Telegram for an inline request.
3784type InlineQuery struct {
3785	// ID unique identifier for this query
3786	ID string `json:"id"`
3787	// From sender
3788	From *User `json:"from"`
3789	// Query text of the query (up to 256 characters).
3790	Query string `json:"query"`
3791	// Offset of the results to be returned, can be controlled by the bot.
3792	Offset string `json:"offset"`
3793	// Type of the chat, from which the inline query was sent. Can be either
3794	// “sender” for a private chat with the inline query sender, “private”,
3795	// “group”, “supergroup”, or “channel”. The chat type should be always known
3796	// for requests sent from official clients and most third-party clients,
3797	// unless the request was sent from a secret chat
3798	//
3799	// optional
3800	ChatType string `json:"chat_type,omitempty"`
3801	// Location sender location, only for bots that request user location.
3802	//
3803	// optional
3804	Location *Location `json:"location,omitempty"`
3805}
3806
3807// InlineQueryResultCachedAudio is an inline query response with cached audio.
3808type InlineQueryResultCachedAudio struct {
3809	// Type of the result, must be audio
3810	Type string `json:"type"`
3811	// ID unique identifier for this result, 1-64 bytes
3812	ID string `json:"id"`
3813	// AudioID a valid file identifier for the audio file
3814	AudioID string `json:"audio_file_id"`
3815	// Caption 0-1024 characters after entities parsing
3816	//
3817	// optional
3818	Caption string `json:"caption,omitempty"`
3819	// ParseMode mode for parsing entities in the video caption.
3820	// See formatting options for more details
3821	// (https://core.telegram.org/bots/api#formatting-options).
3822	//
3823	// optional
3824	ParseMode string `json:"parse_mode,omitempty"`
3825	// CaptionEntities is a list of special entities that appear in the caption,
3826	// which can be specified instead of parse_mode
3827	//
3828	// optional
3829	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
3830	// ReplyMarkup inline keyboard attached to the message
3831	//
3832	// optional
3833	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3834	// InputMessageContent content of the message to be sent instead of the audio
3835	//
3836	// optional
3837	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3838}
3839
3840// InlineQueryResultCachedDocument is an inline query response with cached document.
3841type InlineQueryResultCachedDocument struct {
3842	// Type of the result, must be a document
3843	Type string `json:"type"`
3844	// ID unique identifier for this result, 1-64 bytes
3845	ID string `json:"id"`
3846	// DocumentID a valid file identifier for the file
3847	DocumentID string `json:"document_file_id"`
3848	// Title for the result
3849	//
3850	// optional
3851	Title string `json:"title,omitempty"`
3852	// Caption of the document to be sent, 0-1024 characters after entities parsing
3853	//
3854	// optional
3855	Caption string `json:"caption,omitempty"`
3856	// Description short description of the result
3857	//
3858	// optional
3859	Description string `json:"description,omitempty"`
3860	// ParseMode mode for parsing entities in the video caption.
3861	//	// See formatting options for more details
3862	//	// (https://core.telegram.org/bots/api#formatting-options).
3863	//
3864	// optional
3865	ParseMode string `json:"parse_mode,omitempty"`
3866	// CaptionEntities is a list of special entities that appear in the caption,
3867	// which can be specified instead of parse_mode
3868	//
3869	// optional
3870	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
3871	// ReplyMarkup inline keyboard attached to the message
3872	//
3873	// optional
3874	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3875	// InputMessageContent content of the message to be sent instead of the file
3876	//
3877	// optional
3878	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3879}
3880
3881// InlineQueryResultCachedGIF is an inline query response with cached gif.
3882type InlineQueryResultCachedGIF struct {
3883	// Type of the result, must be gif.
3884	Type string `json:"type"`
3885	// ID unique identifier for this result, 1-64 bytes.
3886	ID string `json:"id"`
3887	// GifID a valid file identifier for the GIF file.
3888	GIFID string `json:"gif_file_id"`
3889	// Title for the result
3890	//
3891	// optional
3892	Title string `json:"title,omitempty"`
3893	// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
3894	//
3895	// optional
3896	Caption string `json:"caption,omitempty"`
3897	// ParseMode mode for parsing entities in the caption.
3898	// See formatting options for more details
3899	// (https://core.telegram.org/bots/api#formatting-options).
3900	//
3901	// optional
3902	ParseMode string `json:"parse_mode,omitempty"`
3903	// CaptionEntities is a list of special entities that appear in the caption,
3904	// which can be specified instead of parse_mode
3905	//
3906	// optional
3907	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
3908	// Pass True, if the caption must be shown above the message media
3909	//
3910	// optional
3911	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
3912	// ReplyMarkup inline keyboard attached to the message.
3913	//
3914	// optional
3915	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3916	// InputMessageContent content of the message to be sent instead of the GIF animation.
3917	//
3918	// optional
3919	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3920}
3921
3922// InlineQueryResultCachedMPEG4GIF is an inline query response with cached
3923// H.264/MPEG-4 AVC video without sound gif.
3924type InlineQueryResultCachedMPEG4GIF struct {
3925	// Type of the result, must be mpeg4_gif
3926	Type string `json:"type"`
3927	// ID unique identifier for this result, 1-64 bytes
3928	ID string `json:"id"`
3929	// MPEG4FileID a valid file identifier for the MP4 file
3930	MPEG4FileID string `json:"mpeg4_file_id"`
3931	// Title for the result
3932	//
3933	// optional
3934	Title string `json:"title,omitempty"`
3935	// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
3936	//
3937	// optional
3938	Caption string `json:"caption,omitempty"`
3939	// ParseMode mode for parsing entities in the caption.
3940	// See formatting options for more details
3941	// (https://core.telegram.org/bots/api#formatting-options).
3942	//
3943	// optional
3944	ParseMode string `json:"parse_mode,omitempty"`
3945	// ParseMode mode for parsing entities in the video caption.
3946	// See formatting options for more details
3947	// (https://core.telegram.org/bots/api#formatting-options).
3948	//
3949	// optional
3950	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
3951	// Pass True, if the caption must be shown above the message media
3952	//
3953	// optional
3954	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
3955	// ReplyMarkup inline keyboard attached to the message.
3956	//
3957	// optional
3958	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
3959	// InputMessageContent content of the message to be sent instead of the video animation.
3960	//
3961	// optional
3962	InputMessageContent interface{} `json:"input_message_content,omitempty"`
3963}
3964
3965// InlineQueryResultCachedPhoto is an inline query response with cached photo.
3966type InlineQueryResultCachedPhoto struct {
3967	// Type of the result, must be a photo.
3968	Type string `json:"type"`
3969	// ID unique identifier for this result, 1-64 bytes.
3970	ID string `json:"id"`
3971	// PhotoID a valid file identifier of the photo.
3972	PhotoID string `json:"photo_file_id"`
3973	// Title for the result.
3974	//
3975	// optional
3976	Title string `json:"title,omitempty"`
3977	// Description short description of the result.
3978	//
3979	// optional
3980	Description string `json:"description,omitempty"`
3981	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
3982	//
3983	// optional
3984	Caption string `json:"caption,omitempty"`
3985	// ParseMode mode for parsing entities in the photo caption.
3986	// See formatting options for more details
3987	// (https://core.telegram.org/bots/api#formatting-options).
3988	//
3989	// optional
3990	ParseMode string `json:"parse_mode,omitempty"`
3991	// CaptionEntities is a list of special entities that appear in the caption,
3992	// which can be specified instead of parse_mode
3993	//
3994	// optional
3995	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
3996	// Pass True, if the caption must be shown above the message media
3997	//
3998	// optional
3999	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
4000	// ReplyMarkup inline keyboard attached to the message.
4001	//
4002	// optional
4003	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4004	// InputMessageContent content of the message to be sent instead of the photo.
4005	//
4006	// optional
4007	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4008}
4009
4010// InlineQueryResultCachedSticker is an inline query response with cached sticker.
4011type InlineQueryResultCachedSticker struct {
4012	// Type of the result, must be a sticker
4013	Type string `json:"type"`
4014	// ID unique identifier for this result, 1-64 bytes
4015	ID string `json:"id"`
4016	// StickerID a valid file identifier of the sticker
4017	StickerID string `json:"sticker_file_id"`
4018	// Title is a title
4019	Title string `json:"title"`
4020	// ReplyMarkup inline keyboard attached to the message
4021	//
4022	// optional
4023	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4024	// InputMessageContent content of the message to be sent instead of the sticker
4025	//
4026	// optional
4027	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4028}
4029
4030// InlineQueryResultCachedVideo is an inline query response with cached video.
4031type InlineQueryResultCachedVideo struct {
4032	// Type of the result, must be video
4033	Type string `json:"type"`
4034	// ID unique identifier for this result, 1-64 bytes
4035	ID string `json:"id"`
4036	// VideoID a valid file identifier for the video file
4037	VideoID string `json:"video_file_id"`
4038	// Title for the result
4039	Title string `json:"title"`
4040	// Description short description of the result
4041	//
4042	// optional
4043	Description string `json:"description,omitempty"`
4044	// Caption of the video to be sent, 0-1024 characters after entities parsing
4045	//
4046	// optional
4047	Caption string `json:"caption,omitempty"`
4048	// ParseMode mode for parsing entities in the video caption.
4049	// See formatting options for more details
4050	// (https://core.telegram.org/bots/api#formatting-options).
4051	//
4052	// optional
4053	ParseMode string `json:"parse_mode,omitempty"`
4054	// CaptionEntities is a list of special entities that appear in the caption,
4055	// which can be specified instead of parse_mode
4056	//
4057	// optional
4058	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
4059	// Pass True, if the caption must be shown above the message media
4060	//
4061	// optional
4062	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
4063	// ReplyMarkup inline keyboard attached to the message
4064	//
4065	// optional
4066	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4067	// InputMessageContent content of the message to be sent instead of the video
4068	//
4069	// optional
4070	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4071}
4072
4073// InlineQueryResultCachedVoice is an inline query response with cached voice.
4074type InlineQueryResultCachedVoice struct {
4075	// Type of the result, must be voice
4076	Type string `json:"type"`
4077	// ID unique identifier for this result, 1-64 bytes
4078	ID string `json:"id"`
4079	// VoiceID a valid file identifier for the voice message
4080	VoiceID string `json:"voice_file_id"`
4081	// Title voice message title
4082	Title string `json:"title"`
4083	// Caption 0-1024 characters after entities parsing
4084	//
4085	// optional
4086	Caption string `json:"caption,omitempty"`
4087	// ParseMode mode for parsing entities in the video caption.
4088	// See formatting options for more details
4089	// (https://core.telegram.org/bots/api#formatting-options).
4090	//
4091	// optional
4092	ParseMode string `json:"parse_mode,omitempty"`
4093	// CaptionEntities is a list of special entities that appear in the caption,
4094	// which can be specified instead of parse_mode
4095	//
4096	// optional
4097	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
4098	// ReplyMarkup inline keyboard attached to the message
4099	//
4100	// optional
4101	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4102	// InputMessageContent content of the message to be sent instead of the voice message
4103	//
4104	// optional
4105	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4106}
4107
4108// InlineQueryResultArticle represents a link to an article or web page.
4109type InlineQueryResultArticle struct {
4110	// Type of the result, must be article.
4111	Type string `json:"type"`
4112	// ID unique identifier for this result, 1-64 Bytes.
4113	ID string `json:"id"`
4114	// Title of the result
4115	Title string `json:"title"`
4116	// InputMessageContent content of the message to be sent.
4117	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4118	// ReplyMarkup Inline keyboard attached to the message.
4119	//
4120	// optional
4121	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4122	// URL of the result.
4123	//
4124	// optional
4125	URL string `json:"url,omitempty"`
4126	// HideURL pass True, if you don't want the URL to be shown in the message.
4127	//
4128	// optional
4129	HideURL bool `json:"hide_url,omitempty"`
4130	// Description short description of the result.
4131	//
4132	// optional
4133	Description string `json:"description,omitempty"`
4134	// ThumbURL url of the thumbnail for the result
4135	//
4136	// optional
4137	ThumbURL string `json:"thumbnail_url,omitempty"`
4138	// ThumbWidth thumbnail width
4139	//
4140	// optional
4141	ThumbWidth int `json:"thumbnail_width,omitempty"`
4142	// ThumbHeight thumbnail height
4143	//
4144	// optional
4145	ThumbHeight int `json:"thumbnail_height,omitempty"`
4146}
4147
4148// InlineQueryResultAudio is an inline query response audio.
4149type InlineQueryResultAudio struct {
4150	// Type of the result, must be audio
4151	Type string `json:"type"`
4152	// ID unique identifier for this result, 1-64 bytes
4153	ID string `json:"id"`
4154	// URL a valid url for the audio file
4155	URL string `json:"audio_url"`
4156	// Title is a title
4157	Title string `json:"title"`
4158	// Caption 0-1024 characters after entities parsing
4159	//
4160	// optional
4161	Caption string `json:"caption,omitempty"`
4162	// ParseMode mode for parsing entities in the video caption.
4163	// See formatting options for more details
4164	// (https://core.telegram.org/bots/api#formatting-options).
4165	//
4166	// optional
4167	ParseMode string `json:"parse_mode,omitempty"`
4168	// CaptionEntities is a list of special entities that appear in the caption,
4169	// which can be specified instead of parse_mode
4170	//
4171	// optional
4172	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
4173	// Performer is a performer
4174	//
4175	// optional
4176	Performer string `json:"performer,omitempty"`
4177	// Duration audio duration in seconds
4178	//
4179	// optional
4180	Duration int `json:"audio_duration,omitempty"`
4181	// ReplyMarkup inline keyboard attached to the message
4182	//
4183	// optional
4184	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4185	// InputMessageContent content of the message to be sent instead of the audio
4186	//
4187	// optional
4188	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4189}
4190
4191// InlineQueryResultContact is an inline query response contact.
4192type InlineQueryResultContact struct {
4193	Type                string                `json:"type"`         // required
4194	ID                  string                `json:"id"`           // required
4195	PhoneNumber         string                `json:"phone_number"` // required
4196	FirstName           string                `json:"first_name"`   // required
4197	LastName            string                `json:"last_name"`
4198	VCard               string                `json:"vcard"`
4199	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4200	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
4201	ThumbURL            string                `json:"thumbnail_url"`
4202	ThumbWidth          int                   `json:"thumbnail_width"`
4203	ThumbHeight         int                   `json:"thumbnail_height"`
4204}
4205
4206// InlineQueryResultGame is an inline query response game.
4207type InlineQueryResultGame struct {
4208	// Type of the result, must be game
4209	Type string `json:"type"`
4210	// ID unique identifier for this result, 1-64 bytes
4211	ID string `json:"id"`
4212	// GameShortName short name of the game
4213	GameShortName string `json:"game_short_name"`
4214	// ReplyMarkup inline keyboard attached to the message
4215	//
4216	// optional
4217	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4218}
4219
4220// InlineQueryResultDocument is an inline query response document.
4221type InlineQueryResultDocument struct {
4222	// Type of the result, must be a document
4223	Type string `json:"type"`
4224	// ID unique identifier for this result, 1-64 bytes
4225	ID string `json:"id"`
4226	// Title for the result
4227	Title string `json:"title"`
4228	// Caption of the document to be sent, 0-1024 characters after entities parsing
4229	//
4230	// optional
4231	Caption string `json:"caption,omitempty"`
4232	// URL a valid url for the file
4233	URL string `json:"document_url"`
4234	// MimeType of the content of the file, either “application/pdf” or “application/zip”
4235	MimeType string `json:"mime_type"`
4236	// Description short description of the result
4237	//
4238	// optional
4239	Description string `json:"description,omitempty"`
4240	// ReplyMarkup inline keyboard attached to the message
4241	//
4242	// optional
4243	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4244	// InputMessageContent content of the message to be sent instead of the file
4245	//
4246	// optional
4247	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4248	// ThumbURL url of the thumbnail (jpeg only) for the file
4249	//
4250	// optional
4251	ThumbURL string `json:"thumbnail_url,omitempty"`
4252	// ThumbWidth thumbnail width
4253	//
4254	// optional
4255	ThumbWidth int `json:"thumbnail_width,omitempty"`
4256	// ThumbHeight thumbnail height
4257	//
4258	// optional
4259	ThumbHeight int `json:"thumbnail_height,omitempty"`
4260}
4261
4262// InlineQueryResultGIF is an inline query response GIF.
4263type InlineQueryResultGIF struct {
4264	// Type of the result, must be gif.
4265	Type string `json:"type"`
4266	// ID unique identifier for this result, 1-64 bytes.
4267	ID string `json:"id"`
4268	// URL a valid URL for the GIF file. File size must not exceed 1MB.
4269	URL string `json:"gif_url"`
4270	// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
4271	ThumbURL string `json:"thumbnail_url"`
4272	// MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”
4273	ThumbMimeType string `json:"thumbnail_mime_type,omitempty"`
4274	// Width of the GIF
4275	//
4276	// optional
4277	Width int `json:"gif_width,omitempty"`
4278	// Height of the GIF
4279	//
4280	// optional
4281	Height int `json:"gif_height,omitempty"`
4282	// Duration of the GIF
4283	//
4284	// optional
4285	Duration int `json:"gif_duration,omitempty"`
4286	// Title for the result
4287	//
4288	// optional
4289	Title string `json:"title,omitempty"`
4290	// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
4291	//
4292	// optional
4293	Caption string `json:"caption,omitempty"`
4294	// ParseMode mode for parsing entities in the video caption.
4295	// See formatting options for more details
4296	// (https://core.telegram.org/bots/api#formatting-options).
4297	//
4298	// optional
4299	ParseMode string `json:"parse_mode,omitempty"`
4300	// CaptionEntities is a list of special entities that appear in the caption,
4301	// which can be specified instead of parse_mode
4302	//
4303	// optional
4304	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
4305	// Pass True, if the caption must be shown above the message media
4306	//
4307	// optional
4308	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
4309	// ReplyMarkup inline keyboard attached to the message
4310	//
4311	// optional
4312	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4313	// InputMessageContent content of the message to be sent instead of the GIF animation.
4314	//
4315	// optional
4316	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4317}
4318
4319// InlineQueryResultLocation is an inline query response location.
4320type InlineQueryResultLocation struct {
4321	// Type of the result, must be location
4322	Type string `json:"type"`
4323	// ID unique identifier for this result, 1-64 Bytes
4324	ID string `json:"id"`
4325	// Latitude  of the location in degrees
4326	Latitude float64 `json:"latitude"`
4327	// Longitude of the location in degrees
4328	Longitude float64 `json:"longitude"`
4329	// Title of the location
4330	Title string `json:"title"`
4331	// HorizontalAccuracy is the radius of uncertainty for the location,
4332	// measured in meters; 0-1500
4333	//
4334	// optional
4335	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
4336	// LivePeriod is the period in seconds for which the location can be
4337	// updated, should be between 60 and 86400.
4338	//
4339	// optional
4340	LivePeriod int `json:"live_period,omitempty"`
4341	// Heading is for live locations, a direction in which the user is moving,
4342	// in degrees. Must be between 1 and 360 if specified.
4343	//
4344	// optional
4345	Heading int `json:"heading,omitempty"`
4346	// ProximityAlertRadius is for live locations, a maximum distance for
4347	// proximity alerts about approaching another chat member, in meters. Must
4348	// be between 1 and 100000 if specified.
4349	//
4350	// optional
4351	ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
4352	// ReplyMarkup inline keyboard attached to the message
4353	//
4354	// optional
4355	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4356	// InputMessageContent content of the message to be sent instead of the location
4357	//
4358	// optional
4359	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4360	// ThumbURL url of the thumbnail for the result
4361	//
4362	// optional
4363	ThumbURL string `json:"thumbnail_url,omitempty"`
4364	// ThumbWidth thumbnail width
4365	//
4366	// optional
4367	ThumbWidth int `json:"thumbnail_width,omitempty"`
4368	// ThumbHeight thumbnail height
4369	//
4370	// optional
4371	ThumbHeight int `json:"thumbnail_height,omitempty"`
4372}
4373
4374// InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.
4375type InlineQueryResultMPEG4GIF struct {
4376	// Type of the result, must be mpeg4_gif
4377	Type string `json:"type"`
4378	// ID unique identifier for this result, 1-64 bytes
4379	ID string `json:"id"`
4380	// URL a valid URL for the MP4 file. File size must not exceed 1MB
4381	URL string `json:"mpeg4_url"`
4382	// Width video width
4383	//
4384	// optional
4385	Width int `json:"mpeg4_width,omitempty"`
4386	// Height vVideo height
4387	//
4388	// optional
4389	Height int `json:"mpeg4_height,omitempty"`
4390	// Duration video duration
4391	//
4392	// optional
4393	Duration int `json:"mpeg4_duration,omitempty"`
4394	// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
4395	ThumbURL string `json:"thumbnail_url"`
4396	// MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”
4397	ThumbMimeType string `json:"thumbnail_mime_type,omitempty"`
4398	// Title for the result
4399	//
4400	// optional
4401	Title string `json:"title,omitempty"`
4402	// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
4403	//
4404	// optional
4405	Caption string `json:"caption,omitempty"`
4406	// ParseMode mode for parsing entities in the video caption.
4407	// See formatting options for more details
4408	// (https://core.telegram.org/bots/api#formatting-options).
4409	//
4410	// optional
4411	ParseMode string `json:"parse_mode,omitempty"`
4412	// CaptionEntities is a list of special entities that appear in the caption,
4413	// which can be specified instead of parse_mode
4414	//
4415	// optional
4416	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
4417	// Pass True, if the caption must be shown above the message media
4418	//
4419	// optional
4420	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
4421	// ReplyMarkup inline keyboard attached to the message
4422	//
4423	// optional
4424	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4425	// InputMessageContent content of the message to be sent instead of the video animation
4426	//
4427	// optional
4428	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4429}
4430
4431// InlineQueryResultPhoto is an inline query response photo.
4432type InlineQueryResultPhoto struct {
4433	// Type of the result, must be article.
4434	Type string `json:"type"`
4435	// ID unique identifier for this result, 1-64 Bytes.
4436	ID string `json:"id"`
4437	// URL a valid URL of the photo. Photo must be in jpeg format.
4438	// Photo size must not exceed 5MB.
4439	URL string `json:"photo_url"`
4440	// MimeType
4441	MimeType string `json:"mime_type"`
4442	// Width of the photo
4443	//
4444	// optional
4445	Width int `json:"photo_width,omitempty"`
4446	// Height of the photo
4447	//
4448	// optional
4449	Height int `json:"photo_height,omitempty"`
4450	// ThumbURL url of the thumbnail for the photo.
4451	//
4452	// optional
4453	ThumbURL string `json:"thumbnail_url,omitempty"`
4454	// Title for the result
4455	//
4456	// optional
4457	Title string `json:"title,omitempty"`
4458	// Description short description of the result
4459	//
4460	// optional
4461	Description string `json:"description,omitempty"`
4462	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
4463	//
4464	// optional
4465	Caption string `json:"caption,omitempty"`
4466	// ParseMode mode for parsing entities in the photo caption.
4467	// See formatting options for more details
4468	// (https://core.telegram.org/bots/api#formatting-options).
4469	//
4470	// optional
4471	ParseMode string `json:"parse_mode,omitempty"`
4472	// ReplyMarkup inline keyboard attached to the message.
4473	//
4474	// optional
4475	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4476	// CaptionEntities is a list of special entities that appear in the caption,
4477	// which can be specified instead of parse_mode
4478	//
4479	// optional
4480	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
4481	// Pass True, if the caption must be shown above the message media
4482	//
4483	// optional
4484	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
4485	// InputMessageContent content of the message to be sent instead of the photo.
4486	//
4487	// optional
4488	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4489}
4490
4491// InlineQueryResultVenue is an inline query response venue.
4492type InlineQueryResultVenue struct {
4493	// Type of the result, must be venue
4494	Type string `json:"type"`
4495	// ID unique identifier for this result, 1-64 Bytes
4496	ID string `json:"id"`
4497	// Latitude of the venue location in degrees
4498	Latitude float64 `json:"latitude"`
4499	// Longitude of the venue location in degrees
4500	Longitude float64 `json:"longitude"`
4501	// Title of the venue
4502	Title string `json:"title"`
4503	// Address of the venue
4504	Address string `json:"address"`
4505	// FoursquareID foursquare identifier of the venue if known
4506	//
4507	// optional
4508	FoursquareID string `json:"foursquare_id,omitempty"`
4509	// FoursquareType foursquare type of the venue, if known.
4510	// (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
4511	//
4512	// optional
4513	FoursquareType string `json:"foursquare_type,omitempty"`
4514	// GooglePlaceID is the Google Places identifier of the venue
4515	//
4516	// optional
4517	GooglePlaceID string `json:"google_place_id,omitempty"`
4518	// GooglePlaceType is the Google Places type of the venue
4519	//
4520	// optional
4521	GooglePlaceType string `json:"google_place_type,omitempty"`
4522	// ReplyMarkup inline keyboard attached to the message
4523	//
4524	// optional
4525	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4526	// InputMessageContent content of the message to be sent instead of the venue
4527	//
4528	// optional
4529	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4530	// ThumbURL url of the thumbnail for the result
4531	//
4532	// optional
4533	ThumbURL string `json:"thumbnail_url,omitempty"`
4534	// ThumbWidth thumbnail width
4535	//
4536	// optional
4537	ThumbWidth int `json:"thumbnail_width,omitempty"`
4538	// ThumbHeight thumbnail height
4539	//
4540	// optional
4541	ThumbHeight int `json:"thumbnail_height,omitempty"`
4542}
4543
4544// InlineQueryResultVideo is an inline query response video.
4545type InlineQueryResultVideo struct {
4546	// Type of the result, must be video
4547	Type string `json:"type"`
4548	// ID unique identifier for this result, 1-64 bytes
4549	ID string `json:"id"`
4550	// URL a valid url for the embedded video player or video file
4551	URL string `json:"video_url"`
4552	// MimeType of the content of video url, “text/html” or “video/mp4”
4553	MimeType string `json:"mime_type"`
4554	//
4555	// ThumbURL url of the thumbnail (jpeg only) for the video
4556	// optional
4557	ThumbURL string `json:"thumbnail_url,omitempty"`
4558	// Title for the result
4559	Title string `json:"title"`
4560	// Caption of the video to be sent, 0-1024 characters after entities parsing
4561	//
4562	// optional
4563	Caption string `json:"caption,omitempty"`
4564	// CaptionEntities is a list of special entities that appear in the caption,
4565	// which can be specified instead of parse_mode
4566	//
4567	// optional
4568	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
4569	// Pass True, if the caption must be shown above the message media
4570	//
4571	// optional
4572	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
4573	// ParseMode mode for parsing entities in the video caption.
4574	// See formatting options for more details
4575	// (https://core.telegram.org/bots/api#formatting-options).
4576	//
4577	// optional
4578	ParseMode string `json:"parse_mode,omitempty"`
4579	// Width video width
4580	//
4581	// optional
4582	Width int `json:"video_width,omitempty"`
4583	// Height video height
4584	//
4585	// optional
4586	Height int `json:"video_height,omitempty"`
4587	// Duration video duration in seconds
4588	//
4589	// optional
4590	Duration int `json:"video_duration,omitempty"`
4591	// Description short description of the result
4592	//
4593	// optional
4594	Description string `json:"description,omitempty"`
4595	// ReplyMarkup inline keyboard attached to the message
4596	//
4597	// optional
4598	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4599	// InputMessageContent content of the message to be sent instead of the video.
4600	// This field is required if InlineQueryResultVideo is used to send
4601	// an HTML-page as a result (e.g., a YouTube video).
4602	//
4603	// optional
4604	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4605}
4606
4607// InlineQueryResultVoice is an inline query response voice.
4608type InlineQueryResultVoice struct {
4609	// Type of the result, must be voice
4610	Type string `json:"type"`
4611	// ID unique identifier for this result, 1-64 bytes
4612	ID string `json:"id"`
4613	// URL a valid URL for the voice recording
4614	URL string `json:"voice_url"`
4615	// Title recording title
4616	Title string `json:"title"`
4617	// Caption 0-1024 characters after entities parsing
4618	//
4619	// optional
4620	Caption string `json:"caption,omitempty"`
4621	// ParseMode mode for parsing entities in the voice caption.
4622	// See formatting options for more details
4623	// (https://core.telegram.org/bots/api#formatting-options).
4624	//
4625	// optional
4626	ParseMode string `json:"parse_mode,omitempty"`
4627	// CaptionEntities is a list of special entities that appear in the caption,
4628	// which can be specified instead of parse_mode
4629	//
4630	// optional
4631	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
4632	// Duration recording duration in seconds
4633	//
4634	// optional
4635	Duration int `json:"voice_duration,omitempty"`
4636	// ReplyMarkup inline keyboard attached to the message
4637	//
4638	// optional
4639	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
4640	// InputMessageContent content of the message to be sent instead of the voice recording
4641	//
4642	// optional
4643	InputMessageContent interface{} `json:"input_message_content,omitempty"`
4644}
4645
4646// ChosenInlineResult is an inline query result chosen by a User
4647type ChosenInlineResult struct {
4648	// ResultID the unique identifier for the result that was chosen
4649	ResultID string `json:"result_id"`
4650	// From the user that chose the result
4651	From *User `json:"from"`
4652	// Location sender location, only for bots that require user location
4653	//
4654	// optional
4655	Location *Location `json:"location,omitempty"`
4656	// InlineMessageID identifier of the sent inline message.
4657	// Available only if there is an inline keyboard attached to the message.
4658	// Will be also received in callback queries and can be used to edit the message.
4659	//
4660	// optional
4661	InlineMessageID string `json:"inline_message_id,omitempty"`
4662	// Query the query that was used to obtain the result
4663	Query string `json:"query"`
4664}
4665
4666// SentWebAppMessage contains information about an inline message sent by a Web App
4667// on behalf of a user.
4668type SentWebAppMessage struct {
4669	// Identifier of the sent inline message. Available only if there is an inline
4670	// keyboard attached to the message.
4671	//
4672	// optional
4673	InlineMessageID string `json:"inline_message_id,omitempty"`
4674}
4675
4676// InputTextMessageContent contains text for displaying
4677// as an inline query result.
4678type InputTextMessageContent struct {
4679	// Text of the message to be sent, 1-4096 characters
4680	Text string `json:"message_text"`
4681	// ParseMode mode for parsing entities in the message text.
4682	// See formatting options for more details
4683	// (https://core.telegram.org/bots/api#formatting-options).
4684	//
4685	// optional
4686	ParseMode string `json:"parse_mode,omitempty"`
4687	// Entities is a list of special entities that appear in message text, which
4688	// can be specified instead of parse_mode
4689	//
4690	// optional
4691	Entities []MessageEntity `json:"entities,omitempty"`
4692	// LinkPreviewOptions used for link preview generation for the original message
4693	//
4694	// Optional
4695	LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
4696}
4697
4698// InputLocationMessageContent contains a location for displaying
4699// as an inline query result.
4700type InputLocationMessageContent struct {
4701	// Latitude of the location in degrees
4702	Latitude float64 `json:"latitude"`
4703	// Longitude of the location in degrees
4704	Longitude float64 `json:"longitude"`
4705	// HorizontalAccuracy is the radius of uncertainty for the location,
4706	// measured in meters; 0-1500
4707	//
4708	// optional
4709	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
4710	// LivePeriod is the period in seconds for which the location can be
4711	// updated, should be between 60 and 86400
4712	//
4713	// optional
4714	LivePeriod int `json:"live_period,omitempty"`
4715	// Heading is for live locations, a direction in which the user is moving,
4716	// in degrees. Must be between 1 and 360 if specified.
4717	//
4718	// optional
4719	Heading int `json:"heading,omitempty"`
4720	// ProximityAlertRadius is for live locations, a maximum distance for
4721	// proximity alerts about approaching another chat member, in meters. Must
4722	// be between 1 and 100000 if specified.
4723	//
4724	// optional
4725	ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
4726}
4727
4728// InputVenueMessageContent contains a venue for displaying
4729// as an inline query result.
4730type InputVenueMessageContent struct {
4731	// Latitude of the venue in degrees
4732	Latitude float64 `json:"latitude"`
4733	// Longitude of the venue in degrees
4734	Longitude float64 `json:"longitude"`
4735	// Title name of the venue
4736	Title string `json:"title"`
4737	// Address of the venue
4738	Address string `json:"address"`
4739	// FoursquareID foursquare identifier of the venue, if known
4740	//
4741	// optional
4742	FoursquareID string `json:"foursquare_id,omitempty"`
4743	// FoursquareType Foursquare type of the venue, if known
4744	//
4745	// optional
4746	FoursquareType string `json:"foursquare_type,omitempty"`
4747	// GooglePlaceID is the Google Places identifier of the venue
4748	//
4749	// optional
4750	GooglePlaceID string `json:"google_place_id,omitempty"`
4751	// GooglePlaceType is the Google Places type of the venue
4752	//
4753	// optional
4754	GooglePlaceType string `json:"google_place_type,omitempty"`
4755}
4756
4757// InputContactMessageContent contains a contact for displaying
4758// as an inline query result.
4759type InputContactMessageContent struct {
4760	// 	PhoneNumber contact's phone number
4761	PhoneNumber string `json:"phone_number"`
4762	// FirstName contact's first name
4763	FirstName string `json:"first_name"`
4764	// LastName contact's last name
4765	//
4766	// optional
4767	LastName string `json:"last_name,omitempty"`
4768	// Additional data about the contact in the form of a vCard
4769	//
4770	// optional
4771	VCard string `json:"vcard,omitempty"`
4772}
4773
4774// InputInvoiceMessageContent represents the content of an invoice message to be
4775// sent as the result of an inline query.
4776type InputInvoiceMessageContent struct {
4777	// Product name, 1-32 characters
4778	Title string `json:"title"`
4779	// Product description, 1-255 characters
4780	Description string `json:"description"`
4781	// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to
4782	// the user, use for your internal processes.
4783	Payload string `json:"payload"`
4784	// Payment provider token, obtained via Botfather. Pass an empty string for payments in Telegram Stars.
4785	//
4786	// optional
4787	ProviderToken string `json:"provider_token"`
4788	// Three-letter ISO 4217 currency code. Pass “XTR” for payments in Telegram Stars.
4789	Currency string `json:"currency"`
4790	// Price breakdown, a JSON-serialized list of components (e.g. product
4791	// price, tax, discount, delivery cost, delivery tax, bonus, etc.)
4792	Prices []LabeledPrice `json:"prices"`
4793	// The maximum accepted amount for tips in the smallest units of the
4794	// currency (integer, not float/double).
4795	//
4796	// optional
4797	MaxTipAmount int `json:"max_tip_amount,omitempty"`
4798	// An array of suggested amounts of tip in the smallest units of the
4799	// currency (integer, not float/double). At most 4 suggested tip amounts can
4800	// be specified. The suggested tip amounts must be positive, passed in a
4801	// strictly increased order and must not exceed max_tip_amount.
4802	//
4803	// optional
4804	SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitempty"`
4805	// A JSON-serialized object for data about the invoice, which will be shared
4806	// with the payment provider. A detailed description of the required fields
4807	// should be provided by the payment provider.
4808	//
4809	// optional
4810	ProviderData string `json:"provider_data,omitempty"`
4811	// URL of the product photo for the invoice. Can be a photo of the goods or
4812	// a marketing image for a service. People like it better when they see what
4813	// they are paying for.
4814	//
4815	// optional
4816	PhotoURL string `json:"photo_url,omitempty"`
4817	// Photo size
4818	//
4819	// optional
4820	PhotoSize int `json:"photo_size,omitempty"`
4821	// Photo width
4822	//
4823	// optional
4824	PhotoWidth int `json:"photo_width,omitempty"`
4825	// Photo height
4826	//
4827	// optional
4828	PhotoHeight int `json:"photo_height,omitempty"`
4829	// Pass True, if you require the user's full name to complete the order
4830	//
4831	// optional
4832	NeedName bool `json:"need_name,omitempty"`
4833	// Pass True, if you require the user's phone number to complete the order
4834	//
4835	// optional
4836	NeedPhoneNumber bool `json:"need_phone_number,omitempty"`
4837	// Pass True, if you require the user's email address to complete the order
4838	//
4839	// optional
4840	NeedEmail bool `json:"need_email,omitempty"`
4841	// Pass True, if you require the user's shipping address to complete the order
4842	//
4843	// optional
4844	NeedShippingAddress bool `json:"need_shipping_address,omitempty"`
4845	// Pass True, if user's phone number should be sent to provider
4846	//
4847	// optional
4848	SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"`
4849	// Pass True, if user's email address should be sent to provider
4850	//
4851	// optional
4852	SendEmailToProvider bool `json:"send_email_to_provider,omitempty"`
4853	// Pass True, if the final price depends on the shipping method
4854	//
4855	// optional
4856	IsFlexible bool `json:"is_flexible,omitempty"`
4857}
4858
4859// LabeledPrice represents a portion of the price for goods or services.
4860type LabeledPrice struct {
4861	// Label portion label
4862	Label string `json:"label"`
4863	// Amount price of the product in the smallest units of the currency (integer, not float/double).
4864	// For example, for a price of US$ 1.45 pass amount = 145.
4865	// See the exp parameter in currencies.json
4866	// (https://core.telegram.org/bots/payments/currencies.json),
4867	// it shows the number of digits past the decimal point
4868	// for each currency (2 for the majority of currencies).
4869	Amount int `json:"amount"`
4870}
4871
4872// Invoice contains basic information about an invoice.
4873type Invoice struct {
4874	// Title product name
4875	Title string `json:"title"`
4876	// Description product description
4877	Description string `json:"description"`
4878	// StartParameter unique bot deep-linking parameter that can be used to generate this invoice
4879	StartParameter string `json:"start_parameter"`
4880	// Currency three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars
4881	// (see https://core.telegram.org/bots/payments#supported-currencies)
4882	Currency string `json:"currency"`
4883	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
4884	// For example, for a price of US$ 1.45 pass amount = 145.
4885	// See the exp parameter in currencies.json
4886	// (https://core.telegram.org/bots/payments/currencies.json),
4887	// it shows the number of digits past the decimal point
4888	// for each currency (2 for the majority of currencies).
4889	TotalAmount int `json:"total_amount"`
4890}
4891
4892// ShippingAddress represents a shipping address.
4893type ShippingAddress struct {
4894	// CountryCode ISO 3166-1 alpha-2 country code
4895	CountryCode string `json:"country_code"`
4896	// State if applicable
4897	State string `json:"state"`
4898	// City city
4899	City string `json:"city"`
4900	// StreetLine1 first line for the address
4901	StreetLine1 string `json:"street_line1"`
4902	// StreetLine2 second line for the address
4903	StreetLine2 string `json:"street_line2"`
4904	// PostCode address post code
4905	PostCode string `json:"post_code"`
4906}
4907
4908// OrderInfo represents information about an order.
4909type OrderInfo struct {
4910	// Name user name
4911	//
4912	// optional
4913	Name string `json:"name,omitempty"`
4914	// PhoneNumber user's phone number
4915	//
4916	// optional
4917	PhoneNumber string `json:"phone_number,omitempty"`
4918	// Email user email
4919	//
4920	// optional
4921	Email string `json:"email,omitempty"`
4922	// ShippingAddress user shipping address
4923	//
4924	// optional
4925	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
4926}
4927
4928// ShippingOption represents one shipping option.
4929type ShippingOption struct {
4930	// ID shipping option identifier
4931	ID string `json:"id"`
4932	// Title option title
4933	Title string `json:"title"`
4934	// Prices list of price portions
4935	Prices []LabeledPrice `json:"prices"`
4936}
4937
4938// SuccessfulPayment contains basic information about a successful payment.
4939type SuccessfulPayment struct {
4940	// Currency three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars
4941	// (see https://core.telegram.org/bots/payments#supported-currencies)
4942	Currency string `json:"currency"`
4943	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
4944	// For example, for a price of US$ 1.45 pass amount = 145.
4945	// See the exp parameter in currencies.json,
4946	// (https://core.telegram.org/bots/payments/currencies.json)
4947	// it shows the number of digits past the decimal point
4948	// for each currency (2 for the majority of currencies).
4949	TotalAmount int `json:"total_amount"`
4950	// InvoicePayload bot specified invoice payload
4951	InvoicePayload string `json:"invoice_payload"`
4952	// ShippingOptionID identifier of the shipping option chosen by the user
4953	//
4954	// optional
4955	ShippingOptionID string `json:"shipping_option_id,omitempty"`
4956	// OrderInfo order info provided by the user
4957	//
4958	// optional
4959	OrderInfo *OrderInfo `json:"order_info,omitempty"`
4960	// TelegramPaymentChargeID telegram payment identifier
4961	TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
4962	// ProviderPaymentChargeID provider payment identifier
4963	ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
4964}
4965
4966// RefundPayment contains basic information about a refunded payment.
4967type RefundedPayment struct {
4968	// Three-letter ISO 4217 currency code (https://core.telegram.org/bots/payments#supported-currencies),
4969	// or “XTR” for payments in Telegram Stars.
4970	// Currently, always “XTR”
4971	Currency string `json:"currency"`
4972	// Total refunded price in the smallest units of the currency (integer, not float/double).
4973	// For example, for a price of US$ 1.45, total_amount = 145.
4974	// See the exp parameter in https://core.telegram.org/bots/payments/currencies.json,
4975	// it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
4976	TotalAmount int64 `json:"total_amount"`
4977	// Bot-specified invoice payload
4978	InvoicePayload string `json:"invoice_payload"`
4979	// Telegram payment identifier
4980	TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
4981	// Provider payment identifier
4982	//
4983	// optional
4984	ProviderPaymentChargeID string `json:"provider_payment_charge_id,omitempty"`
4985}
4986
4987// ShippingQuery contains information about an incoming shipping query.
4988type ShippingQuery struct {
4989	// ID unique query identifier
4990	ID string `json:"id"`
4991	// From user who sent the query
4992	From *User `json:"from"`
4993	// InvoicePayload bot specified invoice payload
4994	InvoicePayload string `json:"invoice_payload"`
4995	// ShippingAddress user specified shipping address
4996	ShippingAddress *ShippingAddress `json:"shipping_address"`
4997}
4998
4999// PreCheckoutQuery contains information about an incoming pre-checkout query.
5000type PreCheckoutQuery struct {
5001	// ID unique query identifier
5002	ID string `json:"id"`
5003	// From user who sent the query
5004	From *User `json:"from"`
5005	// Currency three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars
5006	//	// (see https://core.telegram.org/bots/payments#supported-currencies)
5007	Currency string `json:"currency"`
5008	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
5009	//	// For example, for a price of US$ 1.45 pass amount = 145.
5010	//	// See the exp parameter in currencies.json,
5011	//	// (https://core.telegram.org/bots/payments/currencies.json)
5012	//	// it shows the number of digits past the decimal point
5013	//	// for each currency (2 for the majority of currencies).
5014	TotalAmount int `json:"total_amount"`
5015	// InvoicePayload bot specified invoice payload
5016	InvoicePayload string `json:"invoice_payload"`
5017	// ShippingOptionID identifier of the shipping option chosen by the user
5018	//
5019	// optional
5020	ShippingOptionID string `json:"shipping_option_id,omitempty"`
5021	// OrderInfo order info provided by the user
5022	//
5023	// optional
5024	OrderInfo *OrderInfo `json:"order_info,omitempty"`
5025}
5026
5027// RevenueWithdrawalState describes the state of a revenue withdrawal operation.
5028// Currently, it can be one of
5029//   - RevenueWithdrawalStatePending
5030//   - RevenueWithdrawalStateSucceeded
5031//   - RevenueWithdrawalStateFailed
5032type RevenueWithdrawalState struct {
5033	// Type of the state. Must be one of:
5034	// 	- pending
5035	// 	- succeeded
5036	//  - failed
5037	Type string `json:"type"`
5038	// 	Date the withdrawal was completed in Unix time. Represents only in “succeeded” state
5039	Date int64 `json:"date,omitempty"`
5040	// An HTTPS URL that can be used to see transaction details.
5041	// Represents only in “succeeded” state
5042	URL string `json:"url,omitempty"`
5043}
5044
5045// TransactionPartner describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of
5046//   - TransactionPartnerFragment
5047//   - TransactionPartnerUser
5048//   - TransactionPartnerOther
5049//   - TransactionPartnerTelegramAds
5050type TransactionPartner struct {
5051	//Type of the transaction partner. Must be one of:
5052	//	- fragment
5053	//	- user
5054	//  - other
5055	//  - telegram_ads
5056	Type string `json:"type"`
5057	// State of the transaction if the transaction is outgoing.
5058	// Represent only in "fragment" state
5059	//
5060	// optional
5061	WithdrawalState *RevenueWithdrawalState `json:"withdrawal_state,omitempty"`
5062	// Information about the user.
5063	// Represent only in "user" state
5064	User *User `json:"user,omitempty"`
5065	// TransactionPartnerUser only.
5066	// Bot-specified invoice payload
5067	//
5068	// optional
5069	InvoicePayload string `json:"invoice_payload,omitempty"`
5070}
5071
5072// StarTransaction describes a Telegram Star transaction.
5073type StarTransaction struct {
5074	// Unique identifier of the transaction.
5075	// Coincides with the identifer of the original transaction for refund transactions.
5076	// Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users.
5077	ID string `json:"id"`
5078	// Number of Telegram Stars transferred by the transaction
5079	Amount int64 `json:"amount"`
5080	// Date the transaction was created in Unix time
5081	Date int64 `json:"date"`
5082	// Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal).
5083	// Only for incoming transactions
5084	//
5085	// optional
5086	Source *TransactionPartner `json:"source,omitempty"`
5087	// Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal).
5088	// Only for outgoing transactions
5089	//
5090	// optional
5091	Reciever *TransactionPartner `json:"reciever,omitempty"`
5092}
5093
5094// StarTransactions contains a list of Telegram Star transactions.
5095type StarTransactions struct {
5096	// The list of transactions
5097	Transactions []StarTransaction `json:"transactions"`
5098}