2015-06-26 06:26:24 +02:00
|
|
|
package tgbotapi
|
2015-06-25 18:25:02 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
2016-04-14 00:06:18 +02:00
|
|
|
"errors"
|
2015-09-19 17:53:32 +02:00
|
|
|
"fmt"
|
2016-04-12 15:28:46 +02:00
|
|
|
"net/url"
|
2015-11-21 15:26:28 +01:00
|
|
|
"strings"
|
2015-11-21 15:39:19 +01:00
|
|
|
"time"
|
2015-06-25 18:25:02 +02:00
|
|
|
)
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// APIResponse is a response from the Telegram API with the result
|
|
|
|
// stored raw.
|
2015-06-26 08:53:20 +02:00
|
|
|
type APIResponse struct {
|
2016-10-03 17:47:19 +02:00
|
|
|
Ok bool `json:"ok"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Result json.RawMessage `json:"result,omitempty"`
|
|
|
|
ErrorCode int `json:"error_code,omitempty"`
|
|
|
|
Description string `json:"description,omitempty"`
|
|
|
|
Parameters *ResponseParameters `json:"parameters,omitempty"`
|
2016-10-03 17:47:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// ResponseParameters are various errors that can be returned in APIResponse.
|
|
|
|
type ResponseParameters struct {
|
2020-05-11 10:54:32 +02:00
|
|
|
MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"` // optional
|
|
|
|
RetryAfter int `json:"retry_after,omitempty"` // optional
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2015-06-26 08:53:20 +02:00
|
|
|
// Update is an update response, from GetUpdates.
|
2015-06-25 18:25:02 +02:00
|
|
|
type Update struct {
|
2016-04-13 15:22:58 +02:00
|
|
|
UpdateID int `json:"update_id"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Message *Message `json:"message,omitempty"`
|
|
|
|
EditedMessage *Message `json:"edited_message,omitempty"`
|
|
|
|
ChannelPost *Message `json:"channel_post,omitempty"`
|
|
|
|
EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
|
|
|
|
InlineQuery *InlineQuery `json:"inline_query,omitempty"`
|
|
|
|
ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
|
|
|
|
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
|
|
|
|
ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`
|
|
|
|
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
|
|
|
|
Poll *Poll `json:"poll,omitempty"`
|
|
|
|
PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2017-01-26 18:43:28 +01:00
|
|
|
// UpdatesChannel is the channel for getting updates.
|
|
|
|
type UpdatesChannel <-chan Update
|
2016-12-15 22:51:58 +01:00
|
|
|
|
2017-01-26 18:43:28 +01:00
|
|
|
// Clear discards all unprocessed incoming updates.
|
|
|
|
func (ch UpdatesChannel) Clear() {
|
2016-12-15 22:51:58 +01:00
|
|
|
for len(ch) != 0 {
|
|
|
|
<-ch
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// User is a user on Telegram.
|
2015-06-25 18:25:02 +02:00
|
|
|
type User struct {
|
2020-01-25 04:42:19 +01:00
|
|
|
ID int `json:"id"`
|
|
|
|
FirstName string `json:"first_name"`
|
2020-05-11 10:54:32 +02:00
|
|
|
LastName string `json:"last_name,omitempty"` // optional
|
|
|
|
UserName string `json:"username,omitempty"` // optional
|
|
|
|
LanguageCode string `json:"language_code,omitempty"` // optional
|
|
|
|
IsBot bool `json:"is_bot,omitempty"` // optional
|
|
|
|
CanJoinGroups bool `json:"can_join_groups,omitempty"` // optional
|
|
|
|
CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"` // optional
|
|
|
|
SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"` // optional
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2015-07-31 09:22:01 +02:00
|
|
|
// String displays a simple text version of a user.
|
2016-01-03 23:54:24 +01:00
|
|
|
//
|
|
|
|
// It is normally a user's username, but falls back to a first/last
|
|
|
|
// name as available.
|
2015-07-31 09:22:01 +02:00
|
|
|
func (u *User) String() string {
|
2020-05-22 10:42:19 +02:00
|
|
|
if u == nil {
|
|
|
|
return ""
|
|
|
|
}
|
2015-07-31 09:22:01 +02:00
|
|
|
if u.UserName != "" {
|
|
|
|
return u.UserName
|
|
|
|
}
|
|
|
|
|
|
|
|
name := u.FirstName
|
|
|
|
if u.LastName != "" {
|
|
|
|
name += " " + u.LastName
|
|
|
|
}
|
|
|
|
|
|
|
|
return name
|
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// GroupChat is a group chat.
|
2015-06-25 18:25:02 +02:00
|
|
|
type GroupChat struct {
|
2015-06-26 08:53:20 +02:00
|
|
|
ID int `json:"id"`
|
2015-06-25 18:25:02 +02:00
|
|
|
Title string `json:"title"`
|
|
|
|
}
|
|
|
|
|
2017-06-30 15:29:59 +02:00
|
|
|
// ChatPhoto represents a chat photo.
|
|
|
|
type ChatPhoto struct {
|
2020-01-06 08:44:13 +01:00
|
|
|
SmallFileID string `json:"small_file_id"`
|
|
|
|
SmallFileUniqueID string `json:"small_file_unique_id"`
|
|
|
|
BigFileID string `json:"big_file_id"`
|
|
|
|
BigFileUniqueID string `json:"big_file_unique_id"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// ChatPermissions describes actions that a non-administrator user is
|
|
|
|
// allowed to take in a chat. All fields are optional.
|
|
|
|
type ChatPermissions struct {
|
|
|
|
CanSendMessages bool `json:"can_send_messages"`
|
|
|
|
CanSendMediaMessages bool `json:"can_send_media_messages"`
|
|
|
|
CanSendPolls bool `json:"can_send_polls"`
|
|
|
|
CanSendOtherMessages bool `json:"can_send_other_messages"`
|
|
|
|
CanAddWebPagePreviews bool `json:"can_add_web_page_previews"`
|
|
|
|
CanChangeInfo bool `json:"can_change_info"`
|
|
|
|
CanInviteUsers bool `json:"can_invite_users"`
|
|
|
|
CanPinMessages bool `json:"can_pin_messages"`
|
2017-06-30 15:29:59 +02:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// Chat contains information about the place a message was sent.
|
2015-10-09 16:26:38 +02:00
|
|
|
type Chat struct {
|
2020-01-06 08:44:13 +01:00
|
|
|
ID int64 `json:"id"`
|
|
|
|
Type string `json:"type"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Title string `json:"title,omitempty"` // optional
|
|
|
|
UserName string `json:"username,omitempty"` // optional
|
|
|
|
FirstName string `json:"first_name,omitempty"` // optional
|
|
|
|
LastName string `json:"last_name,omitempty"` // optional
|
|
|
|
AllMembersAreAdmins bool `json:"all_members_are_administrators,omitempty"` // deprecated, optional
|
|
|
|
Photo *ChatPhoto `json:"photo,omitempty"` // optional
|
|
|
|
Description string `json:"description,omitempty"` // optional
|
|
|
|
InviteLink string `json:"invite_link,omitempty"` // optional
|
|
|
|
PinnedMessage *Message `json:"pinned_message,omitempty"` // optional
|
|
|
|
Permissions *ChatPermissions `json:"permissions,omitempty"` // optional
|
|
|
|
SlowModeDelay int `json:"slow_mode_delay,omitempty"` // optional
|
|
|
|
StickerSetName string `json:"sticker_set_name,omitempty"` // optional
|
|
|
|
CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"` // optional
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// IsPrivate returns if the Chat is a private conversation.
|
2016-05-22 17:16:28 +02:00
|
|
|
func (c Chat) IsPrivate() bool {
|
2015-10-09 16:31:00 +02:00
|
|
|
return c.Type == "private"
|
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// IsGroup returns if the Chat is a group.
|
2016-05-22 17:16:28 +02:00
|
|
|
func (c Chat) IsGroup() bool {
|
2015-10-09 16:31:00 +02:00
|
|
|
return c.Type == "group"
|
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// IsSuperGroup returns if the Chat is a supergroup.
|
2016-05-22 17:16:28 +02:00
|
|
|
func (c Chat) IsSuperGroup() bool {
|
2015-12-10 03:08:37 +01:00
|
|
|
return c.Type == "supergroup"
|
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// IsChannel returns if the Chat is a channel.
|
2016-05-22 17:16:28 +02:00
|
|
|
func (c Chat) IsChannel() bool {
|
2015-10-09 16:31:00 +02:00
|
|
|
return c.Type == "channel"
|
|
|
|
}
|
|
|
|
|
2016-05-22 17:16:28 +02:00
|
|
|
// ChatConfig returns a ChatConfig struct for chat related methods.
|
|
|
|
func (c Chat) ChatConfig() ChatConfig {
|
|
|
|
return ChatConfig{ChatID: c.ID}
|
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// Message is returned by almost every request, and contains data about
|
|
|
|
// almost anything.
|
2015-06-25 18:25:02 +02:00
|
|
|
type Message struct {
|
2019-06-01 02:18:39 +02:00
|
|
|
MessageID int `json:"message_id"`
|
2020-05-11 10:54:32 +02:00
|
|
|
From *User `json:"from,omitempty"` // optional
|
2019-06-01 02:18:39 +02:00
|
|
|
Date int `json:"date"`
|
|
|
|
Chat *Chat `json:"chat"`
|
2020-05-11 10:54:32 +02:00
|
|
|
ForwardFrom *User `json:"forward_from,omitempty"` // optional
|
|
|
|
ForwardFromChat *Chat `json:"forward_from_chat,omitempty"` // optional
|
|
|
|
ForwardFromMessageID int `json:"forward_from_message_id,omitempty"` // optional
|
|
|
|
ForwardSignature string `json:"forward_signature,omitempty"` // optional
|
|
|
|
ForwardSenderName string `json:"forward_sender_name,omitempty"` // optional
|
|
|
|
ForwardDate int `json:"forward_date,omitempty"` // optional
|
|
|
|
ReplyToMessage *Message `json:"reply_to_message,omitempty"` // optional
|
2020-07-24 00:13:53 +02:00
|
|
|
ViaBot *User `json:"via_bot"` // optional
|
2020-05-11 10:54:32 +02:00
|
|
|
EditDate int `json:"edit_date,omitempty"` // optional
|
|
|
|
MediaGroupID string `json:"media_group_id,omitempty"` // optional
|
|
|
|
AuthorSignature string `json:"author_signature,omitempty"` // optional
|
|
|
|
Text string `json:"text,omitempty"` // optional
|
|
|
|
Entities []MessageEntity `json:"entities,omitempty"` // optional
|
|
|
|
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` // optional
|
|
|
|
Audio *Audio `json:"audio,omitempty"` // optional
|
|
|
|
Document *Document `json:"document,omitempty"` // optional
|
|
|
|
Animation *ChatAnimation `json:"animation,omitempty"` // optional
|
|
|
|
Game *Game `json:"game,omitempty"` // optional
|
|
|
|
Photo []PhotoSize `json:"photo,omitempty"` // optional
|
|
|
|
Sticker *Sticker `json:"sticker,omitempty"` // optional
|
|
|
|
Video *Video `json:"video,omitempty"` // optional
|
|
|
|
VideoNote *VideoNote `json:"video_note,omitempty"` // optional
|
|
|
|
Voice *Voice `json:"voice,omitempty"` // optional
|
|
|
|
Caption string `json:"caption,omitempty"` // optional
|
|
|
|
Contact *Contact `json:"contact,omitempty"` // optional
|
|
|
|
Location *Location `json:"location,omitempty"` // optional
|
|
|
|
Venue *Venue `json:"venue,omitempty"` // optional
|
|
|
|
Poll *Poll `json:"poll,omitempty"` // optional
|
|
|
|
Dice *Dice `json:"dice,omitempty"` // optional
|
|
|
|
NewChatMembers []User `json:"new_chat_members,omitempty"` // optional
|
|
|
|
LeftChatMember *User `json:"left_chat_member,omitempty"` // optional
|
|
|
|
NewChatTitle string `json:"new_chat_title,omitempty"` // optional
|
|
|
|
NewChatPhoto []PhotoSize `json:"new_chat_photo,omitempty"` // optional
|
|
|
|
DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"` // optional
|
|
|
|
GroupChatCreated bool `json:"group_chat_created,omitempty"` // optional
|
|
|
|
SuperGroupChatCreated bool `json:"supergroup_chat_created,omitempty"` // optional
|
|
|
|
ChannelChatCreated bool `json:"channel_chat_created,omitempty"` // optional
|
|
|
|
MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"` // optional
|
|
|
|
MigrateFromChatID int64 `json:"migrate_from_chat_id,omitempty"` // optional
|
|
|
|
PinnedMessage *Message `json:"pinned_message,omitempty"` // optional
|
|
|
|
Invoice *Invoice `json:"invoice,omitempty"` // optional
|
|
|
|
SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"` // optional
|
|
|
|
ConnectedWebsite string `json:"connected_website,omitempty"` // optional
|
|
|
|
PassportData *PassportData `json:"passport_data,omitempty"` // optional
|
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // optional
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2015-07-31 19:40:42 +02:00
|
|
|
// Time converts the message timestamp into a Time.
|
|
|
|
func (m *Message) Time() time.Time {
|
|
|
|
return time.Unix(int64(m.Date), 0)
|
|
|
|
}
|
|
|
|
|
2017-10-07 16:51:53 +02:00
|
|
|
// IsCommand returns true if message starts with a "bot_command" entity.
|
2015-11-21 14:43:39 +01:00
|
|
|
func (m *Message) IsCommand() bool {
|
2018-10-09 06:32:34 +02:00
|
|
|
if m.Entities == nil || len(m.Entities) == 0 {
|
2017-10-07 16:51:53 +02:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2018-10-09 06:32:34 +02:00
|
|
|
entity := m.Entities[0]
|
2019-01-10 12:40:12 +01:00
|
|
|
return entity.Offset == 0 && entity.IsCommand()
|
2015-11-21 14:43:39 +01:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// Command checks if the message was a command and if it was, returns the
|
|
|
|
// command. If the Message was not a command, it returns an empty string.
|
2016-01-04 18:45:46 +01:00
|
|
|
//
|
2017-10-07 16:51:53 +02:00
|
|
|
// If the command contains the at name syntax, it is removed. Use
|
|
|
|
// CommandWithAt() if you do not want that.
|
2015-11-21 15:26:28 +01:00
|
|
|
func (m *Message) Command() string {
|
2017-10-07 16:51:53 +02:00
|
|
|
command := m.CommandWithAt()
|
2016-01-04 18:45:46 +01:00
|
|
|
|
|
|
|
if i := strings.Index(command, "@"); i != -1 {
|
|
|
|
command = command[:i]
|
|
|
|
}
|
|
|
|
|
|
|
|
return command
|
2015-12-13 18:31:59 +01:00
|
|
|
}
|
|
|
|
|
2017-10-07 16:51:53 +02:00
|
|
|
// CommandWithAt checks if the message was a command and if it was, returns the
|
|
|
|
// command. If the Message was not a command, it returns an empty string.
|
|
|
|
//
|
|
|
|
// If the command contains the at name syntax, it is not removed. Use Command()
|
|
|
|
// if you want that.
|
|
|
|
func (m *Message) CommandWithAt() string {
|
|
|
|
if !m.IsCommand() {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsCommand() checks that the message begins with a bot_command entity
|
2018-10-09 06:32:34 +02:00
|
|
|
entity := m.Entities[0]
|
2017-10-07 16:51:53 +02:00
|
|
|
return m.Text[1:entity.Length]
|
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// CommandArguments checks if the message was a command and if it was,
|
|
|
|
// returns all text after the command name. If the Message was not a
|
|
|
|
// command, it returns an empty string.
|
2017-10-07 16:51:53 +02:00
|
|
|
//
|
|
|
|
// Note: The first character after the command name is omitted:
|
|
|
|
// - "/foo bar baz" yields "bar baz", not " bar baz"
|
|
|
|
// - "/foo-bar baz" yields "bar baz", too
|
|
|
|
// Even though the latter is not a command conforming to the spec, the API
|
|
|
|
// marks "/foo" as command entity.
|
2015-12-13 18:31:59 +01:00
|
|
|
func (m *Message) CommandArguments() string {
|
2016-01-03 23:54:24 +01:00
|
|
|
if !m.IsCommand() {
|
|
|
|
return ""
|
2015-12-13 18:31:59 +01:00
|
|
|
}
|
2016-01-03 23:54:24 +01:00
|
|
|
|
2017-10-07 16:51:53 +02:00
|
|
|
// IsCommand() checks that the message begins with a bot_command entity
|
2018-10-09 06:32:34 +02:00
|
|
|
entity := m.Entities[0]
|
2017-12-29 06:17:32 +01:00
|
|
|
|
2017-10-07 16:51:53 +02:00
|
|
|
if len(m.Text) == entity.Length {
|
|
|
|
return "" // The command makes up the whole message
|
2016-01-03 23:54:24 +01:00
|
|
|
}
|
2018-03-26 18:54:02 +02:00
|
|
|
|
|
|
|
return m.Text[entity.Length+1:]
|
2015-11-21 15:26:28 +01:00
|
|
|
}
|
|
|
|
|
2016-04-12 15:28:46 +02:00
|
|
|
// MessageEntity contains information about data in a Message.
|
|
|
|
type MessageEntity struct {
|
2020-01-25 04:42:19 +01:00
|
|
|
Type string `json:"type"`
|
|
|
|
Offset int `json:"offset"`
|
|
|
|
Length int `json:"length"`
|
2020-05-11 10:54:32 +02:00
|
|
|
URL string `json:"url,omitempty"` // optional
|
|
|
|
User *User `json:"user,omitempty"` // optional
|
|
|
|
Language string `json:"language,omitempty"` // optional
|
2016-04-12 15:28:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// ParseURL attempts to parse a URL contained within a MessageEntity.
|
2019-01-10 12:40:12 +01:00
|
|
|
func (e MessageEntity) ParseURL() (*url.URL, error) {
|
|
|
|
if e.URL == "" {
|
2016-04-14 00:06:18 +02:00
|
|
|
return nil, errors.New(ErrBadURL)
|
|
|
|
}
|
|
|
|
|
2019-01-10 12:40:12 +01:00
|
|
|
return url.Parse(e.URL)
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsMention returns true if the type of the message entity is "mention" (@username).
|
|
|
|
func (e MessageEntity) IsMention() bool {
|
|
|
|
return e.Type == "mention"
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsHashtag returns true if the type of the message entity is "hashtag".
|
|
|
|
func (e MessageEntity) IsHashtag() bool {
|
|
|
|
return e.Type == "hashtag"
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsCommand returns true if the type of the message entity is "bot_command".
|
|
|
|
func (e MessageEntity) IsCommand() bool {
|
|
|
|
return e.Type == "bot_command"
|
|
|
|
}
|
|
|
|
|
2020-07-21 21:20:12 +02:00
|
|
|
// IsURL returns true if the type of the message entity is "url".
|
|
|
|
func (e MessageEntity) IsURL() bool {
|
2019-01-10 12:40:12 +01:00
|
|
|
return e.Type == "url"
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsEmail returns true if the type of the message entity is "email".
|
|
|
|
func (e MessageEntity) IsEmail() bool {
|
|
|
|
return e.Type == "email"
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsBold returns true if the type of the message entity is "bold" (bold text).
|
|
|
|
func (e MessageEntity) IsBold() bool {
|
|
|
|
return e.Type == "bold"
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsItalic returns true if the type of the message entity is "italic" (italic text).
|
|
|
|
func (e MessageEntity) IsItalic() bool {
|
|
|
|
return e.Type == "italic"
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsCode returns true if the type of the message entity is "code" (monowidth string).
|
|
|
|
func (e MessageEntity) IsCode() bool {
|
|
|
|
return e.Type == "code"
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsPre returns true if the type of the message entity is "pre" (monowidth block).
|
|
|
|
func (e MessageEntity) IsPre() bool {
|
|
|
|
return e.Type == "pre"
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsTextLink returns true if the type of the message entity is "text_link" (clickable text URL).
|
|
|
|
func (e MessageEntity) IsTextLink() bool {
|
|
|
|
return e.Type == "text_link"
|
2016-04-12 15:28:46 +02:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// PhotoSize contains information about photos.
|
2015-06-25 18:25:02 +02:00
|
|
|
type PhotoSize struct {
|
2020-01-06 08:44:13 +01:00
|
|
|
FileID string `json:"file_id"`
|
|
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
|
|
Width int `json:"width"`
|
|
|
|
Height int `json:"height"`
|
2020-05-11 10:54:32 +02:00
|
|
|
FileSize int `json:"file_size,omitempty"` // optional
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// Audio contains information about audio.
|
2015-06-25 18:25:02 +02:00
|
|
|
type Audio struct {
|
2020-01-06 08:44:13 +01:00
|
|
|
FileID string `json:"file_id"`
|
|
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
|
|
Duration int `json:"duration"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Performer string `json:"performer,omitempty"` // optional
|
|
|
|
Title string `json:"title,omitempty"` // optional
|
|
|
|
MimeType string `json:"mime_type,omitempty"` // optional
|
|
|
|
FileSize int `json:"file_size,omitempty"` // optional
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// Document contains information about a document.
|
2015-06-25 18:25:02 +02:00
|
|
|
type Document struct {
|
2020-01-06 08:44:13 +01:00
|
|
|
FileID string `json:"file_id"`
|
|
|
|
FileUniqueID string `json:"file_unique_id"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Thumbnail *PhotoSize `json:"thumb,omitempty"` // optional
|
|
|
|
FileName string `json:"file_name,omitempty"` // optional
|
|
|
|
MimeType string `json:"mime_type,omitempty"` // optional
|
|
|
|
FileSize int `json:"file_size,omitempty"` // optional
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// Sticker contains information about a sticker.
|
2015-06-25 18:25:02 +02:00
|
|
|
type Sticker struct {
|
2017-12-29 07:44:47 +01:00
|
|
|
FileID string `json:"file_id"`
|
2020-01-06 08:44:13 +01:00
|
|
|
FileUniqueID string `json:"file_unique_id"`
|
2017-12-29 07:44:47 +01:00
|
|
|
Width int `json:"width"`
|
|
|
|
Height int `json:"height"`
|
2020-01-06 08:44:13 +01:00
|
|
|
IsAnimated bool `json:"is_animated"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Thumbnail *PhotoSize `json:"thumb,omitempty"` // optional
|
|
|
|
Emoji string `json:"emoji,omitempty"` // optional
|
|
|
|
SetName string `json:"set_name,omitempty"` // optional
|
|
|
|
MaskPosition MaskPosition `json:"mask_position,omitempty"` //optional
|
|
|
|
FileSize int `json:"file_size,omitempty"` // optional
|
2017-12-29 07:44:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// MaskPosition is the position of a mask.
|
|
|
|
type MaskPosition struct {
|
2018-10-08 10:13:50 +02:00
|
|
|
Point string `json:"point"`
|
|
|
|
XShift float32 `json:"x_shift"`
|
|
|
|
YShift float32 `json:"y_shift"`
|
|
|
|
Scale float32 `json:"scale"`
|
2016-04-13 15:22:58 +02:00
|
|
|
FileID string `json:"file_id"`
|
|
|
|
Width int `json:"width"`
|
|
|
|
Height int `json:"height"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Thumbnail *PhotoSize `json:"thumb,omitempty"` // optional
|
|
|
|
Emoji string `json:"emoji,omitempty"` // optional
|
|
|
|
FileSize int `json:"file_size,omitempty"` // optional
|
|
|
|
SetName string `json:"set_name,omitempty"` // optional
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2018-09-06 14:44:42 +02:00
|
|
|
// ChatAnimation contains information about an animation.
|
|
|
|
type ChatAnimation struct {
|
2020-02-08 09:02:23 +01:00
|
|
|
FileID string `json:"file_id"`
|
|
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
|
|
Width int `json:"width"`
|
|
|
|
Height int `json:"height"`
|
|
|
|
Duration int `json:"duration"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Thumbnail *PhotoSize `json:"thumb,omitempty"` // optional
|
|
|
|
FileName string `json:"file_name,omitempty"` // optional
|
|
|
|
MimeType string `json:"mime_type,omitempty"` // optional
|
|
|
|
FileSize int `json:"file_size,omitempty"` // optional
|
2018-09-06 14:44:42 +02:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// Video contains information about a video.
|
2015-06-25 18:25:02 +02:00
|
|
|
type Video struct {
|
2020-01-06 08:44:13 +01:00
|
|
|
FileID string `json:"file_id"`
|
|
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
|
|
Width int `json:"width"`
|
|
|
|
Height int `json:"height"`
|
|
|
|
Duration int `json:"duration"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Thumbnail *PhotoSize `json:"thumb,omitempty"` // optional
|
|
|
|
MimeType string `json:"mime_type,omitempty"` // optional
|
|
|
|
FileSize int `json:"file_size,omitempty"` // optional
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2017-05-22 00:04:12 +02:00
|
|
|
// VideoNote contains information about a video.
|
|
|
|
type VideoNote struct {
|
2020-01-06 08:44:13 +01:00
|
|
|
FileID string `json:"file_id"`
|
|
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
|
|
Length int `json:"length"`
|
|
|
|
Duration int `json:"duration"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Thumbnail *PhotoSize `json:"thumb,omitempty"` // optional
|
|
|
|
FileSize int `json:"file_size,omitempty"` // optional
|
2017-05-22 00:04:12 +02:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// Voice contains information about a voice.
|
2015-08-18 03:40:42 +02:00
|
|
|
type Voice struct {
|
2020-01-06 08:44:13 +01:00
|
|
|
FileID string `json:"file_id"`
|
|
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
|
|
Duration int `json:"duration"`
|
2020-05-11 10:54:32 +02:00
|
|
|
MimeType string `json:"mime_type,omitempty"` // optional
|
|
|
|
FileSize int `json:"file_size,omitempty"` // optional
|
2015-08-18 03:40:42 +02:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// Contact contains information about a contact.
|
|
|
|
//
|
|
|
|
// Note that LastName and UserID may be empty.
|
2015-06-25 18:25:02 +02:00
|
|
|
type Contact struct {
|
|
|
|
PhoneNumber string `json:"phone_number"`
|
|
|
|
FirstName string `json:"first_name"`
|
2020-05-11 10:54:32 +02:00
|
|
|
LastName string `json:"last_name,omitempty"` // optional
|
|
|
|
UserID int `json:"user_id,omitempty"` // optional
|
|
|
|
VCard string `json:"vcard,omitempty"` // optional
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// Location contains information about a place.
|
2015-06-25 18:25:02 +02:00
|
|
|
type Location struct {
|
2016-04-14 20:28:38 +02:00
|
|
|
Longitude float64 `json:"longitude"`
|
|
|
|
Latitude float64 `json:"latitude"`
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2016-04-12 15:28:46 +02:00
|
|
|
// Venue contains information about a venue, including its Location.
|
|
|
|
type Venue struct {
|
|
|
|
Location Location `json:"location"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Address string `json:"address"`
|
2020-05-11 10:54:32 +02:00
|
|
|
FoursquareID string `json:"foursquare_id,omitempty"` // optional
|
2016-04-12 15:28:46 +02:00
|
|
|
}
|
|
|
|
|
2019-04-14 21:46:45 +02:00
|
|
|
// PollOption contains information about one answer option in a poll.
|
|
|
|
type PollOption struct {
|
|
|
|
Text string `json:"text"`
|
|
|
|
VoterCount int `json:"voter_count"`
|
|
|
|
}
|
|
|
|
|
2020-01-25 04:42:19 +01:00
|
|
|
// PollAnswer represents an answer of a user in a non-anonymous poll.
|
|
|
|
type PollAnswer struct {
|
|
|
|
PollID string `json:"poll_id"`
|
|
|
|
User User `json:"user"`
|
|
|
|
OptionIDs []int `json:"option_ids"`
|
|
|
|
}
|
|
|
|
|
2019-04-14 21:46:45 +02:00
|
|
|
// Poll contains information about a poll.
|
|
|
|
type Poll struct {
|
2020-04-24 20:18:26 +02:00
|
|
|
ID string `json:"id"`
|
|
|
|
Question string `json:"question"`
|
|
|
|
Options []PollOption `json:"options"`
|
|
|
|
IsClosed bool `json:"is_closed"`
|
|
|
|
IsAnonymous bool `json:"is_anonymous"`
|
|
|
|
Type string `json:"type"`
|
|
|
|
AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
|
2020-05-11 10:54:32 +02:00
|
|
|
CorrectOptionID int `json:"correct_option_id,omitempty"` // optional
|
|
|
|
Explanation string `json:"explanation,omitempty"` // optional
|
|
|
|
ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"` // optional
|
|
|
|
OpenPeriod int `json:"open_period,omitempty"` // optional
|
|
|
|
CloseDate int `json:"close_date,omitempty"` // optional
|
2019-04-14 21:46:45 +02:00
|
|
|
}
|
|
|
|
|
2020-03-30 22:35:53 +02:00
|
|
|
// Dice represents a single dice value.
|
|
|
|
type Dice struct {
|
2020-04-24 20:18:26 +02:00
|
|
|
Emoji string `json:"emoji"`
|
|
|
|
Value int `json:"value"`
|
2020-03-30 22:35:53 +02:00
|
|
|
}
|
|
|
|
|
2016-02-28 17:13:44 +01:00
|
|
|
// UserProfilePhotos contains a set of user profile photos.
|
2015-06-25 18:25:02 +02:00
|
|
|
type UserProfilePhotos struct {
|
2016-04-09 22:30:16 +02:00
|
|
|
TotalCount int `json:"total_count"`
|
|
|
|
Photos [][]PhotoSize `json:"photos"`
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// File contains information about a file to download from Telegram.
|
2015-09-19 17:46:20 +02:00
|
|
|
type File struct {
|
2020-01-06 08:44:13 +01:00
|
|
|
FileID string `json:"file_id"`
|
|
|
|
FileUniqueID string `json:"file_unique_id"`
|
2020-05-11 10:54:32 +02:00
|
|
|
FileSize int `json:"file_size,omitempty"` // optional
|
|
|
|
FilePath string `json:"file_path,omitempty"` // optional
|
2015-09-19 17:46:20 +02:00
|
|
|
}
|
|
|
|
|
2015-09-19 17:53:32 +02:00
|
|
|
// Link returns a full path to the download URL for a File.
|
|
|
|
//
|
|
|
|
// It requires the Bot Token to create the link.
|
|
|
|
func (f *File) Link(token string) string {
|
2015-09-19 20:42:50 +02:00
|
|
|
return fmt.Sprintf(FileEndpoint, token, f.FilePath)
|
2015-09-19 17:53:32 +02:00
|
|
|
}
|
|
|
|
|
2015-06-26 08:53:20 +02:00
|
|
|
// ReplyKeyboardMarkup allows the Bot to set a custom keyboard.
|
2015-06-25 18:25:02 +02:00
|
|
|
type ReplyKeyboardMarkup struct {
|
2016-04-12 15:28:46 +02:00
|
|
|
Keyboard [][]KeyboardButton `json:"keyboard"`
|
2020-05-11 10:54:32 +02:00
|
|
|
ResizeKeyboard bool `json:"resize_keyboard,omitempty"` // optional
|
|
|
|
OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"` // optional
|
|
|
|
Selective bool `json:"selective,omitempty"` // optional
|
2016-04-12 15:28:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// KeyboardButton is a button within a custom keyboard.
|
|
|
|
type KeyboardButton struct {
|
2020-04-24 20:18:26 +02:00
|
|
|
Text string `json:"text"`
|
|
|
|
RequestContact bool `json:"request_contact"`
|
|
|
|
RequestLocation bool `json:"request_location"`
|
|
|
|
RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
|
2020-01-25 04:42:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// KeyboardButtonPollType represents type of a poll, which is allowed to
|
|
|
|
// be created and sent when the corresponding button is pressed.
|
|
|
|
type KeyboardButtonPollType struct {
|
|
|
|
Type string `json:"type"`
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2015-06-26 08:53:20 +02:00
|
|
|
// ReplyKeyboardHide allows the Bot to hide a custom keyboard.
|
2015-06-25 18:25:02 +02:00
|
|
|
type ReplyKeyboardHide struct {
|
|
|
|
HideKeyboard bool `json:"hide_keyboard"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Selective bool `json:"selective,omitempty"` // optional
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
|
|
|
|
2016-11-25 06:50:35 +01:00
|
|
|
// ReplyKeyboardRemove allows the Bot to hide a custom keyboard.
|
|
|
|
type ReplyKeyboardRemove struct {
|
|
|
|
RemoveKeyboard bool `json:"remove_keyboard"`
|
|
|
|
Selective bool `json:"selective"`
|
|
|
|
}
|
|
|
|
|
2016-04-12 15:28:46 +02:00
|
|
|
// InlineKeyboardMarkup is a custom keyboard presented for an inline bot.
|
|
|
|
type InlineKeyboardMarkup struct {
|
|
|
|
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// InlineKeyboardButton is a button within a custom keyboard for
|
|
|
|
// inline query responses.
|
|
|
|
//
|
|
|
|
// Note that some values are references as even an empty string
|
|
|
|
// will change behavior.
|
2016-10-03 17:47:19 +02:00
|
|
|
//
|
|
|
|
// CallbackGame, if set, MUST be first button in first row.
|
2016-04-12 15:28:46 +02:00
|
|
|
type InlineKeyboardButton struct {
|
2016-10-03 17:47:19 +02:00
|
|
|
Text string `json:"text"`
|
2016-12-26 15:59:52 +01:00
|
|
|
URL *string `json:"url,omitempty"` // optional
|
2019-06-01 02:18:39 +02:00
|
|
|
LoginURL *LoginURL `json:"login_url,omitempty"` // optional
|
2016-12-26 15:59:52 +01:00
|
|
|
CallbackData *string `json:"callback_data,omitempty"` // optional
|
|
|
|
SwitchInlineQuery *string `json:"switch_inline_query,omitempty"` // optional
|
|
|
|
SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"` // optional
|
|
|
|
CallbackGame *CallbackGame `json:"callback_game,omitempty"` // optional
|
2018-03-04 12:10:17 +01:00
|
|
|
Pay bool `json:"pay,omitempty"` // optional
|
2016-04-12 15:28:46 +02:00
|
|
|
}
|
|
|
|
|
2019-06-01 02:18:39 +02:00
|
|
|
// LoginURL is the parameters for the login inline keyboard button type.
|
|
|
|
type LoginURL struct {
|
|
|
|
URL string `json:"url"`
|
|
|
|
ForwardText string `json:"forward_text"`
|
|
|
|
BotUsername string `json:"bot_username"`
|
|
|
|
RequestWriteAccess bool `json:"request_write_access"`
|
|
|
|
}
|
|
|
|
|
2016-04-12 15:28:46 +02:00
|
|
|
// CallbackQuery is data sent when a keyboard button with callback data
|
|
|
|
// is clicked.
|
|
|
|
type CallbackQuery struct {
|
2016-04-13 15:22:58 +02:00
|
|
|
ID string `json:"id"`
|
|
|
|
From *User `json:"from"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Message *Message `json:"message,omitempty"` // optional
|
|
|
|
InlineMessageID string `json:"inline_message_id,omitempty"` // optional
|
2016-10-03 17:47:19 +02:00
|
|
|
ChatInstance string `json:"chat_instance"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Data string `json:"data,omitempty"` // optional
|
|
|
|
GameShortName string `json:"game_short_name,omitempty"` // optional
|
2016-04-12 15:28:46 +02:00
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// ForceReply allows the Bot to have users directly reply to it without
|
|
|
|
// additional interaction.
|
2015-06-25 18:25:02 +02:00
|
|
|
type ForceReply struct {
|
|
|
|
ForceReply bool `json:"force_reply"`
|
2016-01-03 23:54:24 +01:00
|
|
|
Selective bool `json:"selective"` // optional
|
2015-06-25 18:25:02 +02:00
|
|
|
}
|
2016-01-01 07:10:19 +01:00
|
|
|
|
2016-05-22 17:16:28 +02:00
|
|
|
// ChatMember is information about a member in a chat.
|
|
|
|
type ChatMember struct {
|
2017-06-30 15:22:57 +02:00
|
|
|
User *User `json:"user"`
|
|
|
|
Status string `json:"status"`
|
2020-05-11 10:54:32 +02:00
|
|
|
CustomTitle string `json:"custom_title,omitempty"` // optional
|
2017-06-30 15:22:57 +02:00
|
|
|
UntilDate int64 `json:"until_date,omitempty"` // optional
|
|
|
|
CanBeEdited bool `json:"can_be_edited,omitempty"` // optional
|
|
|
|
CanPostMessages bool `json:"can_post_messages,omitempty"` // optional
|
|
|
|
CanEditMessages bool `json:"can_edit_messages,omitempty"` // optional
|
|
|
|
CanDeleteMessages bool `json:"can_delete_messages,omitempty"` // optional
|
|
|
|
CanRestrictMembers bool `json:"can_restrict_members,omitempty"` // optional
|
|
|
|
CanPromoteMembers bool `json:"can_promote_members,omitempty"` // optional
|
2020-01-06 08:44:13 +01:00
|
|
|
CanChangeInfo bool `json:"can_change_info,omitempty"` // optional
|
|
|
|
CanInviteUsers bool `json:"can_invite_users,omitempty"` // optional
|
|
|
|
CanPinMessages bool `json:"can_pin_messages,omitempty"` // optional
|
2020-05-11 10:54:32 +02:00
|
|
|
IsChatMember bool `json:"is_member,omitempty"` // optional
|
2017-06-30 15:22:57 +02:00
|
|
|
CanSendMessages bool `json:"can_send_messages,omitempty"` // optional
|
|
|
|
CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"` // optional
|
2020-01-06 08:44:13 +01:00
|
|
|
CanSendPolls bool `json:"can_send_polls,omitempty"` // optional
|
2017-06-30 15:22:57 +02:00
|
|
|
CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"` // optional
|
|
|
|
CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"` // optional
|
2016-05-22 17:16:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsCreator returns if the ChatMember was the creator of the chat.
|
|
|
|
func (chat ChatMember) IsCreator() bool { return chat.Status == "creator" }
|
|
|
|
|
|
|
|
// IsAdministrator returns if the ChatMember is a chat administrator.
|
|
|
|
func (chat ChatMember) IsAdministrator() bool { return chat.Status == "administrator" }
|
|
|
|
|
|
|
|
// IsMember returns if the ChatMember is a current member of the chat.
|
|
|
|
func (chat ChatMember) IsMember() bool { return chat.Status == "member" }
|
|
|
|
|
|
|
|
// HasLeft returns if the ChatMember left the chat.
|
|
|
|
func (chat ChatMember) HasLeft() bool { return chat.Status == "left" }
|
|
|
|
|
|
|
|
// WasKicked returns if the ChatMember was kicked from the chat.
|
|
|
|
func (chat ChatMember) WasKicked() bool { return chat.Status == "kicked" }
|
|
|
|
|
2016-10-03 17:47:19 +02:00
|
|
|
// Game is a game within Telegram.
|
|
|
|
type Game struct {
|
|
|
|
Title string `json:"title"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
Photo []PhotoSize `json:"photo"`
|
|
|
|
Text string `json:"text"`
|
|
|
|
TextEntities []MessageEntity `json:"text_entities"`
|
|
|
|
Animation Animation `json:"animation"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Animation is a GIF animation demonstrating the game.
|
|
|
|
type Animation struct {
|
2020-01-06 08:44:13 +01:00
|
|
|
FileID string `json:"file_id"`
|
|
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
|
|
Thumb PhotoSize `json:"thumb"`
|
|
|
|
FileName string `json:"file_name"`
|
|
|
|
MimeType string `json:"mime_type"`
|
|
|
|
FileSize int `json:"file_size"`
|
2016-10-03 17:47:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// GameHighScore is a user's score and position on the leaderboard.
|
|
|
|
type GameHighScore struct {
|
|
|
|
Position int `json:"position"`
|
|
|
|
User User `json:"user"`
|
|
|
|
Score int `json:"score"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// CallbackGame is for starting a game in an inline keyboard button.
|
|
|
|
type CallbackGame struct{}
|
|
|
|
|
|
|
|
// WebhookInfo is information about a currently set webhook.
|
|
|
|
type WebhookInfo struct {
|
|
|
|
URL string `json:"url"`
|
|
|
|
HasCustomCertificate bool `json:"has_custom_certificate"`
|
|
|
|
PendingUpdateCount int `json:"pending_update_count"`
|
2020-01-13 08:42:35 +01:00
|
|
|
LastErrorDate int `json:"last_error_date"` // optional
|
|
|
|
LastErrorMessage string `json:"last_error_message"` // optional
|
2020-07-21 10:33:33 +02:00
|
|
|
MaxConnections int `json:"max_connections"` // optional
|
2016-10-03 17:47:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsSet returns true if a webhook is currently set.
|
|
|
|
func (info WebhookInfo) IsSet() bool {
|
|
|
|
return info.URL != ""
|
|
|
|
}
|
|
|
|
|
2016-01-03 23:54:24 +01:00
|
|
|
// InlineQuery is a Query from Telegram for an inline request.
|
2016-01-01 07:10:19 +01:00
|
|
|
type InlineQuery struct {
|
2016-04-13 15:22:58 +02:00
|
|
|
ID string `json:"id"`
|
|
|
|
From *User `json:"from"`
|
2020-05-11 10:54:32 +02:00
|
|
|
Location *Location `json:"location,omitempty"` // optional
|
2016-04-13 15:22:58 +02:00
|
|
|
Query string `json:"query"`
|
|
|
|
Offset string `json:"offset"`
|
2016-01-01 07:10:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// InlineQueryResultArticle is an inline query response article.
|
|
|
|
type InlineQueryResultArticle struct {
|
2016-04-13 22:45:51 +02:00
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
Title string `json:"title"` // required
|
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"` // required
|
2016-04-13 16:30:52 +02:00
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
2016-04-12 20:26:18 +02:00
|
|
|
URL string `json:"url"`
|
|
|
|
HideURL bool `json:"hide_url"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
ThumbURL string `json:"thumb_url"`
|
|
|
|
ThumbWidth int `json:"thumb_width"`
|
|
|
|
ThumbHeight int `json:"thumb_height"`
|
2016-01-01 07:10:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// InlineQueryResultPhoto is an inline query response photo.
|
|
|
|
type InlineQueryResultPhoto struct {
|
2016-04-12 20:26:18 +02:00
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
URL string `json:"photo_url"` // required
|
|
|
|
MimeType string `json:"mime_type"`
|
|
|
|
Width int `json:"photo_width"`
|
|
|
|
Height int `json:"photo_height"`
|
|
|
|
ThumbURL string `json:"thumb_url"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
Caption string `json:"caption"`
|
2016-04-13 16:30:52 +02:00
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
2016-04-13 22:45:51 +02:00
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
2016-01-01 07:10:19 +01:00
|
|
|
}
|
|
|
|
|
2018-07-04 12:48:19 +02:00
|
|
|
// InlineQueryResultCachedPhoto is an inline query response with cached photo.
|
|
|
|
type InlineQueryResultCachedPhoto struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
PhotoID string `json:"photo_file_id"` // required
|
|
|
|
Title string `json:"title"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
Caption string `json:"caption"`
|
|
|
|
ParseMode string `json:"parse_mode"`
|
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-01-01 07:10:19 +01:00
|
|
|
// InlineQueryResultGIF is an inline query response GIF.
|
|
|
|
type InlineQueryResultGIF struct {
|
2019-01-24 09:45:45 +01:00
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
URL string `json:"gif_url"` // required
|
|
|
|
ThumbURL string `json:"thumb_url"` // required
|
2020-07-24 00:13:53 +02:00
|
|
|
ThumbMimeType string `json:"thumb_mime_type"`
|
2019-01-24 09:39:10 +01:00
|
|
|
Width int `json:"gif_width,omitempty"`
|
|
|
|
Height int `json:"gif_height,omitempty"`
|
|
|
|
Duration int `json:"gif_duration,omitempty"`
|
2019-01-24 09:45:45 +01:00
|
|
|
Title string `json:"title,omitempty"`
|
|
|
|
Caption string `json:"caption,omitempty"`
|
2016-04-13 16:30:52 +02:00
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
2016-04-13 22:45:51 +02:00
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
2016-01-01 07:10:19 +01:00
|
|
|
}
|
|
|
|
|
2018-07-04 12:48:19 +02:00
|
|
|
// InlineQueryResultCachedGIF is an inline query response with cached gif.
|
|
|
|
type InlineQueryResultCachedGIF struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
GifID string `json:"gif_file_id"` // required
|
|
|
|
Title string `json:"title"`
|
|
|
|
Caption string `json:"caption"`
|
|
|
|
ParseMode string `json:"parse_mode"`
|
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-01-01 07:10:19 +01:00
|
|
|
// InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.
|
|
|
|
type InlineQueryResultMPEG4GIF struct {
|
2016-04-12 20:26:18 +02:00
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
URL string `json:"mpeg4_url"` // required
|
|
|
|
Width int `json:"mpeg4_width"`
|
|
|
|
Height int `json:"mpeg4_height"`
|
2017-06-03 16:19:09 +02:00
|
|
|
Duration int `json:"mpeg4_duration"`
|
2016-04-12 20:26:18 +02:00
|
|
|
ThumbURL string `json:"thumb_url"`
|
2020-07-24 00:13:53 +02:00
|
|
|
ThumbMimeType string `json:"thumb_mime_type"`
|
2016-04-12 20:26:18 +02:00
|
|
|
Title string `json:"title"`
|
|
|
|
Caption string `json:"caption"`
|
2016-04-13 16:30:52 +02:00
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
2016-04-13 22:45:51 +02:00
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
2016-01-01 07:10:19 +01:00
|
|
|
}
|
|
|
|
|
2018-07-04 12:48:19 +02:00
|
|
|
// InlineQueryResultCachedMpeg4Gif is an inline query response with cached
|
|
|
|
// H.264/MPEG-4 AVC video without sound gif.
|
|
|
|
type InlineQueryResultCachedMpeg4Gif struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
MGifID string `json:"mpeg4_file_id"` // required
|
|
|
|
Title string `json:"title"`
|
|
|
|
Caption string `json:"caption"`
|
|
|
|
ParseMode string `json:"parse_mode"`
|
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-01-01 07:10:19 +01:00
|
|
|
// InlineQueryResultVideo is an inline query response video.
|
|
|
|
type InlineQueryResultVideo struct {
|
2016-04-12 20:26:18 +02:00
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
URL string `json:"video_url"` // required
|
|
|
|
MimeType string `json:"mime_type"` // required
|
|
|
|
ThumbURL string `json:"thumb_url"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Caption string `json:"caption"`
|
|
|
|
Width int `json:"video_width"`
|
|
|
|
Height int `json:"video_height"`
|
|
|
|
Duration int `json:"video_duration"`
|
|
|
|
Description string `json:"description"`
|
2016-04-13 16:30:52 +02:00
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
2016-04-13 22:45:51 +02:00
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
2016-01-01 07:10:19 +01:00
|
|
|
}
|
2016-01-04 17:15:57 +01:00
|
|
|
|
2018-07-04 12:48:19 +02:00
|
|
|
// InlineQueryResultCachedVideo is an inline query response with cached video.
|
|
|
|
type InlineQueryResultCachedVideo struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
VideoID string `json:"video_file_id"` // required
|
|
|
|
Title string `json:"title"` // required
|
|
|
|
Description string `json:"description"`
|
|
|
|
Caption string `json:"caption"`
|
|
|
|
ParseMode string `json:"parse_mode"`
|
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
|
|
|
}
|
|
|
|
|
2020-01-05 06:35:15 +01:00
|
|
|
// InlineQueryResultCachedSticker is an inline query response with cached sticker.
|
|
|
|
type InlineQueryResultCachedSticker struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
StickerID string `json:"sticker_file_id"` // required
|
|
|
|
Title string `json:"title"` // required
|
|
|
|
ParseMode string `json:"parse_mode"`
|
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-04-13 15:22:58 +02:00
|
|
|
// InlineQueryResultAudio is an inline query response audio.
|
|
|
|
type InlineQueryResultAudio struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
URL string `json:"audio_url"` // required
|
|
|
|
Title string `json:"title"` // required
|
2016-10-03 17:47:19 +02:00
|
|
|
Caption string `json:"caption"`
|
2016-04-13 15:22:58 +02:00
|
|
|
Performer string `json:"performer"`
|
|
|
|
Duration int `json:"audio_duration"`
|
2016-04-13 16:30:52 +02:00
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
2016-04-13 22:45:51 +02:00
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
2016-04-13 15:22:58 +02:00
|
|
|
}
|
|
|
|
|
2018-07-04 12:48:19 +02:00
|
|
|
// InlineQueryResultCachedAudio is an inline query response with cached audio.
|
|
|
|
type InlineQueryResultCachedAudio struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
AudioID string `json:"audio_file_id"` // required
|
|
|
|
Caption string `json:"caption"`
|
|
|
|
ParseMode string `json:"parse_mode"`
|
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-04-13 15:22:58 +02:00
|
|
|
// InlineQueryResultVoice is an inline query response voice.
|
|
|
|
type InlineQueryResultVoice struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
URL string `json:"voice_url"` // required
|
|
|
|
Title string `json:"title"` // required
|
2016-10-03 17:47:19 +02:00
|
|
|
Caption string `json:"caption"`
|
2016-04-13 15:22:58 +02:00
|
|
|
Duration int `json:"voice_duration"`
|
2016-04-13 16:30:52 +02:00
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
2016-04-13 22:45:51 +02:00
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
2016-04-13 15:22:58 +02:00
|
|
|
}
|
|
|
|
|
2018-07-04 12:48:19 +02:00
|
|
|
// InlineQueryResultCachedVoice is an inline query response with cached voice.
|
|
|
|
type InlineQueryResultCachedVoice struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
VoiceID string `json:"voice_file_id"` // required
|
|
|
|
Title string `json:"title"` // required
|
|
|
|
Caption string `json:"caption"`
|
|
|
|
ParseMode string `json:"parse_mode"`
|
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-04-13 15:22:58 +02:00
|
|
|
// InlineQueryResultDocument is an inline query response document.
|
|
|
|
type InlineQueryResultDocument struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
Title string `json:"title"` // required
|
|
|
|
Caption string `json:"caption"`
|
|
|
|
URL string `json:"document_url"` // required
|
|
|
|
MimeType string `json:"mime_type"` // required
|
|
|
|
Description string `json:"description"`
|
2016-04-13 16:30:52 +02:00
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
2016-04-13 22:45:51 +02:00
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
2016-04-13 15:22:58 +02:00
|
|
|
ThumbURL string `json:"thumb_url"`
|
|
|
|
ThumbWidth int `json:"thumb_width"`
|
|
|
|
ThumbHeight int `json:"thumb_height"`
|
|
|
|
}
|
|
|
|
|
2018-07-04 12:48:19 +02:00
|
|
|
// InlineQueryResultCachedDocument is an inline query response with cached document.
|
|
|
|
type InlineQueryResultCachedDocument struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
DocumentID string `json:"document_file_id"` // required
|
|
|
|
Title string `json:"title"` // required
|
|
|
|
Caption string `json:"caption"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
ParseMode string `json:"parse_mode"`
|
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-04-13 15:22:58 +02:00
|
|
|
// InlineQueryResultLocation is an inline query response location.
|
|
|
|
type InlineQueryResultLocation struct {
|
2017-12-29 20:06:58 +01:00
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
Latitude float64 `json:"latitude"` // required
|
|
|
|
Longitude float64 `json:"longitude"` // required
|
2017-10-17 18:00:20 +02:00
|
|
|
LivePeriod int `json:"live_period"` // optional
|
2017-12-29 20:06:58 +01:00
|
|
|
Title string `json:"title"` // required
|
2016-04-13 16:30:52 +02:00
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
2016-04-13 22:45:51 +02:00
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
2016-04-13 15:22:58 +02:00
|
|
|
ThumbURL string `json:"thumb_url"`
|
|
|
|
ThumbWidth int `json:"thumb_width"`
|
|
|
|
ThumbHeight int `json:"thumb_height"`
|
|
|
|
}
|
|
|
|
|
2018-10-09 06:05:24 +02:00
|
|
|
// InlineQueryResultContact is an inline query response contact.
|
|
|
|
type InlineQueryResultContact struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
PhoneNumber string `json:"phone_number"` // required
|
|
|
|
FirstName string `json:"first_name"` // required
|
|
|
|
LastName string `json:"last_name"`
|
|
|
|
VCard string `json:"vcard"`
|
2016-04-13 16:30:52 +02:00
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
2016-04-13 22:45:51 +02:00
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
2016-04-13 15:22:58 +02:00
|
|
|
ThumbURL string `json:"thumb_url"`
|
|
|
|
ThumbWidth int `json:"thumb_width"`
|
|
|
|
ThumbHeight int `json:"thumb_height"`
|
|
|
|
}
|
|
|
|
|
2020-01-06 17:28:13 +01:00
|
|
|
// InlineQueryResultVenue is an inline query response venue.
|
|
|
|
type InlineQueryResultVenue struct {
|
|
|
|
Type string `json:"type"` // required
|
|
|
|
ID string `json:"id"` // required
|
|
|
|
Latitude float64 `json:"latitude"` // required
|
|
|
|
Longitude float64 `json:"longitude"` // required
|
|
|
|
Title string `json:"title"` // required
|
|
|
|
Address string `json:"address"` // required
|
|
|
|
FoursquareID string `json:"foursquare_id"`
|
|
|
|
FoursquareType string `json:"foursquare_type"`
|
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
|
|
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
|
|
|
ThumbURL string `json:"thumb_url"`
|
|
|
|
ThumbWidth int `json:"thumb_width"`
|
|
|
|
ThumbHeight int `json:"thumb_height"`
|
|
|
|
}
|
|
|
|
|
2016-10-03 17:47:19 +02:00
|
|
|
// InlineQueryResultGame is an inline query response game.
|
|
|
|
type InlineQueryResultGame struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
ID string `json:"id"`
|
|
|
|
GameShortName string `json:"game_short_name"`
|
2018-01-11 22:41:45 +01:00
|
|
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
2016-10-03 17:47:19 +02:00
|
|
|
}
|
|
|
|
|
2016-01-04 17:15:57 +01:00
|
|
|
// ChosenInlineResult is an inline query result chosen by a User
|
|
|
|
type ChosenInlineResult struct {
|
2016-04-13 15:22:58 +02:00
|
|
|
ResultID string `json:"result_id"`
|
|
|
|
From *User `json:"from"`
|
|
|
|
Location *Location `json:"location"`
|
|
|
|
InlineMessageID string `json:"inline_message_id"`
|
|
|
|
Query string `json:"query"`
|
2016-01-04 17:15:57 +01:00
|
|
|
}
|
2016-04-12 15:56:05 +02:00
|
|
|
|
2016-04-12 15:59:47 +02:00
|
|
|
// InputTextMessageContent contains text for displaying
|
|
|
|
// as an inline query result.
|
2016-04-12 15:56:05 +02:00
|
|
|
type InputTextMessageContent struct {
|
|
|
|
Text string `json:"message_text"`
|
|
|
|
ParseMode string `json:"parse_mode"`
|
|
|
|
DisableWebPagePreview bool `json:"disable_web_page_preview"`
|
|
|
|
}
|
|
|
|
|
2016-04-12 15:59:47 +02:00
|
|
|
// InputLocationMessageContent contains a location for displaying
|
|
|
|
// as an inline query result.
|
2016-04-12 15:56:05 +02:00
|
|
|
type InputLocationMessageContent struct {
|
|
|
|
Latitude float64 `json:"latitude"`
|
|
|
|
Longitude float64 `json:"longitude"`
|
|
|
|
}
|
|
|
|
|
2016-04-12 15:59:47 +02:00
|
|
|
// InputVenueMessageContent contains a venue for displaying
|
|
|
|
// as an inline query result.
|
2016-04-12 15:56:05 +02:00
|
|
|
type InputVenueMessageContent struct {
|
|
|
|
Latitude float64 `json:"latitude"`
|
|
|
|
Longitude float64 `json:"longitude"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Address string `json:"address"`
|
|
|
|
FoursquareID string `json:"foursquare_id"`
|
|
|
|
}
|
|
|
|
|
2016-04-12 15:59:47 +02:00
|
|
|
// InputContactMessageContent contains a contact for displaying
|
|
|
|
// as an inline query result.
|
2016-04-12 15:56:05 +02:00
|
|
|
type InputContactMessageContent struct {
|
|
|
|
PhoneNumber string `json:"phone_number"`
|
|
|
|
FirstName string `json:"first_name"`
|
|
|
|
LastName string `json:"last_name"`
|
2018-10-09 06:05:24 +02:00
|
|
|
VCard string `json:"vcard"`
|
2016-04-12 15:56:05 +02:00
|
|
|
}
|
2017-06-02 22:18:42 +02:00
|
|
|
|
2017-06-03 08:59:40 +02:00
|
|
|
// Invoice contains basic information about an invoice.
|
2017-06-02 22:18:42 +02:00
|
|
|
type Invoice struct {
|
|
|
|
Title string `json:"title"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
StartParameter string `json:"start_parameter"`
|
|
|
|
Currency string `json:"currency"`
|
|
|
|
TotalAmount int `json:"total_amount"`
|
|
|
|
}
|
|
|
|
|
2017-06-03 08:59:40 +02:00
|
|
|
// LabeledPrice represents a portion of the price for goods or services.
|
2017-06-02 22:18:42 +02:00
|
|
|
type LabeledPrice struct {
|
|
|
|
Label string `json:"label"`
|
|
|
|
Amount int `json:"amount"`
|
|
|
|
}
|
|
|
|
|
2017-06-03 08:59:40 +02:00
|
|
|
// ShippingAddress represents a shipping address.
|
2017-06-02 22:18:42 +02:00
|
|
|
type ShippingAddress struct {
|
|
|
|
CountryCode string `json:"country_code"`
|
|
|
|
State string `json:"state"`
|
|
|
|
City string `json:"city"`
|
|
|
|
StreetLine1 string `json:"street_line1"`
|
|
|
|
StreetLine2 string `json:"street_line2"`
|
|
|
|
PostCode string `json:"post_code"`
|
|
|
|
}
|
|
|
|
|
2017-06-03 08:59:40 +02:00
|
|
|
// OrderInfo represents information about an order.
|
2017-06-02 22:18:42 +02:00
|
|
|
type OrderInfo struct {
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
PhoneNumber string `json:"phone_number,omitempty"`
|
|
|
|
Email string `json:"email,omitempty"`
|
|
|
|
ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
|
|
|
|
}
|
|
|
|
|
2017-06-03 08:59:40 +02:00
|
|
|
// ShippingOption represents one shipping option.
|
2017-06-02 22:18:42 +02:00
|
|
|
type ShippingOption struct {
|
2018-10-09 06:32:34 +02:00
|
|
|
ID string `json:"id"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Prices []LabeledPrice `json:"prices"`
|
2017-06-02 22:18:42 +02:00
|
|
|
}
|
|
|
|
|
2017-06-03 08:59:40 +02:00
|
|
|
// SuccessfulPayment contains basic information about a successful payment.
|
2017-06-02 22:18:42 +02:00
|
|
|
type SuccessfulPayment struct {
|
|
|
|
Currency string `json:"currency"`
|
|
|
|
TotalAmount int `json:"total_amount"`
|
|
|
|
InvoicePayload string `json:"invoice_payload"`
|
|
|
|
ShippingOptionID string `json:"shipping_option_id,omitempty"`
|
|
|
|
OrderInfo *OrderInfo `json:"order_info,omitempty"`
|
|
|
|
TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
|
|
|
|
ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
|
|
|
|
}
|
|
|
|
|
2017-06-03 08:59:40 +02:00
|
|
|
// ShippingQuery contains information about an incoming shipping query.
|
2017-06-02 22:18:42 +02:00
|
|
|
type ShippingQuery struct {
|
|
|
|
ID string `json:"id"`
|
|
|
|
From *User `json:"from"`
|
|
|
|
InvoicePayload string `json:"invoice_payload"`
|
|
|
|
ShippingAddress *ShippingAddress `json:"shipping_address"`
|
|
|
|
}
|
|
|
|
|
2017-06-03 08:59:40 +02:00
|
|
|
// PreCheckoutQuery contains information about an incoming pre-checkout query.
|
2017-06-02 22:18:42 +02:00
|
|
|
type PreCheckoutQuery struct {
|
|
|
|
ID string `json:"id"`
|
|
|
|
From *User `json:"from"`
|
|
|
|
Currency string `json:"currency"`
|
|
|
|
TotalAmount int `json:"total_amount"`
|
|
|
|
InvoicePayload string `json:"invoice_payload"`
|
|
|
|
ShippingOptionID string `json:"shipping_option_id,omitempty"`
|
|
|
|
OrderInfo *OrderInfo `json:"order_info,omitempty"`
|
|
|
|
}
|
2018-03-04 12:10:17 +01:00
|
|
|
|
2017-12-29 07:44:47 +01:00
|
|
|
// StickerSet is a collection of stickers.
|
|
|
|
type StickerSet struct {
|
2020-03-30 22:35:53 +02:00
|
|
|
Name string `json:"name"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
IsAnimated bool `json:"is_animated"`
|
|
|
|
ContainsMasks bool `json:"contains_masks"`
|
|
|
|
Stickers []Sticker `json:"stickers"`
|
|
|
|
Thumb *PhotoSize `json:"thumb"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// BotCommand represents Telegram's understanding of a command.
|
|
|
|
type BotCommand struct {
|
|
|
|
Command string `json:"command"`
|
|
|
|
Description string `json:"description"`
|
2017-12-29 07:44:47 +01:00
|
|
|
}
|
2017-12-29 20:22:53 +01:00
|
|
|
|
2018-10-09 06:05:24 +02:00
|
|
|
// BaseInputMedia is a base type for the InputMedia types.
|
|
|
|
type BaseInputMedia struct {
|
2018-10-08 10:13:50 +02:00
|
|
|
Type string `json:"type"`
|
|
|
|
Media string `json:"media"`
|
|
|
|
Caption string `json:"caption"`
|
|
|
|
ParseMode string `json:"parse_mode"`
|
2017-12-29 20:22:53 +01:00
|
|
|
}
|
|
|
|
|
2018-10-09 06:05:24 +02:00
|
|
|
// InputMediaPhoto is a photo to send as part of a media group.
|
|
|
|
type InputMediaPhoto struct {
|
|
|
|
BaseInputMedia
|
|
|
|
}
|
|
|
|
|
2017-12-29 20:22:53 +01:00
|
|
|
// InputMediaVideo is a video to send as part of a media group.
|
|
|
|
type InputMediaVideo struct {
|
2018-10-09 06:05:24 +02:00
|
|
|
BaseInputMedia
|
|
|
|
Width int `json:"width"`
|
|
|
|
Height int `json:"height"`
|
|
|
|
Duration int `json:"duration"`
|
|
|
|
SupportsStreaming bool `json:"supports_streaming"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// InputMediaAnimation is an animation to send as part of a media group.
|
|
|
|
type InputMediaAnimation struct {
|
|
|
|
BaseInputMedia
|
|
|
|
Width int `json:"width"`
|
|
|
|
Height int `json:"height"`
|
|
|
|
Duration int `json:"duration"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// InputMediaAudio is a audio to send as part of a media group.
|
|
|
|
type InputMediaAudio struct {
|
|
|
|
BaseInputMedia
|
|
|
|
Duration int `json:"duration"`
|
|
|
|
Performer string `json:"performer"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// InputMediaDocument is a audio to send as part of a media group.
|
|
|
|
type InputMediaDocument struct {
|
|
|
|
BaseInputMedia
|
2017-12-29 20:22:53 +01:00
|
|
|
}
|
2018-03-26 19:22:16 +02:00
|
|
|
|
2018-03-26 18:54:02 +02:00
|
|
|
// Error is an error containing extra information returned by the Telegram API.
|
2018-03-04 12:10:17 +01:00
|
|
|
type Error struct {
|
2019-03-01 17:17:35 +01:00
|
|
|
Code int
|
2018-03-04 12:10:17 +01:00
|
|
|
Message string
|
|
|
|
ResponseParameters
|
|
|
|
}
|
|
|
|
|
2018-03-26 19:22:16 +02:00
|
|
|
// Error message string.
|
2018-03-04 12:10:17 +01:00
|
|
|
func (e Error) Error() string {
|
|
|
|
return e.Message
|
|
|
|
}
|