all repos — telegram-bot-api @ 366879b110471d989da64a46eb02ae12dd618082

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}
 100
 101// UpdatesChannel is the channel for getting updates.
 102type UpdatesChannel <-chan Update
 103
 104// Clear discards all unprocessed incoming updates.
 105func (ch UpdatesChannel) Clear() {
 106	for len(ch) != 0 {
 107		<-ch
 108	}
 109}
 110
 111// User represents a Telegram user or bot.
 112type User struct {
 113	// ID is a unique identifier for this user or bot
 114	ID int `json:"id"`
 115	// IsBot true, if this user is a bot
 116	//
 117	// optional
 118	IsBot bool `json:"is_bot,omitempty"`
 119	// FirstName user's or bot's first name
 120	FirstName string `json:"first_name"`
 121	// LastName user's or bot's last name
 122	//
 123	// optional
 124	LastName string `json:"last_name,omitempty"`
 125	// UserName user's or bot's username
 126	//
 127	// optional
 128	UserName string `json:"username,omitempty"`
 129	// LanguageCode IETF language tag of the user's language
 130	// more info: https://en.wikipedia.org/wiki/IETF_language_tag
 131	//
 132	// optional
 133	LanguageCode string `json:"language_code,omitempty"`
 134	// CanJoinGroups is true, if the bot can be invited to groups.
 135	// Returned only in getMe.
 136	//
 137	// optional
 138	CanJoinGroups bool `json:"can_join_groups,omitempty"`
 139	// CanReadAllGroupMessages is true, if privacy mode is disabled for the bot.
 140	// Returned only in getMe.
 141	//
 142	// optional
 143	CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`
 144	// SupportsInlineQueries is true, if the bot supports inline queries.
 145	// Returned only in getMe.
 146	//
 147	// optional
 148	SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
 149}
 150
 151// String displays a simple text version of a user.
 152//
 153// It is normally a user's username, but falls back to a first/last
 154// name as available.
 155func (u *User) String() string {
 156	if u == nil {
 157		return ""
 158	}
 159	if u.UserName != "" {
 160		return u.UserName
 161	}
 162
 163	name := u.FirstName
 164	if u.LastName != "" {
 165		name += " " + u.LastName
 166	}
 167
 168	return name
 169}
 170
 171// GroupChat is a group chat.
 172type GroupChat struct {
 173	ID    int    `json:"id"`
 174	Title string `json:"title"`
 175}
 176
 177// Chat represents a chat.
 178type Chat struct {
 179	// ID is a unique identifier for this chat
 180	ID int64 `json:"id"`
 181	// Type of chat, can be either “private”, “group”, “supergroup” or “channel”
 182	Type string `json:"type"`
 183	// Title for supergroups, channels and group chats
 184	//
 185	// optional
 186	Title string `json:"title,omitempty"`
 187	// UserName for private chats, supergroups and channels if available
 188	//
 189	// optional
 190	UserName string `json:"username,omitempty"`
 191	// FirstName of the other party in a private chat
 192	//
 193	// optional
 194	FirstName string `json:"first_name,omitempty"`
 195	// LastName of the other party in a private chat
 196	//
 197	// optional
 198	LastName string `json:"last_name,omitempty"`
 199	// Photo is a chat photo
 200	Photo *ChatPhoto `json:"photo"`
 201	// Description for groups, supergroups and channel chats
 202	//
 203	// optional
 204	Description string `json:"description,omitempty"`
 205	// InviteLink is a chat invite link, for groups, supergroups and channel chats.
 206	// Each administrator in a chat generates their own invite links,
 207	// so the bot must first generate the link using exportChatInviteLink
 208	//
 209	// optional
 210	InviteLink string `json:"invite_link,omitempty"`
 211	// PinnedMessage is the pinned message, for groups, supergroups and channels
 212	//
 213	// optional
 214	PinnedMessage *Message `json:"pinned_message,omitempty"`
 215	// Permissions is default chat member permissions, for groups and
 216	// supergroups. Returned only in getChat.
 217	//
 218	// optional
 219	Permissions *ChatPermissions `json:"permissions,omitempty"`
 220	// SlowModeDelay is for supergroups, the minimum allowed delay between
 221	// consecutive messages sent by each unpriviledged user. Returned only in
 222	// getChat.
 223	//
 224	// optional
 225	SlowModeDelay int `json:"slow_mode_delay,omitempty"`
 226	// StickerSetName is for supergroups, name of group sticker set.Returned
 227	// only in getChat.
 228	//
 229	// optional
 230	StickerSetName string `json:"sticker_set_name,omitempty"`
 231	// CanSetStickerSet is true, if the bot can change the group sticker set.
 232	// Returned only in getChat.
 233	//
 234	// optional
 235	CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
 236}
 237
 238// IsPrivate returns if the Chat is a private conversation.
 239func (c Chat) IsPrivate() bool {
 240	return c.Type == "private"
 241}
 242
 243// IsGroup returns if the Chat is a group.
 244func (c Chat) IsGroup() bool {
 245	return c.Type == "group"
 246}
 247
 248// IsSuperGroup returns if the Chat is a supergroup.
 249func (c Chat) IsSuperGroup() bool {
 250	return c.Type == "supergroup"
 251}
 252
 253// IsChannel returns if the Chat is a channel.
 254func (c Chat) IsChannel() bool {
 255	return c.Type == "channel"
 256}
 257
 258// ChatConfig returns a ChatConfig struct for chat related methods.
 259func (c Chat) ChatConfig() ChatConfig {
 260	return ChatConfig{ChatID: c.ID}
 261}
 262
 263// Message represents a message.
 264type Message struct {
 265	// MessageID is a unique message identifier inside this chat
 266	MessageID int `json:"message_id"`
 267	// From is a sender, empty for messages sent to channels;
 268	//
 269	// optional
 270	From *User `json:"from,omitempty"`
 271	// Date of the message was sent in Unix time
 272	Date int `json:"date"`
 273	// Chat is the conversation the message belongs to
 274	Chat *Chat `json:"chat"`
 275	// ForwardFrom for forwarded messages, sender of the original message;
 276	//
 277	// optional
 278	ForwardFrom *User `json:"forward_from,omitempty"`
 279	// ForwardFromChat for messages forwarded from channels,
 280	// information about the original channel;
 281	//
 282	// optional
 283	ForwardFromChat *Chat `json:"forward_from_chat,omitempty"`
 284	// ForwardFromMessageID for messages forwarded from channels,
 285	// identifier of the original message in the channel;
 286	//
 287	// optional
 288	ForwardFromMessageID int `json:"forward_from_message_id,omitempty"`
 289	// ForwardSignature for messages forwarded from channels, signature of the
 290	// post author if present
 291	//
 292	// optional
 293	ForwardSignature string `json:"forward_signature,omitempty"`
 294	// ForwardSenderName is the sender's name for messages forwarded from users
 295	// who disallow adding a link to their account in forwarded messages
 296	//
 297	// optional
 298	ForwardSenderName string `json:"forward_sender_name,omitempty"`
 299	// ForwardDate for forwarded messages, date the original message was sent in Unix time;
 300	//
 301	// optional
 302	ForwardDate int `json:"forward_date,omitempty"`
 303	// ReplyToMessage for replies, the original message.
 304	// Note that the Message object in this field will not contain further ReplyToMessage fields
 305	// even if it itself is a reply;
 306	//
 307	// optional
 308	ReplyToMessage *Message `json:"reply_to_message,omitempty"`
 309	// ViaBot through which the message was sent;
 310	//
 311	// optional
 312	ViaBot *User `json:"via_bot,omitempty"`
 313	// EditDate of the message was last edited in Unix time;
 314	//
 315	// optional
 316	EditDate int `json:"edit_date,omitempty"`
 317	// MediaGroupID is the unique identifier of a media message group this message belongs to;
 318	//
 319	// optional
 320	MediaGroupID string `json:"media_group_id,omitempty"`
 321	// AuthorSignature is the signature of the post author for messages in channels;
 322	//
 323	// optional
 324	AuthorSignature string `json:"author_signature,omitempty"`
 325	// Text is for text messages, the actual UTF-8 text of the message, 0-4096 characters;
 326	//
 327	// optional
 328	Text string `json:"text,omitempty"`
 329	// Entities is for text messages, special entities like usernames,
 330	// URLs, bot commands, etc. that appear in the text;
 331	//
 332	// optional
 333	Entities []MessageEntity `json:"entities,omitempty"`
 334	// Animation message is an animation, information about the animation.
 335	// For backward compatibility, when this field is set, the document field will also be set;
 336	//
 337	// optional
 338	Animation *Animation `json:"animation,omitempty"`
 339	// Audio message is an audio file, information about the file;
 340	//
 341	// optional
 342	Audio *Audio `json:"audio,omitempty"`
 343	// Document message is a general file, information about the file;
 344	//
 345	// optional
 346	Document *Document `json:"document,omitempty"`
 347	// Photo message is a photo, available sizes of the photo;
 348	//
 349	// optional
 350	Photo []PhotoSize `json:"photo,omitempty"`
 351	// Sticker message is a sticker, information about the sticker;
 352	//
 353	// optional
 354	Sticker *Sticker `json:"sticker,omitempty"`
 355	// Video message is a video, information about the video;
 356	//
 357	// optional
 358	Video *Video `json:"video,omitempty"`
 359	// VideoNote message is a video note, information about the video message;
 360	//
 361	// optional
 362	VideoNote *VideoNote `json:"video_note,omitempty"`
 363	// Voice message is a voice message, information about the file;
 364	//
 365	// optional
 366	Voice *Voice `json:"voice,omitempty"`
 367	// Caption for the animation, audio, document, photo, video or voice, 0-1024 characters;
 368	//
 369	// optional
 370	Caption string `json:"caption,omitempty"`
 371	// CaptionEntities;
 372	//
 373	// optional
 374	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
 375	// Contact message is a shared contact, information about the contact;
 376	//
 377	// optional
 378	Contact *Contact `json:"contact,omitempty"`
 379	// Dice is a dice with random value;
 380	//
 381	// optional
 382	Dice *Dice `json:"dice,omitempty"`
 383	// Game message is a game, information about the game;
 384	//
 385	// optional
 386	Game *Game `json:"game,omitempty"`
 387	// Poll is a native poll, information about the poll;
 388	//
 389	// optional
 390	Poll *Poll `json:"poll,omitempty"`
 391	// Venue message is a venue, information about the venue.
 392	// For backward compatibility, when this field is set, the location field
 393	// will also be set;
 394	//
 395	// optional
 396	Venue *Venue `json:"venue,omitempty"`
 397	// Location message is a shared location, information about the location;
 398	//
 399	// optional
 400	Location *Location `json:"location,omitempty"`
 401	// NewChatMembers that were added to the group or supergroup
 402	// and information about them (the bot itself may be one of these members);
 403	//
 404	// optional
 405	NewChatMembers []User `json:"new_chat_members,omitempty"`
 406	// LeftChatMember is a member was removed from the group,
 407	// information about them (this member may be the bot itself);
 408	//
 409	// optional
 410	LeftChatMember *User `json:"left_chat_member,omitempty"`
 411	// NewChatTitle is a chat title was changed to this value;
 412	//
 413	// optional
 414	NewChatTitle string `json:"new_chat_title,omitempty"`
 415	// NewChatPhoto is a chat photo was change to this value;
 416	//
 417	// optional
 418	NewChatPhoto []PhotoSize `json:"new_chat_photo,omitempty"`
 419	// DeleteChatPhoto is a service message: the chat photo was deleted;
 420	//
 421	// optional
 422	DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"`
 423	// GroupChatCreated is a service message: the group has been created;
 424	//
 425	// optional
 426	GroupChatCreated bool `json:"group_chat_created,omitempty"`
 427	// SuperGroupChatCreated is a service message: the supergroup has been created.
 428	// This field can't be received in a message coming through updates,
 429	// because bot can't be a member of a supergroup when it is created.
 430	// It can only be found in ReplyToMessage if someone replies to a very first message
 431	// in a directly created supergroup;
 432	//
 433	// optional
 434	SuperGroupChatCreated bool `json:"supergroup_chat_created,omitempty"`
 435	// ChannelChatCreated is a service message: the channel has been created.
 436	// This field can't be received in a message coming through updates,
 437	// because bot can't be a member of a channel when it is created.
 438	// It can only be found in ReplyToMessage
 439	// if someone replies to a very first message in a channel;
 440	//
 441	// optional
 442	ChannelChatCreated bool `json:"channel_chat_created,omitempty"`
 443	// MigrateToChatID is the group has been migrated to a supergroup with the specified identifier.
 444	// This number may be greater than 32 bits and some programming languages
 445	// may have difficulty/silent defects in interpreting it.
 446	// But it is smaller than 52 bits, so a signed 64 bit integer
 447	// or double-precision float type are safe for storing this identifier;
 448	//
 449	// optional
 450	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
 451	// MigrateFromChatID is the supergroup has been migrated from a group with the specified identifier.
 452	// This number may be greater than 32 bits and some programming languages
 453	// may have difficulty/silent defects in interpreting it.
 454	// But it is smaller than 52 bits, so a signed 64 bit integer
 455	// or double-precision float type are safe for storing this identifier;
 456	//
 457	// optional
 458	MigrateFromChatID int64 `json:"migrate_from_chat_id,omitempty"`
 459	// PinnedMessage is a specified message was pinned.
 460	// Note that the Message object in this field will not contain further ReplyToMessage
 461	// fields even if it is itself a reply;
 462	//
 463	// optional
 464	PinnedMessage *Message `json:"pinned_message,omitempty"`
 465	// Invoice message is an invoice for a payment;
 466	//
 467	// optional
 468	Invoice *Invoice `json:"invoice,omitempty"`
 469	// SuccessfulPayment message is a service message about a successful payment,
 470	// information about the payment;
 471	//
 472	// optional
 473	SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`
 474	// ConnectedWebsite is Tthe domain name of the website on which the user has
 475	// logged in;
 476	//
 477	// optional
 478	ConnectedWebsite string `json:"connected_website,omitempty"`
 479	// PassportData is a Telegram Passport data;
 480	//
 481	// optional
 482	PassportData *PassportData `json:"passport_data,omitempty"`
 483	// ReplyMarkup is the Inline keyboard attached to the message.
 484	// login_url buttons are represented as ordinary url buttons.
 485	//
 486	// optional
 487	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
 488}
 489
 490// Time converts the message timestamp into a Time.
 491func (m *Message) Time() time.Time {
 492	return time.Unix(int64(m.Date), 0)
 493}
 494
 495// IsCommand returns true if message starts with a "bot_command" entity.
 496func (m *Message) IsCommand() bool {
 497	if m.Entities == nil || len(m.Entities) == 0 {
 498		return false
 499	}
 500
 501	entity := m.Entities[0]
 502	return entity.Offset == 0 && entity.IsCommand()
 503}
 504
 505// Command checks if the message was a command and if it was, returns the
 506// command. If the Message was not a command, it returns an empty string.
 507//
 508// If the command contains the at name syntax, it is removed. Use
 509// CommandWithAt() if you do not want that.
 510func (m *Message) Command() string {
 511	command := m.CommandWithAt()
 512
 513	if i := strings.Index(command, "@"); i != -1 {
 514		command = command[:i]
 515	}
 516
 517	return command
 518}
 519
 520// CommandWithAt checks if the message was a command and if it was, returns the
 521// command. If the Message was not a command, it returns an empty string.
 522//
 523// If the command contains the at name syntax, it is not removed. Use Command()
 524// if you want that.
 525func (m *Message) CommandWithAt() string {
 526	if !m.IsCommand() {
 527		return ""
 528	}
 529
 530	// IsCommand() checks that the message begins with a bot_command entity
 531	entity := m.Entities[0]
 532	return m.Text[1:entity.Length]
 533}
 534
 535// CommandArguments checks if the message was a command and if it was,
 536// returns all text after the command name. If the Message was not a
 537// command, it returns an empty string.
 538//
 539// Note: The first character after the command name is omitted:
 540// - "/foo bar baz" yields "bar baz", not " bar baz"
 541// - "/foo-bar baz" yields "bar baz", too
 542// Even though the latter is not a command conforming to the spec, the API
 543// marks "/foo" as command entity.
 544func (m *Message) CommandArguments() string {
 545	if !m.IsCommand() {
 546		return ""
 547	}
 548
 549	// IsCommand() checks that the message begins with a bot_command entity
 550	entity := m.Entities[0]
 551
 552	if len(m.Text) == entity.Length {
 553		return "" // The command makes up the whole message
 554	}
 555
 556	return m.Text[entity.Length+1:]
 557}
 558
 559// MessageEntity represents one special entity in a text message.
 560type MessageEntity struct {
 561	// Type of the entity.
 562	// Can be:
 563	//  “mention” (@username),
 564	//  “hashtag” (#hashtag),
 565	//  “cashtag” ($USD),
 566	//  “bot_command” (/start@jobs_bot),
 567	//  “url” (https://telegram.org),
 568	//  “email” (do-not-reply@telegram.org),
 569	//  “phone_number” (+1-212-555-0123),
 570	//  “bold” (bold text),
 571	//  “italic” (italic text),
 572	//  “underline” (underlined text),
 573	//  “strikethrough” (strikethrough text),
 574	//  “code” (monowidth string),
 575	//  “pre” (monowidth block),
 576	//  “text_link” (for clickable text URLs),
 577	//  “text_mention” (for users without usernames)
 578	Type string `json:"type"`
 579	// Offset in UTF-16 code units to the start of the entity
 580	Offset int `json:"offset"`
 581	// Length
 582	Length int `json:"length"`
 583	// URL for “text_link” only, url that will be opened after user taps on the text
 584	//
 585	// optional
 586	URL string `json:"url,omitempty"`
 587	// User for “text_mention” only, the mentioned user
 588	//
 589	// optional
 590	User *User `json:"user,omitempty"`
 591	// Language for “pre” only, the programming language of the entity text
 592	//
 593	// optional
 594	Language string `json:"language,omitempty"`
 595}
 596
 597// ParseURL attempts to parse a URL contained within a MessageEntity.
 598func (e MessageEntity) ParseURL() (*url.URL, error) {
 599	if e.URL == "" {
 600		return nil, errors.New(ErrBadURL)
 601	}
 602
 603	return url.Parse(e.URL)
 604}
 605
 606// IsMention returns true if the type of the message entity is "mention" (@username).
 607func (e MessageEntity) IsMention() bool {
 608	return e.Type == "mention"
 609}
 610
 611// IsHashtag returns true if the type of the message entity is "hashtag".
 612func (e MessageEntity) IsHashtag() bool {
 613	return e.Type == "hashtag"
 614}
 615
 616// IsCommand returns true if the type of the message entity is "bot_command".
 617func (e MessageEntity) IsCommand() bool {
 618	return e.Type == "bot_command"
 619}
 620
 621// IsURL returns true if the type of the message entity is "url".
 622func (e MessageEntity) IsURL() bool {
 623	return e.Type == "url"
 624}
 625
 626// IsEmail returns true if the type of the message entity is "email".
 627func (e MessageEntity) IsEmail() bool {
 628	return e.Type == "email"
 629}
 630
 631// IsBold returns true if the type of the message entity is "bold" (bold text).
 632func (e MessageEntity) IsBold() bool {
 633	return e.Type == "bold"
 634}
 635
 636// IsItalic returns true if the type of the message entity is "italic" (italic text).
 637func (e MessageEntity) IsItalic() bool {
 638	return e.Type == "italic"
 639}
 640
 641// IsCode returns true if the type of the message entity is "code" (monowidth string).
 642func (e MessageEntity) IsCode() bool {
 643	return e.Type == "code"
 644}
 645
 646// IsPre returns true if the type of the message entity is "pre" (monowidth block).
 647func (e MessageEntity) IsPre() bool {
 648	return e.Type == "pre"
 649}
 650
 651// IsTextLink returns true if the type of the message entity is "text_link" (clickable text URL).
 652func (e MessageEntity) IsTextLink() bool {
 653	return e.Type == "text_link"
 654}
 655
 656// PhotoSize represents one size of a photo or a file / sticker thumbnail.
 657type PhotoSize struct {
 658	// FileID identifier for this file, which can be used to download or reuse
 659	// the file
 660	FileID string `json:"file_id"`
 661	// FileUniqueID is the unique identifier for this file, which is supposed to
 662	// be the same over time and for different bots. Can't be used to download
 663	// or reuse the file.
 664	FileUniqueID string `json:"file_unique_id"`
 665	// Width photo width
 666	Width int `json:"width"`
 667	// Height photo height
 668	Height int `json:"height"`
 669	// FileSize file size
 670	//
 671	// optional
 672	FileSize int `json:"file_size,omitempty"`
 673}
 674
 675// Animation represents an animation file.
 676type Animation struct {
 677	// FileID odentifier for this file, which can be used to download or reuse
 678	// the file
 679	FileID string `json:"file_id"`
 680	// FileUniqueID is the unique identifier for this file, which is supposed to
 681	// be the same over time and for different bots. Can't be used to download
 682	// or reuse the file.
 683	FileUniqueID string `json:"file_unique_id"`
 684	// Width video width as defined by sender
 685	Width int `json:"width"`
 686	// Height video height as defined by sender
 687	Height int `json:"height"`
 688	// Duration of the video in seconds as defined by sender
 689	Duration int `json:"duration"`
 690	// Thumbnail animation thumbnail as defined by sender
 691	//
 692	// optional
 693	Thumbnail *PhotoSize `json:"thumb,omitempty"`
 694	// FileName original animation filename as defined by sender
 695	//
 696	// optional
 697	FileName string `json:"file_name,omitempty"`
 698	// MimeType of the file as defined by sender
 699	//
 700	// optional
 701	MimeType string `json:"mime_type,omitempty"`
 702	// FileSize file size
 703	//
 704	// optional
 705	FileSize int `json:"file_size,omitempty"`
 706}
 707
 708// Audio represents an audio file to be treated as music by the Telegram clients.
 709type Audio struct {
 710	// FileID is an identifier for this file, which can be used to download or
 711	// reuse the file
 712	FileID string `json:"file_id"`
 713	// FileUniqueID is the unique identifier for this file, which is supposed to
 714	// be the same over time and for different bots. Can't be used to download
 715	// or reuse the file.
 716	FileUniqueID string `json:"file_unique_id"`
 717	// Duration of the audio in seconds as defined by sender
 718	Duration int `json:"duration"`
 719	// Performer of the audio as defined by sender or by audio tags
 720	//
 721	// optional
 722	Performer string `json:"performer,omitempty"`
 723	// Title of the audio as defined by sender or by audio tags
 724	//
 725	// optional
 726	Title string `json:"title,omitempty"`
 727	// MimeType of the file as defined by sender
 728	//
 729	// optional
 730	MimeType string `json:"mime_type,omitempty"`
 731	// FileSize file size
 732	//
 733	// optional
 734	FileSize int `json:"file_size,omitempty"`
 735	// Thumbnail is the album cover to which the music file belongs
 736	//
 737	// optional
 738	Thumbnail *PhotoSize `json:"thumb,omitempty"`
 739}
 740
 741// Document represents a general file.
 742type Document struct {
 743	// FileID is a identifier for this file, which can be used to download or
 744	// reuse the file
 745	FileID string `json:"file_id"`
 746	// FileUniqueID is the unique identifier for this file, which is supposed to
 747	// be the same over time and for different bots. Can't be used to download
 748	// or reuse the file.
 749	FileUniqueID string `json:"file_unique_id"`
 750	// Thumbnail document thumbnail as defined by sender
 751	//
 752	// optional
 753	Thumbnail *PhotoSize `json:"thumb,omitempty"`
 754	// FileName original filename as defined by sender
 755	//
 756	// optional
 757	FileName string `json:"file_name,omitempty"`
 758	// MimeType  of the file as defined by sender
 759	//
 760	// optional
 761	MimeType string `json:"mime_type,omitempty"`
 762	// FileSize file size
 763	//
 764	// optional
 765	FileSize int `json:"file_size,omitempty"`
 766}
 767
 768// Video represents a video file.
 769type Video struct {
 770	// FileID identifier for this file, which can be used to download or reuse
 771	// the file
 772	FileID string `json:"file_id"`
 773	// FileUniqueID is the unique identifier for this file, which is supposed to
 774	// be the same over time and for different bots. Can't be used to download
 775	// or reuse the file.
 776	FileUniqueID string `json:"file_unique_id"`
 777	// Width video width as defined by sender
 778	Width int `json:"width"`
 779	// Height video height as defined by sender
 780	Height int `json:"height"`
 781	// Duration of the video in seconds as defined by sender
 782	Duration int `json:"duration"`
 783	// Thumbnail video thumbnail
 784	//
 785	// optional
 786	Thumbnail *PhotoSize `json:"thumb,omitempty"`
 787	// MimeType of a file as defined by sender
 788	//
 789	// optional
 790	MimeType string `json:"mime_type,omitempty"`
 791	// FileSize file size
 792	//
 793	// optional
 794	FileSize int `json:"file_size,omitempty"`
 795}
 796
 797// VideoNote object represents a video message.
 798type VideoNote struct {
 799	// FileID identifier for this file, which can be used to download or reuse the file
 800	FileID string `json:"file_id"`
 801	// FileUniqueID is the unique identifier for this file, which is supposed to
 802	// be the same over time and for different bots. Can't be used to download
 803	// or reuse the file.
 804	FileUniqueID string `json:"file_unique_id"`
 805	// Length video width and height (diameter of the video message) as defined by sender
 806	Length int `json:"length"`
 807	// Duration of the video in seconds as defined by sender
 808	Duration int `json:"duration"`
 809	// Thumbnail video thumbnail
 810	//
 811	// optional
 812	Thumbnail *PhotoSize `json:"thumb,omitempty"`
 813	// FileSize file size
 814	//
 815	// optional
 816	FileSize int `json:"file_size,omitempty"`
 817}
 818
 819// Voice represents a voice note.
 820type Voice struct {
 821	// FileID identifier for this file, which can be used to download or reuse the file
 822	FileID string `json:"file_id"`
 823	// FileUniqueID is the unique identifier for this file, which is supposed to
 824	// be the same over time and for different bots. Can't be used to download
 825	// or reuse the file.
 826	FileUniqueID string `json:"file_unique_id"`
 827	// Duration of the audio in seconds as defined by sender
 828	Duration int `json:"duration"`
 829	// MimeType of the file as defined by sender
 830	//
 831	// optional
 832	MimeType string `json:"mime_type,omitempty"`
 833	// FileSize file size
 834	//
 835	// optional
 836	FileSize int `json:"file_size,omitempty"`
 837}
 838
 839// Contact represents a phone contact.
 840//
 841// Note that LastName and UserID may be empty.
 842type Contact struct {
 843	// PhoneNumber contact's phone number
 844	PhoneNumber string `json:"phone_number"`
 845	// FirstName contact's first name
 846	FirstName string `json:"first_name"`
 847	// LastName contact's last name
 848	//
 849	// optional
 850	LastName string `json:"last_name,omitempty"`
 851	// UserID contact's user identifier in Telegram
 852	//
 853	// optional
 854	UserID int `json:"user_id,omitempty"`
 855	// VCard is additional data about the contact in the form of a vCard.
 856	//
 857	// optional
 858	VCard string `json:"vcard,omitempty"`
 859}
 860
 861// Dice represents an animated emoji that displays a random value.
 862type Dice struct {
 863	// Emoji on which the dice throw animation is based
 864	Emoji string `json:"emoji"`
 865	// Value of the dice
 866	Value int `json:"value"`
 867}
 868
 869// PollOption contains information about one answer option in a poll.
 870type PollOption struct {
 871	// Text is the option text, 1-100 characters
 872	Text string `json:"text"`
 873	// VoterCount is the number of users that voted for this option
 874	VoterCount int `json:"voter_count"`
 875}
 876
 877// PollAnswer represents an answer of a user in a non-anonymous poll.
 878type PollAnswer struct {
 879	// PollID is the unique poll identifier
 880	PollID string `json:"poll_id"`
 881	// User who changed the answer to the poll
 882	User User `json:"user"`
 883	// OptionIDs is the 0-based identifiers of poll options chosen by the user.
 884	// May be empty if user retracted vote.
 885	OptionIDs []int `json:"option_ids"`
 886}
 887
 888// Poll contains information about a poll.
 889type Poll struct {
 890	// ID is the unique poll identifier
 891	ID string `json:"id"`
 892	// Question is the poll question, 1-255 characters
 893	Question string `json:"question"`
 894	// Options is the list of poll options
 895	Options []PollOption `json:"options"`
 896	// TotalVoterCount is the total numbers of users who voted in the poll
 897	TotalVoterCount int `json:"total_voter_count"`
 898	// IsClosed is if the poll is closed
 899	IsClosed bool `json:"is_closed"`
 900	// IsAnonymous is if the poll is anonymous
 901	IsAnonymous bool `json:"is_anonymous"`
 902	// Type is the poll type, currently can be "regular" or "quiz"
 903	Type string `json:"type"`
 904	// AllowsMultipleAnswers is true, if the poll allows multiple answers
 905	AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
 906	// CorrectOptionID is the 0-based identifier of the correct answer option.
 907	// Available only for polls in quiz mode, which are closed, or was sent (not
 908	// forwarded) by the bot or to the private chat with the bot.
 909	//
 910	// optional
 911	CorrectOptionID int `json:"correct_option_id,omitempty"`
 912	// Explanation is text that is shown when a user chooses an incorrect answer
 913	// or taps on the lamp icon in a quiz-style poll, 0-200 characters
 914	//
 915	// optional
 916	Explanation string `json:"explanation,omitempty"`
 917	// ExplainationEntities are special entities like usernames, URLs, bot
 918	// commands, etc. that appear in the explanation
 919	//
 920	// optional
 921	ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`
 922	// OpenPeriod is the amount of time in seconds the poll will be active
 923	// after creation
 924	//
 925	// optional
 926	OpenPeriod int `json:"open_period,omitempty"`
 927	// Closedate is the point in time (unix timestamp) when the poll will be
 928	// automatically closed
 929	//
 930	// optional
 931	CloseDate int `json:"close_date,omitempty"`
 932}
 933
 934// Location represents a point on the map.
 935type Location struct {
 936	// Longitude as defined by sender
 937	Longitude float64 `json:"longitude"`
 938	// Latitude as defined by sender
 939	Latitude float64 `json:"latitude"`
 940}
 941
 942// Venue represents a venue.
 943type Venue struct {
 944	// Location is the venue location
 945	Location Location `json:"location"`
 946	// Title is the name of the venue
 947	Title string `json:"title"`
 948	// Address of the venue
 949	Address string `json:"address"`
 950	// FoursquareID is the foursquare identifier of the venue
 951	//
 952	// optional
 953	FoursquareID string `json:"foursquare_id,omitempty"`
 954	// FoursquareType is the foursquare type of the venue
 955	//
 956	// optional
 957	FoursquareType string `json:"foursquare_type,omitempty"`
 958}
 959
 960// UserProfilePhotos contains a set of user profile photos.
 961type UserProfilePhotos struct {
 962	// TotalCount total number of profile pictures the target user has
 963	TotalCount int `json:"total_count"`
 964	// Photos requested profile pictures (in up to 4 sizes each)
 965	Photos [][]PhotoSize `json:"photos"`
 966}
 967
 968// File contains information about a file to download from Telegram.
 969type File 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	// FileSize file size, if known
 978	//
 979	// optional
 980	FileSize int `json:"file_size,omitempty"`
 981	// FilePath file path
 982	//
 983	// optional
 984	FilePath string `json:"file_path,omitempty"`
 985}
 986
 987// Link returns a full path to the download URL for a File.
 988//
 989// It requires the Bot token to create the link.
 990func (f *File) Link(token string) string {
 991	return fmt.Sprintf(FileEndpoint, token, f.FilePath)
 992}
 993
 994// ReplyKeyboardMarkup represents a custom keyboard with reply options.
 995type ReplyKeyboardMarkup struct {
 996	// Keyboard is an array of button rows, each represented by an Array of KeyboardButton objects
 997	Keyboard [][]KeyboardButton `json:"keyboard"`
 998	// ResizeKeyboard requests clients to resize the keyboard vertically for optimal fit
 999	// (e.g., make the keyboard smaller if there are just two rows of buttons).
1000	// Defaults to false, in which case the custom keyboard
1001	// is always of the same height as the app's standard keyboard.
1002	//
1003	// optional
1004	ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
1005	// OneTimeKeyboard requests clients to hide the keyboard as soon as it's been used.
1006	// The keyboard will still be available, but clients will automatically display
1007	// the usual letter-keyboard in the chat – the user can press a special button
1008	// in the input field to see the custom keyboard again.
1009	// Defaults to false.
1010	//
1011	// optional
1012	OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
1013	// Selective use this parameter if you want to show the keyboard to specific users only.
1014	// Targets:
1015	//  1) users that are @mentioned in the text of the Message object;
1016	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
1017	//
1018	// Example: A user requests to change the bot's language,
1019	// bot replies to the request with a keyboard to select the new language.
1020	// Other users in the group don't see the keyboard.
1021	//
1022	// optional
1023	Selective bool `json:"selective,omitempty"`
1024}
1025
1026// KeyboardButton represents one button of the reply keyboard. For simple text
1027// buttons String can be used instead of this object to specify text of the
1028// button. Optional fields request_contact, request_location, and request_poll
1029// are mutually exclusive.
1030type KeyboardButton struct {
1031	// Text of the button. If none of the optional fields are used,
1032	// it will be sent as a message when the button is pressed.
1033	Text string `json:"text"`
1034	// RequestContact if True, the user's phone number will be sent
1035	// as a contact when the button is pressed.
1036	// Available in private chats only.
1037	//
1038	// optional
1039	RequestContact bool `json:"request_contact,omitempty"`
1040	// RequestLocation if True, the user's current location will be sent when
1041	// the button is pressed.
1042	// Available in private chats only.
1043	//
1044	// optional
1045	RequestLocation bool `json:"request_location,omitempty"`
1046	// RequestPoll if True, the user will be asked to create a poll and send it
1047	// to the bot when the button is pressed. Available in private chats only
1048	//
1049	// optional
1050	RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
1051}
1052
1053// KeyboardButtonPollType represents type of a poll, which is allowed to
1054// be created and sent when the corresponding button is pressed.
1055type KeyboardButtonPollType struct {
1056	// Type is if quiz is passed, the user will be allowed to create only polls
1057	// in the quiz mode. If regular is passed, only regular polls will be
1058	// allowed. Otherwise, the user will be allowed to create a poll of any type.
1059	Type string `json:"type"`
1060}
1061
1062// ReplyKeyboardRemove Upon receiving a message with this object, Telegram
1063// clients will remove the current custom keyboard and display the default
1064// letter-keyboard. By default, custom keyboards are displayed until a new
1065// keyboard is sent by a bot. An exception is made for one-time keyboards
1066// that are hidden immediately after the user presses a button.
1067type ReplyKeyboardRemove struct {
1068	// RemoveKeyboard requests clients to remove the custom keyboard
1069	// (user will not be able to summon this keyboard;
1070	// if you want to hide the keyboard from sight but keep it accessible,
1071	// use one_time_keyboard in ReplyKeyboardMarkup).
1072	RemoveKeyboard bool `json:"remove_keyboard"`
1073	// Selective use this parameter if you want to remove the keyboard for specific users only.
1074	// Targets:
1075	//  1) users that are @mentioned in the text of the Message object;
1076	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
1077	//
1078	// Example: A user votes in a poll, bot returns confirmation message
1079	// in reply to the vote and removes the keyboard for that user,
1080	// while still showing the keyboard with poll options to users who haven't voted yet.
1081	//
1082	// optional
1083	Selective bool `json:"selective,omitempty"`
1084}
1085
1086// InlineKeyboardMarkup represents an inline keyboard that appears right next to
1087// the message it belongs to.
1088type InlineKeyboardMarkup struct {
1089	// InlineKeyboard array of button rows, each represented by an Array of
1090	// InlineKeyboardButton objects
1091	InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
1092}
1093
1094// InlineKeyboardButton represents one button of an inline keyboard. You must
1095// use exactly one of the optional fields.
1096//
1097// Note that some values are references as even an empty string
1098// will change behavior.
1099//
1100// CallbackGame, if set, MUST be first button in first row.
1101type InlineKeyboardButton struct {
1102	// Text label text on the button
1103	Text string `json:"text"`
1104	// URL HTTP or tg:// url to be opened when button is pressed.
1105	//
1106	// optional
1107	URL *string `json:"url,omitempty"`
1108	// LoginURL is an HTTP URL used to automatically authorize the user. Can be
1109	// used as a replacement for the Telegram Login Widget
1110	//
1111	// optional
1112	LoginURL *LoginURL `json:"login_url,omitempty"`
1113	// CallbackData data to be sent in a callback query to the bot when button is pressed, 1-64 bytes.
1114	//
1115	// optional
1116	CallbackData *string `json:"callback_data,omitempty"`
1117	// SwitchInlineQuery if set, pressing the button will prompt the user to select one of their chats,
1118	// open that chat and insert the bot's username and the specified inline query in the input field.
1119	// Can be empty, in which case just the bot's username will be inserted.
1120	//
1121	// This offers an easy way for users to start using your bot
1122	// in inline mode when they are currently in a private chat with it.
1123	// Especially useful when combined with switch_pm… actions – in this case
1124	// the user will be automatically returned to the chat they switched from,
1125	// skipping the chat selection screen.
1126	//
1127	// optional
1128	SwitchInlineQuery *string `json:"switch_inline_query,omitempty"`
1129	// SwitchInlineQueryCurrentChat if set, pressing the button will insert the bot's username
1130	// and the specified inline query in the current chat's input field.
1131	// Can be empty, in which case only the bot's username will be inserted.
1132	//
1133	// This offers a quick way for the user to open your bot in inline mode
1134	// in the same chat – good for selecting something from multiple options.
1135	//
1136	// optional
1137	SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"`
1138	// CallbackGame description of the game that will be launched when the user presses the button.
1139	//
1140	// optional
1141	CallbackGame *CallbackGame `json:"callback_game,omitempty"`
1142	// Pay specify True, to send a Pay button.
1143	//
1144	// NOTE: This type of button must always be the first button in the first row.
1145	//
1146	// optional
1147	Pay bool `json:"pay,omitempty"`
1148}
1149
1150// LoginURL represents a parameter of the inline keyboard button used to
1151// automatically authorize a user. Serves as a great replacement for the
1152// Telegram Login Widget when the user is coming from Telegram. All the user
1153// needs to do is tap/click a button and confirm that they want to log in.
1154type LoginURL struct {
1155	// URL is an HTTP URL to be opened with user authorization data added to the
1156	// query string when the button is pressed. If the user refuses to provide
1157	// authorization data, the original URL without information about the user
1158	// will be opened. The data added is the same as described in Receiving
1159	// authorization data.
1160	//
1161	// NOTE: You must always check the hash of the received data to verify the
1162	// authentication and the integrity of the data as described in Checking
1163	// authorization.
1164	URL string `json:"url"`
1165	// ForwardText is the new text of the button in forwarded messages
1166	//
1167	// optional
1168	ForwardText string `json:"forward_text,omitempty"`
1169	// BotUsername is the username of a bot, which will be used for user
1170	// authorization. See Setting up a bot for more details. If not specified,
1171	// the current bot's username will be assumed. The url's domain must be the
1172	// same as the domain linked with the bot. See Linking your domain to the
1173	// bot for more details.
1174	//
1175	// optional
1176	BotUsername string `json:"bot_username,omitempty"`
1177	// RequestWriteAccess if true requests permission for your bot to send
1178	// messages to the user
1179	//
1180	// optional
1181	RequestWriteAccess bool `json:"request_write_access,omitempty"`
1182}
1183
1184// CallbackQuery represents an incoming callback query from a callback button in
1185// an inline keyboard. If the button that originated the query was attached to a
1186// message sent by the bot, the field message will be present. If the button was
1187// attached to a message sent via the bot (in inline mode), the field
1188// inline_message_id will be present. Exactly one of the fields data or
1189// game_short_name will be present.
1190type CallbackQuery struct {
1191	// ID unique identifier for this query
1192	ID string `json:"id"`
1193	// From sender
1194	From *User `json:"from"`
1195	// Message with the callback button that originated the query.
1196	// Note that message content and message date will not be available if the
1197	// message is too old.
1198	//
1199	// optional
1200	Message *Message `json:"message,omitempty"`
1201	// InlineMessageID identifier of the message sent via the bot in inline
1202	// mode, that originated the query.
1203	//
1204	// optional
1205	InlineMessageID string `json:"inline_message_id,omitempty"`
1206	// ChatInstance global identifier, uniquely corresponding to the chat to
1207	// which the message with the callback button was sent. Useful for high
1208	// scores in games.
1209	ChatInstance string `json:"chat_instance"`
1210	// Data associated with the callback button. Be aware that
1211	// a bad client can send arbitrary data in this field.
1212	//
1213	// optional
1214	Data string `json:"data,omitempty"`
1215	// GameShortName short name of a Game to be returned, serves as the unique identifier for the game.
1216	//
1217	// optional
1218	GameShortName string `json:"game_short_name,omitempty"`
1219}
1220
1221// ForceReply when receiving a message with this object, Telegram clients will
1222// display a reply interface to the user (act as if the user has selected the
1223// bot's message and tapped 'Reply'). This can be extremely useful if you  want
1224// to create user-friendly step-by-step interfaces without having to sacrifice
1225// privacy mode.
1226type ForceReply struct {
1227	// ForceReply shows reply interface to the user,
1228	// as if they manually selected the bot's message and tapped 'Reply'.
1229	ForceReply bool `json:"force_reply"`
1230	// Selective use this parameter if you want to force reply from specific users only.
1231	// Targets:
1232	//  1) users that are @mentioned in the text of the Message object;
1233	//  2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
1234	//
1235	// optional
1236	Selective bool `json:"selective,omitempty"`
1237}
1238
1239// ChatPhoto represents a chat photo.
1240type ChatPhoto struct {
1241	// SmallFileID is a file identifier of small (160x160) chat photo.
1242	// This file_id can be used only for photo download and
1243	// only for as long as the photo is not changed.
1244	SmallFileID string `json:"small_file_id"`
1245	// SmallFileUniqueID is a unique file identifier of small (160x160) chat
1246	// photo, which is supposed to be the same over time and for different bots.
1247	// Can't be used to download or reuse the file.
1248	SmallFileUniqueID string `json:"small_file_unique_id"`
1249	// BigFileID is a file identifier of big (640x640) chat photo.
1250	// This file_id can be used only for photo download and
1251	// only for as long as the photo is not changed.
1252	BigFileID string `json:"big_file_id"`
1253	// BigFileUniqueID is a file identifier of big (640x640) chat photo, which
1254	// is supposed to be the same over time and for different bots. Can't be
1255	// used to download or reuse the file.
1256	BigFileUniqueID string `json:"big_file_unique_id"`
1257}
1258
1259// ChatMember contains information about one member of a chat.
1260type ChatMember struct {
1261	// User information about the user
1262	User *User `json:"user"`
1263	// Status the member's status in the chat.
1264	// Can be
1265	//  “creator”,
1266	//  “administrator”,
1267	//  “member”,
1268	//  “restricted”,
1269	//  “left” or
1270	//  “kicked”
1271	Status string `json:"status"`
1272	// CustomTitle owner and administrators only. Custom title for this user
1273	//
1274	// optional
1275	CustomTitle string `json:"custom_title,omitempty"`
1276	// UntilDate restricted and kicked only.
1277	// Date when restrictions will be lifted for this user;
1278	// unix time.
1279	//
1280	// optional
1281	UntilDate int64 `json:"until_date,omitempty"`
1282	// CanBeEdited administrators only.
1283	// True, if the bot is allowed to edit administrator privileges of that user.
1284	//
1285	// optional
1286	CanBeEdited bool `json:"can_be_edited,omitempty"`
1287	// CanPostMessages administrators only.
1288	// True, if the administrator can post in the channel;
1289	// channels only.
1290	//
1291	// optional
1292	CanPostMessages bool `json:"can_post_messages,omitempty"`
1293	// CanEditMessages administrators only.
1294	// True, if the administrator can edit messages of other users and can pin messages;
1295	// channels only.
1296	//
1297	// optional
1298	CanEditMessages bool `json:"can_edit_messages,omitempty"`
1299	// CanDeleteMessages administrators only.
1300	// True, if the administrator can delete messages of other users.
1301	//
1302	// optional
1303	CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
1304	// CanRestrictMembers administrators only.
1305	// True, if the administrator can restrict, ban or unban chat members.
1306	//
1307	// optional
1308	CanRestrictMembers bool `json:"can_restrict_members,omitempty"`
1309	// CanPromoteMembers administrators only.
1310	// True, if the administrator can add new administrators
1311	// with a subset of their own privileges or demote administrators that he has promoted,
1312	// directly or indirectly (promoted by administrators that were appointed by the user).
1313	//
1314	// optional
1315	CanPromoteMembers bool `json:"can_promote_members,omitempty"`
1316	// CanChangeInfo administrators and restricted only.
1317	// True, if the user is allowed to change the chat title, photo and other settings.
1318	//
1319	// optional
1320	CanChangeInfo bool `json:"can_change_info,omitempty"`
1321	// CanInviteUsers administrators and restricted only.
1322	// True, if the user is allowed to invite new users to the chat.
1323	//
1324	// optional
1325	CanInviteUsers bool `json:"can_invite_users,omitempty"`
1326	// CanPinMessages administrators and restricted only.
1327	// True, if the user is allowed to pin messages; groups and supergroups only
1328	//
1329	// optional
1330	CanPinMessages bool `json:"can_pin_messages,omitempty"`
1331	// IsMember is true, if the user is a member of the chat at the moment of
1332	// the request
1333	IsMember bool `json:"is_member"`
1334	// CanSendMessages
1335	//
1336	// optional
1337	CanSendMessages bool `json:"can_send_messages,omitempty"`
1338	// CanSendMediaMessages restricted only.
1339	// True, if the user is allowed to send text messages, contacts, locations and venues
1340	//
1341	// optional
1342	CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"`
1343	// CanSendPolls restricted only.
1344	// True, if the user is allowed to send polls
1345	//
1346	// optional
1347	CanSendPolls bool `json:"can_send_polls,omitempty"`
1348	// CanSendOtherMessages restricted only.
1349	// True, if the user is allowed to send audios, documents,
1350	// photos, videos, video notes and voice notes.
1351	//
1352	// optional
1353	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
1354	// CanAddWebPagePreviews restricted only.
1355	// True, if the user is allowed to add web page previews to their messages.
1356	//
1357	// optional
1358	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
1359}
1360
1361// IsCreator returns if the ChatMember was the creator of the chat.
1362func (chat ChatMember) IsCreator() bool { return chat.Status == "creator" }
1363
1364// IsAdministrator returns if the ChatMember is a chat administrator.
1365func (chat ChatMember) IsAdministrator() bool { return chat.Status == "administrator" }
1366
1367// HasLeft returns if the ChatMember left the chat.
1368func (chat ChatMember) HasLeft() bool { return chat.Status == "left" }
1369
1370// WasKicked returns if the ChatMember was kicked from the chat.
1371func (chat ChatMember) WasKicked() bool { return chat.Status == "kicked" }
1372
1373// ChatPermissions describes actions that a non-administrator user is
1374// allowed to take in a chat. All fields are optional.
1375type ChatPermissions struct {
1376	// CanSendMessages is true, if the user is allowed to send text messages,
1377	// contacts, locations and venues
1378	//
1379	// optional
1380	CanSendMessages bool `json:"can_send_messages,omitempty"`
1381	// CanSendMediaMessages is true, if the user is allowed to send audios,
1382	// documents, photos, videos, video notes and voice notes, implies
1383	// can_send_messages
1384	//
1385	// optional
1386	CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"`
1387	// CanSendPolls is true, if the user is allowed to send polls, implies
1388	// can_send_messages
1389	//
1390	// optional
1391	CanSendPolls bool `json:"can_send_polls,omitempty"`
1392	// CanSendOtherMessages is true, if the user is allowed to send animations,
1393	// games, stickers and use inline bots, implies can_send_media_messages
1394	//
1395	// optional
1396	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
1397	// CanAddWebPagePreviews is true, if the user is allowed to add web page
1398	// previews to their messages, implies can_send_media_messages
1399	//
1400	// optional
1401	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
1402	// CanChangeInfo is true, if the user is allowed to change the chat title,
1403	// photo and other settings. Ignored in public supergroups
1404	//
1405	// optional
1406	CanChangeInfo bool `json:"can_change_info,omitempty"`
1407	// CanInviteUsers is true, if the user is allowed to invite new users to the
1408	// chat
1409	//
1410	// optional
1411	CanInviteUsers bool `json:"can_invite_users,omitempty"`
1412	// CanPinMessages is true, if the user is allowed to pin messages. Ignored
1413	// in public supergroups
1414	//
1415	// optional
1416	CanPinMessages bool `json:"can_pin_messages,omitempty"`
1417}
1418
1419// BotCommand represents a bot command.
1420type BotCommand struct {
1421	// Command text of the command, 1-32 characters.
1422	// Can contain only lowercase English letters, digits and underscores.
1423	Command string `json:"command"`
1424	// Description of the command, 3-256 characters.
1425	Description string `json:"description"`
1426}
1427
1428// ResponseParameters are various errors that can be returned in APIResponse.
1429type ResponseParameters struct {
1430	// The group has been migrated to a supergroup with the specified identifier.
1431	//
1432	// optional
1433	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
1434	// In case of exceeding flood control, the number of seconds left to wait
1435	// before the request can be repeated.
1436	//
1437	// optional
1438	RetryAfter int `json:"retry_after,omitempty"`
1439}
1440
1441// BaseInputMedia is a base type for the InputMedia types.
1442type BaseInputMedia struct {
1443	// Type of the result.
1444	Type string `json:"type"`
1445	// Media file to send. Pass a file_id to send a file
1446	// that exists on the Telegram servers (recommended),
1447	// pass an HTTP URL for Telegram to get a file from the Internet,
1448	// or pass “attach://<file_attach_name>” to upload a new one
1449	// using multipart/form-data under <file_attach_name> name.
1450	Media string `json:"media"`
1451	// thumb intentionally missing as it is not currently compatible
1452
1453	// Caption of the video to be sent, 0-1024 characters after entities parsing.
1454	//
1455	// optional
1456	Caption string `json:"caption,omitempty"`
1457	// ParseMode mode for parsing entities in the video caption.
1458	// See formatting options for more details
1459	// (https://core.telegram.org/bots/api#formatting-options).
1460	//
1461	// optional
1462	ParseMode string `json:"parse_mode,omitempty"`
1463}
1464
1465// InputMediaPhoto is a photo to send as part of a media group.
1466type InputMediaPhoto struct {
1467	BaseInputMedia
1468}
1469
1470// InputMediaVideo is a video to send as part of a media group.
1471type InputMediaVideo struct {
1472	BaseInputMedia
1473	// Width video width
1474	//
1475	// optional
1476	Width int `json:"width,omitempty"`
1477	// Height video height
1478	//
1479	// optional
1480	Height int `json:"height,omitempty"`
1481	// Duration video duration
1482	//
1483	// optional
1484	Duration int `json:"duration,omitempty"`
1485	// SupportsStreaming pass True, if the uploaded video is suitable for streaming.
1486	//
1487	// optional
1488	SupportsStreaming bool `json:"supports_streaming,omitempty"`
1489}
1490
1491// InputMediaAnimation is an animation to send as part of a media group.
1492type InputMediaAnimation struct {
1493	BaseInputMedia
1494	// Width video width
1495	//
1496	// optional
1497	Width int `json:"width,omitempty"`
1498	// Height video height
1499	//
1500	// optional
1501	Height int `json:"height,omitempty"`
1502	// Duration video duration
1503	//
1504	// optional
1505	Duration int `json:"duration,omitempty"`
1506}
1507
1508// InputMediaAudio is a audio to send as part of a media group.
1509type InputMediaAudio struct {
1510	BaseInputMedia
1511	// Duration of the audio in seconds
1512	//
1513	// optional
1514	Duration int `json:"duration,omitempty"`
1515	// Performer of the audio
1516	//
1517	// optional
1518	Performer string `json:"performer,omitempty"`
1519	// Title of the audio
1520	//
1521	// optional
1522	Title string `json:"title,omitempty"`
1523}
1524
1525// InputMediaDocument is a general file to send as part of a media group.
1526type InputMediaDocument struct {
1527	BaseInputMedia
1528}
1529
1530// Sticker represents a sticker.
1531type Sticker struct {
1532	// FileID is an identifier for this file, which can be used to download or
1533	// reuse the file
1534	FileID string `json:"file_id"`
1535	// FileUniqueID is an unique identifier for this file,
1536	// which is supposed to be the same over time and for different bots.
1537	// Can't be used to download or reuse the file.
1538	FileUniqueID string `json:"file_unique_id"`
1539	// Width sticker width
1540	Width int `json:"width"`
1541	// Height sticker height
1542	Height int `json:"height"`
1543	// IsAnimated true, if the sticker is animated
1544	//
1545	// optional
1546	IsAnimated bool `json:"is_animated,omitempty"`
1547	// Thumbnail sticker thumbnail in the .WEBP or .JPG format
1548	//
1549	// optional
1550	Thumbnail *PhotoSize `json:"thumb,omitempty"`
1551	// Emoji associated with the sticker
1552	//
1553	// optional
1554	Emoji string `json:"emoji,omitempty"`
1555	// SetName of the sticker set to which the sticker belongs
1556	//
1557	// optional
1558	SetName string `json:"set_name,omitempty"`
1559	// MaskPosition is for mask stickers, the position where the mask should be
1560	// placed
1561	//
1562	// optional
1563	MaskPosition *MaskPosition `json:"mask_position,omitempty"`
1564	// FileSize
1565	//
1566	// optional
1567	FileSize int `json:"file_size,omitempty"`
1568}
1569
1570// StickerSet represents a sticker set.
1571type StickerSet struct {
1572	// Name sticker set name
1573	Name string `json:"name"`
1574	// Title sticker set title
1575	Title string `json:"title"`
1576	// IsAnimated true, if the sticker set contains animated stickers
1577	IsAnimated bool `json:"is_animated"`
1578	// ContainsMasks true, if the sticker set contains masks
1579	ContainsMasks bool `json:"contains_masks"`
1580	// Stickers list of all set stickers
1581	Stickers []Sticker `json:"stickers"`
1582	// Thumb is the sticker set thumbnail in the .WEBP or .TGS format
1583	Thumbnail *PhotoSize `json:"thumb"`
1584}
1585
1586// MaskPosition describes the position on faces where a mask should be placed
1587// by default.
1588type MaskPosition struct {
1589	// The part of the face relative to which the mask should be placed.
1590	// One of “forehead”, “eyes”, “mouth”, or “chin”.
1591	Point string `json:"point"`
1592	// Shift by X-axis measured in widths of the mask scaled to the face size,
1593	// from left to right. For example, choosing -1.0 will place mask just to
1594	// the left of the default mask position.
1595	XShift float64 `json:"x_shift"`
1596	// Shift by Y-axis measured in heights of the mask scaled to the face size,
1597	// from top to bottom. For example, 1.0 will place the mask just below the
1598	// default mask position.
1599	YShift float64 `json:"y_shift"`
1600	// Mask scaling coefficient. For example, 2.0 means double size.
1601	Scale float64 `json:"scale"`
1602}
1603
1604// Game represents a game. Use BotFather to create and edit games, their short
1605// names will act as unique identifiers.
1606type Game struct {
1607	// Title of the game
1608	Title string `json:"title"`
1609	// Description of the game
1610	Description string `json:"description"`
1611	// Photo that will be displayed in the game message in chats.
1612	Photo []PhotoSize `json:"photo"`
1613	// Text a brief description of the game or high scores included in the game message.
1614	// Can be automatically edited to include current high scores for the game
1615	// when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
1616	//
1617	// optional
1618	Text string `json:"text,omitempty"`
1619	// TextEntities special entities that appear in text, such as usernames, URLs, bot commands, etc.
1620	//
1621	// optional
1622	TextEntities []MessageEntity `json:"text_entities,omitempty"`
1623	// Animation animation that will be displayed in the game message in chats.
1624	// Upload via BotFather (https://t.me/botfather).
1625	//
1626	// optional
1627	Animation Animation `json:"animation,omitempty"`
1628}
1629
1630// GameHighScore is a user's score and position on the leaderboard.
1631type GameHighScore struct {
1632	// Position in high score table for the game
1633	Position int `json:"position"`
1634	// User user
1635	User User `json:"user"`
1636	// Score score
1637	Score int `json:"score"`
1638}
1639
1640// CallbackGame is for starting a game in an inline keyboard button.
1641type CallbackGame struct{}
1642
1643// WebhookInfo is information about a currently set webhook.
1644type WebhookInfo struct {
1645	// URL webhook URL, may be empty if webhook is not set up.
1646	URL string `json:"url"`
1647	// HasCustomCertificate true, if a custom certificate was provided for webhook certificate checks.
1648	HasCustomCertificate bool `json:"has_custom_certificate"`
1649	// PendingUpdateCount number of updates awaiting delivery.
1650	PendingUpdateCount int `json:"pending_update_count"`
1651	// LastErrorDate unix time for the most recent error
1652	// that happened when trying to deliver an update via webhook.
1653	//
1654	// optional
1655	LastErrorDate int `json:"last_error_date,omitempty"`
1656	// LastErrorMessage error message in human-readable format for the most recent error
1657	// that happened when trying to deliver an update via webhook.
1658	//
1659	// optional
1660	LastErrorMessage string `json:"last_error_message,omitempty"`
1661	// MaxConnections maximum allowed number of simultaneous
1662	// HTTPS connections to the webhook for update delivery.
1663	//
1664	// optional
1665	MaxConnections int `json:"max_connections,omitempty"`
1666	// AllowedUpdates is a list of update types the bot is subscribed to.
1667	// Defaults to all update types
1668	//
1669	// optional
1670	AllowedUpdates []string `json:"allowed_updates,omitempty"`
1671}
1672
1673// IsSet returns true if a webhook is currently set.
1674func (info WebhookInfo) IsSet() bool {
1675	return info.URL != ""
1676}
1677
1678// InlineQuery is a Query from Telegram for an inline request.
1679type InlineQuery struct {
1680	// ID unique identifier for this query
1681	ID string `json:"id"`
1682	// From sender
1683	From *User `json:"from"`
1684	// Location sender location, only for bots that request user location.
1685	//
1686	// optional
1687	Location *Location `json:"location,omitempty"`
1688	// Query text of the query (up to 256 characters).
1689	Query string `json:"query"`
1690	// Offset of the results to be returned, can be controlled by the bot.
1691	Offset string `json:"offset"`
1692}
1693
1694// InlineQueryResultCachedAudio is an inline query response with cached audio.
1695type InlineQueryResultCachedAudio struct {
1696	// Type of the result, must be audio
1697	//
1698	// required
1699	Type string `json:"type"`
1700	// ID unique identifier for this result, 1-64 bytes
1701	//
1702	// required
1703	ID string `json:"id"`
1704	// AudioID a valid file identifier for the audio file
1705	//
1706	// required
1707	AudioID string `json:"audio_file_id"`
1708	// Caption 0-1024 characters after entities parsing
1709	//
1710	// optional
1711	Caption string `json:"caption,omitempty"`
1712	// ParseMode mode for parsing entities in the video caption.
1713	// See formatting options for more details
1714	// (https://core.telegram.org/bots/api#formatting-options).
1715	//
1716	// optional
1717	ParseMode string `json:"parse_mode,omitempty"`
1718	// ReplyMarkup inline keyboard attached to the message
1719	//
1720	// optional
1721	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1722	// InputMessageContent content of the message to be sent instead of the audio
1723	//
1724	// optional
1725	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1726}
1727
1728// InlineQueryResultCachedDocument is an inline query response with cached document.
1729type InlineQueryResultCachedDocument struct {
1730	// Type of the result, must be document
1731	//
1732	// required
1733	Type string `json:"type"`
1734	// ID unique identifier for this result, 1-64 bytes
1735	//
1736	// required
1737	ID string `json:"id"`
1738	// DocumentID a valid file identifier for the file
1739	//
1740	// required
1741	DocumentID string `json:"document_file_id"`
1742	// Title for the result
1743	//
1744	// optional
1745	Title string `json:"title,omitempty"` // required
1746	// Caption of the document to be sent, 0-1024 characters after entities parsing
1747	//
1748	// optional
1749	Caption string `json:"caption,omitempty"`
1750	// Description short description of the result
1751	//
1752	// optional
1753	Description string `json:"description,omitempty"`
1754	// ParseMode mode for parsing entities in the video caption.
1755	//	// See formatting options for more details
1756	//	// (https://core.telegram.org/bots/api#formatting-options).
1757	//
1758	// optional
1759	ParseMode string `json:"parse_mode,omitempty"`
1760	// ReplyMarkup inline keyboard attached to the message
1761	//
1762	// optional
1763	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1764	// InputMessageContent content of the message to be sent instead of the file
1765	//
1766	// optional
1767	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1768}
1769
1770// InlineQueryResultCachedGIF is an inline query response with cached gif.
1771type InlineQueryResultCachedGIF struct {
1772	// Type of the result, must be gif.
1773	//
1774	// required
1775	Type string `json:"type"`
1776	// ID unique identifier for this result, 1-64 bytes.
1777	//
1778	// required
1779	ID string `json:"id"`
1780	// GifID a valid file identifier for the GIF file.
1781	//
1782	// required
1783	GifID string `json:"gif_file_id"`
1784	// Title for the result
1785	//
1786	// optional
1787	Title string `json:"title,omitempty"`
1788	// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
1789	//
1790	// optional
1791	Caption string `json:"caption,omitempty"`
1792	// ParseMode mode for parsing entities in the caption.
1793	// See formatting options for more details
1794	// (https://core.telegram.org/bots/api#formatting-options).
1795	//
1796	// optional
1797	ParseMode string `json:"parse_mode,omitempty"`
1798	// ReplyMarkup inline keyboard attached to the message.
1799	//
1800	// optional
1801	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1802	// InputMessageContent content of the message to be sent instead of the GIF animation.
1803	//
1804	// optional
1805	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1806}
1807
1808// InlineQueryResultCachedMPEG4GIF is an inline query response with cached
1809// H.264/MPEG-4 AVC video without sound gif.
1810type InlineQueryResultCachedMPEG4GIF struct {
1811	// Type of the result, must be mpeg4_gif
1812	//
1813	// required
1814	Type string `json:"type"`
1815	// ID unique identifier for this result, 1-64 bytes
1816	//
1817	// required
1818	ID string `json:"id"`
1819	// MGifID a valid file identifier for the MP4 file
1820	//
1821	// required
1822	MPEG4FileID string `json:"mpeg4_file_id"`
1823	// Title for the result
1824	//
1825	// optional
1826	Title string `json:"title,omitempty"`
1827	// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
1828	//
1829	// optional
1830	Caption string `json:"caption,omitempty"`
1831	// ParseMode mode for parsing entities in the caption.
1832	// See formatting options for more details
1833	// (https://core.telegram.org/bots/api#formatting-options).
1834	//
1835	// optional
1836	ParseMode string `json:"parse_mode,omitempty"`
1837	// ReplyMarkup inline keyboard attached to the message.
1838	//
1839	// optional
1840	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1841	// InputMessageContent content of the message to be sent instead of the video animation.
1842	//
1843	// optional
1844	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1845}
1846
1847// InlineQueryResultCachedPhoto is an inline query response with cached photo.
1848type InlineQueryResultCachedPhoto struct {
1849	// Type of the result, must be photo.
1850	//
1851	// required
1852	Type string `json:"type"`
1853	// ID unique identifier for this result, 1-64 bytes.
1854	//
1855	// required
1856	ID string `json:"id"`
1857	// PhotoID a valid file identifier of the photo.
1858	//
1859	// required
1860	PhotoID string `json:"photo_file_id"`
1861	// Title for the result.
1862	//
1863	// optional
1864	Title string `json:"title,omitempty"`
1865	// Description short description of the result.
1866	//
1867	// optional
1868	Description string `json:"description,omitempty"`
1869	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
1870	//
1871	// optional
1872	Caption string `json:"caption,omitempty"`
1873	// ParseMode mode for parsing entities in the photo caption.
1874	// See formatting options for more details
1875	// (https://core.telegram.org/bots/api#formatting-options).
1876	//
1877	// optional
1878	ParseMode string `json:"parse_mode,omitempty"`
1879	// ReplyMarkup inline keyboard attached to the message.
1880	//
1881	// optional
1882	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1883	// InputMessageContent content of the message to be sent instead of the photo.
1884	//
1885	// optional
1886	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1887}
1888
1889// InlineQueryResultCachedSticker is an inline query response with cached sticker.
1890type InlineQueryResultCachedSticker struct {
1891	// Type of the result, must be sticker
1892	//
1893	// required
1894	Type string `json:"type"`
1895	// ID unique identifier for this result, 1-64 bytes
1896	//
1897	// required
1898	ID string `json:"id"`
1899	// StickerID a valid file identifier of the sticker
1900	//
1901	// required
1902	StickerID string `json:"sticker_file_id"`
1903	// Title is a title
1904	Title string `json:"title"`
1905	// ParseMode mode for parsing entities in the video caption.
1906	// See formatting options for more details
1907	// (https://core.telegram.org/bots/api#formatting-options).
1908	//
1909	// optional
1910	ParseMode string `json:"parse_mode,omitempty"`
1911	// ReplyMarkup inline keyboard attached to the message
1912	//
1913	// optional
1914	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1915	// InputMessageContent content of the message to be sent instead of the sticker
1916	//
1917	// optional
1918	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1919}
1920
1921// InlineQueryResultCachedVideo is an inline query response with cached video.
1922type InlineQueryResultCachedVideo struct {
1923	// Type of the result, must be video
1924	//
1925	// required
1926	Type string `json:"type"`
1927	// ID unique identifier for this result, 1-64 bytes
1928	//
1929	// required
1930	ID string `json:"id"`
1931	// VideoID a valid file identifier for the video file
1932	//
1933	// required
1934	VideoID string `json:"video_file_id"`
1935	// Title for the result
1936	//
1937	// required
1938	Title string `json:"title"`
1939	// Description short description of the result
1940	//
1941	// optional
1942	Description string `json:"description,omitempty"`
1943	// Caption of the video to be sent, 0-1024 characters after entities parsing
1944	//
1945	// optional
1946	Caption string `json:"caption,omitempty"`
1947	// ParseMode mode for parsing entities in the video caption.
1948	// See formatting options for more details
1949	// (https://core.telegram.org/bots/api#formatting-options).
1950	//
1951	// optional
1952	ParseMode string `json:"parse_mode,omitempty"`
1953	// ReplyMarkup inline keyboard attached to the message
1954	//
1955	// optional
1956	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1957	// InputMessageContent content of the message to be sent instead of the video
1958	//
1959	// optional
1960	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1961}
1962
1963// InlineQueryResultCachedVoice is an inline query response with cached voice.
1964type InlineQueryResultCachedVoice struct {
1965	// Type of the result, must be voice
1966	//
1967	// required
1968	Type string `json:"type"`
1969	// ID unique identifier for this result, 1-64 bytes
1970	//
1971	// required
1972	ID string `json:"id"`
1973	// VoiceID a valid file identifier for the voice message
1974	//
1975	// required
1976	VoiceID string `json:"voice_file_id"`
1977	// Title voice message title
1978	//
1979	// required
1980	Title string `json:"title"`
1981	// Caption 0-1024 characters after entities parsing
1982	//
1983	// optional
1984	Caption string `json:"caption,omitempty"`
1985	// ParseMode mode for parsing entities in the video caption.
1986	// See formatting options for more details
1987	// (https://core.telegram.org/bots/api#formatting-options).
1988	//
1989	// optional
1990	ParseMode string `json:"parse_mode,omitempty"`
1991	// ReplyMarkup inline keyboard attached to the message
1992	//
1993	// optional
1994	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
1995	// InputMessageContent content of the message to be sent instead of the voice message
1996	//
1997	// optional
1998	InputMessageContent interface{} `json:"input_message_content,omitempty"`
1999}
2000
2001// InlineQueryResultArticle represents a link to an article or web page.
2002type InlineQueryResultArticle struct {
2003	// Type of the result, must be article.
2004	Type string `json:"type"`
2005	// ID unique identifier for this result, 1-64 Bytes.
2006	ID string `json:"id"`
2007	// Title of the result
2008	Title string `json:"title"`
2009	// InputMessageContent content of the message to be sent.
2010	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2011	// ReplyMarkup Inline keyboard attached to the message.
2012	//
2013	// optional
2014	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2015	// URL of the result.
2016	//
2017	// optional
2018	URL string `json:"url,omitempty"`
2019	// HideURL pass True, if you don't want the URL to be shown in the message.
2020	//
2021	// optional
2022	HideURL bool `json:"hide_url,omitempty"`
2023	// Description short description of the result.
2024	//
2025	// optional
2026	Description string `json:"description,omitempty"`
2027	// ThumbURL url of the thumbnail for the result
2028	//
2029	// optional
2030	ThumbURL string `json:"thumb_url,omitempty"`
2031	// ThumbWidth thumbnail width
2032	//
2033	// optional
2034	ThumbWidth int `json:"thumb_width,omitempty"`
2035	// ThumbHeight thumbnail height
2036	//
2037	// optional
2038	ThumbHeight int `json:"thumb_height,omitempty"`
2039}
2040
2041// InlineQueryResultAudio is an inline query response audio.
2042type InlineQueryResultAudio struct {
2043	// Type of the result, must be audio
2044	//
2045	// required
2046	Type string `json:"type"`
2047	// ID unique identifier for this result, 1-64 bytes
2048	//
2049	// required
2050	ID string `json:"id"`
2051	// URL a valid url for the audio file
2052	//
2053	// required
2054	URL string `json:"audio_url"`
2055	// Title is a title
2056	//
2057	// required
2058	Title string `json:"title"`
2059	// Caption 0-1024 characters after entities parsing
2060	//
2061	// optional
2062	Caption string `json:"caption,omitempty"`
2063	// Performer is a performer
2064	//
2065	// optional
2066	Performer string `json:"performer,omitempty"`
2067	// Duration audio duration in seconds
2068	//
2069	// optional
2070	Duration int `json:"audio_duration,omitempty"`
2071	// ReplyMarkup inline keyboard attached to the message
2072	//
2073	// optional
2074	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2075	// InputMessageContent content of the message to be sent instead of the audio
2076	//
2077	// optional
2078	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2079}
2080
2081// InlineQueryResultContact is an inline query response contact.
2082type InlineQueryResultContact struct {
2083	Type                string                `json:"type"`         // required
2084	ID                  string                `json:"id"`           // required
2085	PhoneNumber         string                `json:"phone_number"` // required
2086	FirstName           string                `json:"first_name"`   // required
2087	LastName            string                `json:"last_name"`
2088	VCard               string                `json:"vcard"`
2089	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2090	InputMessageContent interface{}           `json:"input_message_content,omitempty"`
2091	ThumbURL            string                `json:"thumb_url"`
2092	ThumbWidth          int                   `json:"thumb_width"`
2093	ThumbHeight         int                   `json:"thumb_height"`
2094}
2095
2096// InlineQueryResultGame is an inline query response game.
2097type InlineQueryResultGame struct {
2098	// Type of the result, must be game
2099	//
2100	// required
2101	Type string `json:"type"`
2102	// ID unique identifier for this result, 1-64 bytes
2103	//
2104	// required
2105	ID string `json:"id"`
2106	// GameShortName short name of the game
2107	//
2108	// required
2109	GameShortName string `json:"game_short_name"`
2110	// ReplyMarkup inline keyboard attached to the message
2111	//
2112	// optional
2113	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2114}
2115
2116// InlineQueryResultDocument is an inline query response document.
2117type InlineQueryResultDocument struct {
2118	// Type of the result, must be document
2119	//
2120	// required
2121	Type string `json:"type"`
2122	// ID unique identifier for this result, 1-64 bytes
2123	//
2124	// required
2125	ID string `json:"id"`
2126	// Title for the result
2127	//
2128	// required
2129	Title string `json:"title"`
2130	// Caption of the document to be sent, 0-1024 characters after entities parsing
2131	//
2132	// optional
2133	Caption string `json:"caption,omitempty"`
2134	// URL a valid url for the file
2135	//
2136	// required
2137	URL string `json:"document_url"`
2138	// MimeType of the content of the file, either “application/pdf” or “application/zip”
2139	//
2140	// required
2141	MimeType string `json:"mime_type"`
2142	// Description short description of the result
2143	//
2144	// optional
2145	Description string `json:"description,omitempty"`
2146	// ReplyMarkup nline keyboard attached to the message
2147	//
2148	// optional
2149	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2150	// InputMessageContent content of the message to be sent instead of the file
2151	//
2152	// optional
2153	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2154	// ThumbURL url of the thumbnail (jpeg only) for the file
2155	//
2156	// optional
2157	ThumbURL string `json:"thumb_url,omitempty"`
2158	// ThumbWidth thumbnail width
2159	//
2160	// optional
2161	ThumbWidth int `json:"thumb_width,omitempty"`
2162	// ThumbHeight thumbnail height
2163	//
2164	// optional
2165	ThumbHeight int `json:"thumb_height,omitempty"`
2166}
2167
2168// InlineQueryResultGIF is an inline query response GIF.
2169type InlineQueryResultGIF struct {
2170	// Type of the result, must be gif.
2171	//
2172	// required
2173	Type string `json:"type"`
2174	// ID unique identifier for this result, 1-64 bytes.
2175	//
2176	// required
2177	ID string `json:"id"`
2178	// URL a valid URL for the GIF file. File size must not exceed 1MB.
2179	//
2180	// required
2181	URL string `json:"gif_url"`
2182	// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
2183	//
2184	// required
2185	ThumbURL string `json:"thumb_url"`
2186	// Width of the GIF
2187	//
2188	// optional
2189	Width int `json:"gif_width,omitempty"`
2190	// Height of the GIF
2191	//
2192	// optional
2193	Height int `json:"gif_height,omitempty"`
2194	// Duration of the GIF
2195	//
2196	// optional
2197	Duration int `json:"gif_duration,omitempty"`
2198	// Title for the result
2199	//
2200	// optional
2201	Title string `json:"title,omitempty"`
2202	// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
2203	//
2204	// optional
2205	Caption string `json:"caption,omitempty"`
2206	// ReplyMarkup inline keyboard attached to the message
2207	//
2208	// optional
2209	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2210	// InputMessageContent content of the message to be sent instead of the GIF animation.
2211	//
2212	// optional
2213	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2214}
2215
2216// InlineQueryResultLocation is an inline query response location.
2217type InlineQueryResultLocation struct {
2218	// Type of the result, must be location
2219	//
2220	// required
2221	Type string `json:"type"`
2222	// ID unique identifier for this result, 1-64 Bytes
2223	//
2224	// required
2225	ID string `json:"id"`
2226	// Latitude  of the location in degrees
2227	//
2228	// required
2229	Latitude float64 `json:"latitude"`
2230	// Longitude of the location in degrees
2231	//
2232	// required
2233	Longitude float64 `json:"longitude"`
2234	// Title of the location
2235	//
2236	// required
2237	Title string `json:"title"`
2238	// ReplyMarkup inline keyboard attached to the message
2239	//
2240	// optional
2241	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2242	// InputMessageContent content of the message to be sent instead of the location
2243	//
2244	// optional
2245	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2246	// ThumbURL url of the thumbnail for the result
2247	//
2248	// optional
2249	ThumbURL string `json:"thumb_url,omitempty"`
2250	// ThumbWidth thumbnail width
2251	//
2252	// optional
2253	ThumbWidth int `json:"thumb_width,omitempty"`
2254	// ThumbHeight thumbnail height
2255	//
2256	// optional
2257	ThumbHeight int `json:"thumb_height,omitempty"`
2258}
2259
2260// InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.
2261type InlineQueryResultMPEG4GIF struct {
2262	// Type of the result, must be mpeg4_gif
2263	//
2264	// required
2265	Type string `json:"type"`
2266	// ID unique identifier for this result, 1-64 bytes
2267	//
2268	// required
2269	ID string `json:"id"`
2270	// URL a valid URL for the MP4 file. File size must not exceed 1MB
2271	//
2272	// required
2273	URL string `json:"mpeg4_url"`
2274	// Width video width
2275	//
2276	// optional
2277	Width int `json:"mpeg4_width"`
2278	// Height vVideo height
2279	//
2280	// optional
2281	Height int `json:"mpeg4_height"`
2282	// Duration video duration
2283	//
2284	// optional
2285	Duration int `json:"mpeg4_duration"`
2286	// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
2287	ThumbURL string `json:"thumb_url"`
2288	// Title for the result
2289	//
2290	// optional
2291	Title string `json:"title,omitempty"`
2292	// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
2293	//
2294	// optional
2295	Caption string `json:"caption,omitempty"`
2296	// ReplyMarkup inline keyboard attached to the message
2297	//
2298	// optional
2299	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2300	// InputMessageContent content of the message to be sent instead of the video animation
2301	//
2302	// optional
2303	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2304}
2305
2306// InlineQueryResultPhoto is an inline query response photo.
2307type InlineQueryResultPhoto struct {
2308	// Type of the result, must be article.
2309	//
2310	// required
2311	Type string `json:"type"`
2312	// ID unique identifier for this result, 1-64 Bytes.
2313	//
2314	// required
2315	ID string `json:"id"`
2316	// URL a valid URL of the photo. Photo must be in jpeg format.
2317	// Photo size must not exceed 5MB.
2318	URL string `json:"photo_url"`
2319	// MimeType
2320	MimeType string `json:"mime_type"`
2321	// Width of the photo
2322	//
2323	// optional
2324	Width int `json:"photo_width,omitempty"`
2325	// Height of the photo
2326	//
2327	// optional
2328	Height int `json:"photo_height,omitempty"`
2329	// ThumbURL url of the thumbnail for the photo.
2330	//
2331	// optional
2332	ThumbURL string `json:"thumb_url,omitempty"`
2333	// Title for the result
2334	//
2335	// optional
2336	Title string `json:"title,omitempty"`
2337	// Description short description of the result
2338	//
2339	// optional
2340	Description string `json:"description,omitempty"`
2341	// Caption of the photo to be sent, 0-1024 characters after entities parsing.
2342	//
2343	// optional
2344	Caption string `json:"caption,omitempty"`
2345	// ParseMode mode for parsing entities in the photo caption.
2346	// See formatting options for more details
2347	// (https://core.telegram.org/bots/api#formatting-options).
2348	//
2349	// optional
2350	ParseMode string `json:"parse_mode,omitempty"`
2351	// ReplyMarkup inline keyboard attached to the message.
2352	//
2353	// optional
2354	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2355	// InputMessageContent content of the message to be sent instead of the photo.
2356	//
2357	// optional
2358	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2359}
2360
2361// InlineQueryResultVenue is an inline query response venue.
2362type InlineQueryResultVenue struct {
2363	// Type of the result, must be venue
2364	//
2365	// required
2366	Type string `json:"type"`
2367	// ID unique identifier for this result, 1-64 Bytes
2368	//
2369	// required
2370	ID string `json:"id"`
2371	// Latitude of the venue location in degrees
2372	//
2373	// required
2374	Latitude float64 `json:"latitude"`
2375	// Longitude of the venue location in degrees
2376	//
2377	// required
2378	Longitude float64 `json:"longitude"`
2379	// Title of the venue
2380	//
2381	// required
2382	Title string `json:"title"`
2383	// Address of the venue
2384	//
2385	// required
2386	Address string `json:"address"`
2387	// FoursquareID foursquare identifier of the venue if known
2388	//
2389	// optional
2390	FoursquareID string `json:"foursquare_id,omitempty"`
2391	// FoursquareType foursquare type of the venue, if known.
2392	// (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
2393	//
2394	// optional
2395	FoursquareType string `json:"foursquare_type,omitempty"`
2396	// ReplyMarkup inline keyboard attached to the message
2397	//
2398	// optional
2399	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2400	// InputMessageContent content of the message to be sent instead of the venue
2401	//
2402	// optional
2403	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2404	// ThumbURL url of the thumbnail for the result
2405	//
2406	// optional
2407	ThumbURL string `json:"thumb_url,omitempty"`
2408	// ThumbWidth thumbnail width
2409	//
2410	// optional
2411	ThumbWidth int `json:"thumb_width,omitempty"`
2412	// ThumbHeight thumbnail height
2413	//
2414	// optional
2415	ThumbHeight int `json:"thumb_height,omitempty"`
2416}
2417
2418// InlineQueryResultVideo is an inline query response video.
2419type InlineQueryResultVideo struct {
2420	// Type of the result, must be video
2421	//
2422	// required
2423	Type string `json:"type"`
2424	// ID unique identifier for this result, 1-64 bytes
2425	//
2426	// required
2427	ID string `json:"id"`
2428	// URL a valid url for the embedded video player or video file
2429	//
2430	// required
2431	URL string `json:"video_url"`
2432	// MimeType of the content of video url, “text/html” or “video/mp4”
2433	//
2434	// required
2435	MimeType string `json:"mime_type"`
2436	//
2437	// ThumbURL url of the thumbnail (jpeg only) for the video
2438	// optional
2439	ThumbURL string `json:"thumb_url,omitempty"`
2440	// Title for the result
2441	//
2442	// required
2443	Title string `json:"title"`
2444	// Caption of the video to be sent, 0-1024 characters after entities parsing
2445	//
2446	// optional
2447	Caption string `json:"caption,omitempty"`
2448	// Width video width
2449	//
2450	// optional
2451	Width int `json:"video_width,omitempty"`
2452	// Height video height
2453	//
2454	// optional
2455	Height int `json:"video_height,omitempty"`
2456	// Duration video duration in seconds
2457	//
2458	// optional
2459	Duration int `json:"video_duration,omitempty"`
2460	// Description short description of the result
2461	//
2462	// optional
2463	Description string `json:"description,omitempty"`
2464	// ReplyMarkup inline keyboard attached to the message
2465	//
2466	// optional
2467	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2468	// InputMessageContent content of the message to be sent instead of the video.
2469	// This field is required if InlineQueryResultVideo is used to send
2470	// an HTML-page as a result (e.g., a YouTube video).
2471	//
2472	// optional
2473	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2474}
2475
2476// InlineQueryResultVoice is an inline query response voice.
2477type InlineQueryResultVoice struct {
2478	// Type of the result, must be voice
2479	//
2480	// required
2481	Type string `json:"type"`
2482	// ID unique identifier for this result, 1-64 bytes
2483	//
2484	// required
2485	ID string `json:"id"`
2486	// URL a valid URL for the voice recording
2487	//
2488	// required
2489	URL string `json:"voice_url"`
2490	// Title recording title
2491	//
2492	// required
2493	Title string `json:"title"`
2494	// Caption 0-1024 characters after entities parsing
2495	//
2496	// optional
2497	Caption string `json:"caption,omitempty"`
2498	// Duration recording duration in seconds
2499	//
2500	// optional
2501	Duration int `json:"voice_duration,omitempty"`
2502	// ReplyMarkup inline keyboard attached to the message
2503	//
2504	// optional
2505	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
2506	// InputMessageContent content of the message to be sent instead of the voice recording
2507	//
2508	// optional
2509	InputMessageContent interface{} `json:"input_message_content,omitempty"`
2510}
2511
2512// ChosenInlineResult is an inline query result chosen by a User
2513type ChosenInlineResult struct {
2514	// ResultID the unique identifier for the result that was chosen
2515	ResultID string `json:"result_id"`
2516	// From the user that chose the result
2517	From *User `json:"from"`
2518	// Location sender location, only for bots that require user location
2519	//
2520	// optional
2521	Location *Location `json:"location,omitempty"`
2522	// InlineMessageID identifier of the sent inline message.
2523	// Available only if there is an inline keyboard attached to the message.
2524	// Will be also received in callback queries and can be used to edit the message.
2525	//
2526	// optional
2527	InlineMessageID string `json:"inline_message_id,omitempty"`
2528	// Query the query that was used to obtain the result
2529	Query string `json:"query"`
2530}
2531
2532// InputTextMessageContent contains text for displaying
2533// as an inline query result.
2534type InputTextMessageContent struct {
2535	// Text of the message to be sent, 1-4096 characters
2536	Text string `json:"message_text"`
2537	// ParseMode mode for parsing entities in the message text.
2538	// See formatting options for more details
2539	// (https://core.telegram.org/bots/api#formatting-options).
2540	//
2541	// optional
2542	ParseMode string `json:"parse_mode,omitempty"`
2543	// DisableWebPagePreview disables link previews for links in the sent message
2544	//
2545	// optional
2546	DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"`
2547}
2548
2549// InputLocationMessageContent contains a location for displaying
2550// as an inline query result.
2551type InputLocationMessageContent struct {
2552	// Latitude of the location in degrees
2553	Latitude float64 `json:"latitude"`
2554	// Longitude of the location in degrees
2555	Longitude float64 `json:"longitude"`
2556	// LivePeriod is the period in seconds for which the location can be
2557	// updated, should be between 60 and 86400
2558	//
2559	// optional
2560	LivePeriod int `json:"live_period,omitempty"`
2561}
2562
2563// InputVenueMessageContent contains a venue for displaying
2564// as an inline query result.
2565type InputVenueMessageContent struct {
2566	// Latitude of the venue in degrees
2567	Latitude float64 `json:"latitude"`
2568	// Longitude of the venue in degrees
2569	Longitude float64 `json:"longitude"`
2570	// Title name of the venue
2571	Title string `json:"title"`
2572	// Address of the venue
2573	Address string `json:"address"`
2574	// FoursquareID foursquare identifier of the venue, if known
2575	//
2576	// optional
2577	FoursquareID string `json:"foursquare_id,omitempty"`
2578	// FoursquareType Foursquare type of the venue, if known
2579	//
2580	// optional
2581	FoursquareType string `json:"foursquare_type,omitempty"`
2582}
2583
2584// InputContactMessageContent contains a contact for displaying
2585// as an inline query result.
2586type InputContactMessageContent struct {
2587	// 	PhoneNumber contact's phone number
2588	PhoneNumber string `json:"phone_number"`
2589	// FirstName contact's first name
2590	FirstName string `json:"first_name"`
2591	// LastName contact's last name
2592	//
2593	// optional
2594	LastName string `json:"last_name,omitempty"`
2595	// Additional data about the contact in the form of a vCard
2596	//
2597	// optional
2598	VCard string `json:"vcard,omitempty"`
2599}
2600
2601// LabeledPrice represents a portion of the price for goods or services.
2602type LabeledPrice struct {
2603	// Label portion label
2604	Label string `json:"label"`
2605	// Amount price of the product in the smallest units of the currency (integer, not float/double).
2606	// For example, for a price of US$ 1.45 pass amount = 145.
2607	// See the exp parameter in currencies.json
2608	// (https://core.telegram.org/bots/payments/currencies.json),
2609	// it shows the number of digits past the decimal point
2610	// for each currency (2 for the majority of currencies).
2611	Amount int `json:"amount"`
2612}
2613
2614// Invoice contains basic information about an invoice.
2615type Invoice struct {
2616	// Title product name
2617	Title string `json:"title"`
2618	// Description product description
2619	Description string `json:"description"`
2620	// StartParameter unique bot deep-linking parameter that can be used to generate this invoice
2621	StartParameter string `json:"start_parameter"`
2622	// Currency three-letter ISO 4217 currency code
2623	// (see https://core.telegram.org/bots/payments#supported-currencies)
2624	Currency string `json:"currency"`
2625	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
2626	// For example, for a price of US$ 1.45 pass amount = 145.
2627	// See the exp parameter in currencies.json
2628	// (https://core.telegram.org/bots/payments/currencies.json),
2629	// it shows the number of digits past the decimal point
2630	// for each currency (2 for the majority of currencies).
2631	TotalAmount int `json:"total_amount"`
2632}
2633
2634// ShippingAddress represents a shipping address.
2635type ShippingAddress struct {
2636	// CountryCode ISO 3166-1 alpha-2 country code
2637	CountryCode string `json:"country_code"`
2638	// State if applicable
2639	State string `json:"state"`
2640	// City city
2641	City string `json:"city"`
2642	// StreetLine1 first line for the address
2643	StreetLine1 string `json:"street_line1"`
2644	// StreetLine2 second line for the address
2645	StreetLine2 string `json:"street_line2"`
2646	// PostCode address post code
2647	PostCode string `json:"post_code"`
2648}
2649
2650// OrderInfo represents information about an order.
2651type OrderInfo struct {
2652	// Name user name
2653	//
2654	// optional
2655	Name string `json:"name,omitempty"`
2656	// PhoneNumber user's phone number
2657	//
2658	// optional
2659	PhoneNumber string `json:"phone_number,omitempty"`
2660	// Email user email
2661	//
2662	// optional
2663	Email string `json:"email,omitempty"`
2664	// ShippingAddress user shipping address
2665	//
2666	// optional
2667	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
2668}
2669
2670// ShippingOption represents one shipping option.
2671type ShippingOption struct {
2672	// ID shipping option identifier
2673	ID string `json:"id"`
2674	// Title option title
2675	Title string `json:"title"`
2676	// Prices list of price portions
2677	Prices []LabeledPrice `json:"prices"`
2678}
2679
2680// SuccessfulPayment contains basic information about a successful payment.
2681type SuccessfulPayment struct {
2682	// Currency three-letter ISO 4217 currency code
2683	// (see https://core.telegram.org/bots/payments#supported-currencies)
2684	Currency string `json:"currency"`
2685	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
2686	// For example, for a price of US$ 1.45 pass amount = 145.
2687	// See the exp parameter in currencies.json,
2688	// (https://core.telegram.org/bots/payments/currencies.json)
2689	// it shows the number of digits past the decimal point
2690	// for each currency (2 for the majority of currencies).
2691	TotalAmount int `json:"total_amount"`
2692	// InvoicePayload bot specified invoice payload
2693	InvoicePayload string `json:"invoice_payload"`
2694	// ShippingOptionID identifier of the shipping option chosen by the user
2695	//
2696	// optional
2697	ShippingOptionID string `json:"shipping_option_id,omitempty"`
2698	// OrderInfo order info provided by the user
2699	//
2700	// optional
2701	OrderInfo *OrderInfo `json:"order_info,omitempty"`
2702	// TelegramPaymentChargeID telegram payment identifier
2703	TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
2704	// ProviderPaymentChargeID provider payment identifier
2705	ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
2706}
2707
2708// ShippingQuery contains information about an incoming shipping query.
2709type ShippingQuery struct {
2710	// ID unique query identifier
2711	ID string `json:"id"`
2712	// From user who sent the query
2713	From *User `json:"from"`
2714	// InvoicePayload bot specified invoice payload
2715	InvoicePayload string `json:"invoice_payload"`
2716	// ShippingAddress user specified shipping address
2717	ShippingAddress *ShippingAddress `json:"shipping_address"`
2718}
2719
2720// PreCheckoutQuery contains information about an incoming pre-checkout query.
2721type PreCheckoutQuery struct {
2722	// ID unique query identifier
2723	ID string `json:"id"`
2724	// From user who sent the query
2725	From *User `json:"from"`
2726	// Currency three-letter ISO 4217 currency code
2727	//	// (see https://core.telegram.org/bots/payments#supported-currencies)
2728	Currency string `json:"currency"`
2729	// TotalAmount total price in the smallest units of the currency (integer, not float/double).
2730	//	// For example, for a price of US$ 1.45 pass amount = 145.
2731	//	// See the exp parameter in currencies.json,
2732	//	// (https://core.telegram.org/bots/payments/currencies.json)
2733	//	// it shows the number of digits past the decimal point
2734	//	// for each currency (2 for the majority of currencies).
2735	TotalAmount int `json:"total_amount"`
2736	// InvoicePayload bot specified invoice payload
2737	InvoicePayload string `json:"invoice_payload"`
2738	// ShippingOptionID identifier of the shipping option chosen by the user
2739	//
2740	// optional
2741	ShippingOptionID string `json:"shipping_option_id,omitempty"`
2742	// OrderInfo order info provided by the user
2743	//
2744	// optional
2745	OrderInfo *OrderInfo `json:"order_info,omitempty"`
2746}