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