all repos — telegram-bot-api @ 797f683a71269be25db71133e60c82e96c8e0725

Golang bindings for the Telegram Bot API

types.go (view raw)

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