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