diff options
Diffstat (limited to 'vendor/github.com/go-telegram-bot-api/telegram-bot-api')
4 files changed, 346 insertions, 41 deletions
diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go index c7e473fb..7ae3b472 100644 --- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go +++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/bot.go @@ -7,7 +7,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/technoweenie/multipartstreamer" "io/ioutil" "log" "net/http" @@ -16,6 +15,8 @@ import ( "strconv" "strings" "time" + + "github.com/technoweenie/multipartstreamer" ) // BotAPI allows you to interact with the Telegram Bot API. @@ -80,7 +81,7 @@ func (bot *BotAPI) MakeRequest(endpoint string, params url.Values) (APIResponse, json.Unmarshal(bytes, &apiResp) if !apiResp.Ok { - return APIResponse{}, errors.New(apiResp.Description) + return apiResp, errors.New(apiResp.Description) } return apiResp, nil @@ -105,16 +106,17 @@ func (bot *BotAPI) makeMessageRequest(endpoint string, params url.Values) (Messa // // Requires the parameter to hold the file not be in the params. // File should be a string to a file path, a FileBytes struct, -// or a FileReader struct. +// a FileReader struct, or a url.URL. // // Note that if your FileReader has a size set to -1, it will read // the file into memory to calculate a size. func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldname string, file interface{}) (APIResponse, error) { ms := multipartstreamer.New() - ms.WriteFields(params) switch f := file.(type) { case string: + ms.WriteFields(params) + fileHandle, err := os.Open(f) if err != nil { return APIResponse{}, err @@ -128,9 +130,13 @@ func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldna ms.WriteReader(fieldname, fileHandle.Name(), fi.Size(), fileHandle) case FileBytes: + ms.WriteFields(params) + buf := bytes.NewBuffer(f.Bytes) ms.WriteReader(fieldname, f.Name, int64(len(f.Bytes)), buf) case FileReader: + ms.WriteFields(params) + if f.Size != -1 { ms.WriteReader(fieldname, f.Name, f.Size, f.Reader) @@ -145,6 +151,10 @@ func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldna buf := bytes.NewBuffer(data) ms.WriteReader(fieldname, f.Name, int64(len(data)), buf) + case url.URL: + params[fieldname] = f.String() + + ms.WriteFields(params) default: return APIResponse{}, errors.New(ErrBadFileType) } @@ -399,15 +409,22 @@ func (bot *BotAPI) RemoveWebhook() (APIResponse, error) { // If you do not have a legitimate TLS certificate, you need to include // your self signed certificate with the config. func (bot *BotAPI) SetWebhook(config WebhookConfig) (APIResponse, error) { + if config.Certificate == nil { v := url.Values{} v.Add("url", config.URL.String()) + if config.MaxConnections != 0 { + v.Add("max_connections", strconv.Itoa(config.MaxConnections)) + } return bot.MakeRequest("setWebhook", v) } params := make(map[string]string) params["url"] = config.URL.String() + if config.MaxConnections != 0 { + params["max_connections"] = strconv.Itoa(config.MaxConnections) + } resp, err := bot.UploadFile("setWebhook", params, "certificate", config.Certificate) if err != nil { @@ -424,9 +441,23 @@ func (bot *BotAPI) SetWebhook(config WebhookConfig) (APIResponse, error) { return apiResp, nil } +// GetWebhookInfo allows you to fetch information about a webhook and if +// one currently is set, along with pending update count and error messages. +func (bot *BotAPI) GetWebhookInfo() (WebhookInfo, error) { + resp, err := bot.MakeRequest("getWebhookInfo", url.Values{}) + if err != nil { + return WebhookInfo{}, err + } + + var info WebhookInfo + err = json.Unmarshal(resp.Result, &info) + + return info, err +} + // GetUpdatesChan starts and returns a channel for getting updates. -func (bot *BotAPI) GetUpdatesChan(config UpdateConfig) (<-chan Update, error) { - updatesChan := make(chan Update, 100) +func (bot *BotAPI) GetUpdatesChan(config UpdateConfig) (UpdatesChannel, error) { + ch := make(chan Update, 100) go func() { for { @@ -442,18 +473,18 @@ func (bot *BotAPI) GetUpdatesChan(config UpdateConfig) (<-chan Update, error) { for _, update := range updates { if update.UpdateID >= config.Offset { config.Offset = update.UpdateID + 1 - updatesChan <- update + ch <- update } } } }() - return updatesChan, nil + return ch, nil } // ListenForWebhook registers a http handler for a webhook. -func (bot *BotAPI) ListenForWebhook(pattern string) <-chan Update { - updatesChan := make(chan Update, 100) +func (bot *BotAPI) ListenForWebhook(pattern string) UpdatesChannel { + ch := make(chan Update, 100) http.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) { bytes, _ := ioutil.ReadAll(r.Body) @@ -461,10 +492,10 @@ func (bot *BotAPI) ListenForWebhook(pattern string) <-chan Update { var update Update json.Unmarshal(bytes, &update) - updatesChan <- update + ch <- update }) - return updatesChan + return ch } // AnswerInlineQuery sends a response to an inline query. @@ -495,8 +526,14 @@ func (bot *BotAPI) AnswerCallbackQuery(config CallbackConfig) (APIResponse, erro v := url.Values{} v.Add("callback_query_id", config.CallbackQueryID) - v.Add("text", config.Text) + if config.Text != "" { + v.Add("text", config.Text) + } v.Add("show_alert", strconv.FormatBool(config.ShowAlert)) + if config.URL != "" { + v.Add("url", config.URL) + } + v.Add("cache_time", strconv.Itoa(config.CacheTime)) bot.debugLog("answerCallbackQuery", v, nil) @@ -648,3 +685,18 @@ func (bot *BotAPI) UnbanChatMember(config ChatMemberConfig) (APIResponse, error) return bot.MakeRequest("unbanChatMember", v) } + +// GetGameHighScores allows you to get the high scores for a game. +func (bot *BotAPI) GetGameHighScores(config GetGameHighScoresConfig) ([]GameHighScore, error) { + v, _ := config.values() + + resp, err := bot.MakeRequest(config.method(), v) + if err != nil { + return []GameHighScore{}, err + } + + var highScores []GameHighScore + err = json.Unmarshal(resp.Result, &highScores) + + return highScores, err +} diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go index b91d0704..68c14e92 100644 --- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go +++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/configs.go @@ -198,7 +198,10 @@ type MessageConfig struct { // values returns a url.Values representation of MessageConfig. func (config MessageConfig) values() (url.Values, error) { - v, _ := config.BaseChat.values() + v, err := config.BaseChat.values() + if err != nil { + return v, err + } v.Add("text", config.Text) v.Add("disable_web_page_preview", strconv.FormatBool(config.DisableWebPagePreview)) if config.ParseMode != "" { @@ -223,7 +226,10 @@ type ForwardConfig struct { // values returns a url.Values representation of ForwardConfig. func (config ForwardConfig) values() (url.Values, error) { - v, _ := config.BaseChat.values() + v, err := config.BaseChat.values() + if err != nil { + return v, err + } v.Add("from_chat_id", strconv.FormatInt(config.FromChatID, 10)) v.Add("message_id", strconv.Itoa(config.MessageID)) return v, nil @@ -253,7 +259,10 @@ func (config PhotoConfig) params() (map[string]string, error) { // Values returns a url.Values representation of PhotoConfig. func (config PhotoConfig) values() (url.Values, error) { - v, _ := config.BaseChat.values() + v, err := config.BaseChat.values() + if err != nil { + return v, err + } v.Add(config.name(), config.FileID) if config.Caption != "" { @@ -275,6 +284,7 @@ func (config PhotoConfig) method() string { // AudioConfig contains information about a SendAudio request. type AudioConfig struct { BaseFile + Caption string Duration int Performer string Title string @@ -282,7 +292,10 @@ type AudioConfig struct { // values returns a url.Values representation of AudioConfig. func (config AudioConfig) values() (url.Values, error) { - v, _ := config.BaseChat.values() + v, err := config.BaseChat.values() + if err != nil { + return v, err + } v.Add(config.name(), config.FileID) if config.Duration != 0 { @@ -295,6 +308,9 @@ func (config AudioConfig) values() (url.Values, error) { if config.Title != "" { v.Add("title", config.Title) } + if config.Caption != "" { + v.Add("caption", config.Caption) + } return v, nil } @@ -313,6 +329,9 @@ func (config AudioConfig) params() (map[string]string, error) { if config.Title != "" { params["title"] = config.Title } + if config.Caption != "" { + params["caption"] = config.Caption + } return params, nil } @@ -334,7 +353,10 @@ type DocumentConfig struct { // values returns a url.Values representation of DocumentConfig. func (config DocumentConfig) values() (url.Values, error) { - v, _ := config.BaseChat.values() + v, err := config.BaseChat.values() + if err != nil { + return v, err + } v.Add(config.name(), config.FileID) @@ -365,7 +387,10 @@ type StickerConfig struct { // values returns a url.Values representation of StickerConfig. func (config StickerConfig) values() (url.Values, error) { - v, _ := config.BaseChat.values() + v, err := config.BaseChat.values() + if err != nil { + return v, err + } v.Add(config.name(), config.FileID) @@ -398,7 +423,10 @@ type VideoConfig struct { // values returns a url.Values representation of VideoConfig. func (config VideoConfig) values() (url.Values, error) { - v, _ := config.BaseChat.values() + v, err := config.BaseChat.values() + if err != nil { + return v, err + } v.Add(config.name(), config.FileID) if config.Duration != 0 { @@ -431,12 +459,16 @@ func (config VideoConfig) method() string { // VoiceConfig contains information about a SendVoice request. type VoiceConfig struct { BaseFile + Caption string Duration int } // values returns a url.Values representation of VoiceConfig. func (config VoiceConfig) values() (url.Values, error) { - v, _ := config.BaseChat.values() + v, err := config.BaseChat.values() + if err != nil { + return v, err + } v.Add(config.name(), config.FileID) if config.Duration != 0 { @@ -476,7 +508,10 @@ type LocationConfig struct { // values returns a url.Values representation of LocationConfig. func (config LocationConfig) values() (url.Values, error) { - v, _ := config.BaseChat.values() + v, err := config.BaseChat.values() + if err != nil { + return v, err + } v.Add("latitude", strconv.FormatFloat(config.Latitude, 'f', 6, 64)) v.Add("longitude", strconv.FormatFloat(config.Longitude, 'f', 6, 64)) @@ -500,7 +535,10 @@ type VenueConfig struct { } func (config VenueConfig) values() (url.Values, error) { - v, _ := config.BaseChat.values() + v, err := config.BaseChat.values() + if err != nil { + return v, err + } v.Add("latitude", strconv.FormatFloat(config.Latitude, 'f', 6, 64)) v.Add("longitude", strconv.FormatFloat(config.Longitude, 'f', 6, 64)) @@ -526,7 +564,10 @@ type ContactConfig struct { } func (config ContactConfig) values() (url.Values, error) { - v, _ := config.BaseChat.values() + v, err := config.BaseChat.values() + if err != nil { + return v, err + } v.Add("phone_number", config.PhoneNumber) v.Add("first_name", config.FirstName) @@ -539,6 +580,94 @@ func (config ContactConfig) method() string { return "sendContact" } +// GameConfig allows you to send a game. +type GameConfig struct { + BaseChat + GameShortName string +} + +func (config GameConfig) values() (url.Values, error) { + v, err := config.BaseChat.values() + if err != nil { + return v, err + } + + v.Add("game_short_name", config.GameShortName) + + return v, nil +} + +func (config GameConfig) method() string { + return "sendGame" +} + +// SetGameScoreConfig allows you to update the game score in a chat. +type SetGameScoreConfig struct { + UserID int + Score int + Force bool + DisableEditMessage bool + ChatID int + ChannelUsername string + MessageID int + InlineMessageID string +} + +func (config SetGameScoreConfig) values() (url.Values, error) { + v := url.Values{} + + v.Add("user_id", strconv.Itoa(config.UserID)) + v.Add("score", strconv.Itoa(config.Score)) + if config.InlineMessageID == "" { + if config.ChannelUsername == "" { + v.Add("chat_id", strconv.Itoa(config.ChatID)) + } else { + v.Add("chat_id", config.ChannelUsername) + } + v.Add("message_id", strconv.Itoa(config.MessageID)) + } else { + v.Add("inline_message_id", config.InlineMessageID) + } + v.Add("disable_edit_message", strconv.FormatBool(config.DisableEditMessage)) + + return v, nil +} + +func (config SetGameScoreConfig) method() string { + return "setGameScore" +} + +// GetGameHighScoresConfig allows you to fetch the high scores for a game. +type GetGameHighScoresConfig struct { + UserID int + ChatID int + ChannelUsername string + MessageID int + InlineMessageID string +} + +func (config GetGameHighScoresConfig) values() (url.Values, error) { + v := url.Values{} + + v.Add("user_id", strconv.Itoa(config.UserID)) + if config.InlineMessageID == "" { + if config.ChannelUsername == "" { + v.Add("chat_id", strconv.Itoa(config.ChatID)) + } else { + v.Add("chat_id", config.ChannelUsername) + } + v.Add("message_id", strconv.Itoa(config.MessageID)) + } else { + v.Add("inline_message_id", config.InlineMessageID) + } + + return v, nil +} + +func (config GetGameHighScoresConfig) method() string { + return "getGameHighScores" +} + // ChatActionConfig contains information about a SendChatAction request. type ChatActionConfig struct { BaseChat @@ -547,7 +676,10 @@ type ChatActionConfig struct { // values returns a url.Values representation of ChatActionConfig. func (config ChatActionConfig) values() (url.Values, error) { - v, _ := config.BaseChat.values() + v, err := config.BaseChat.values() + if err != nil { + return v, err + } v.Add("action", config.Action) return v, nil } @@ -566,7 +698,10 @@ type EditMessageTextConfig struct { } func (config EditMessageTextConfig) values() (url.Values, error) { - v, _ := config.BaseEdit.values() + v, err := config.BaseEdit.values() + if err != nil { + return v, err + } v.Add("text", config.Text) v.Add("parse_mode", config.ParseMode) @@ -635,6 +770,7 @@ type UpdateConfig struct { type WebhookConfig struct { URL *url.URL Certificate interface{} + MaxConnections int } // FileBytes contains information about a set of bytes to upload @@ -669,6 +805,8 @@ type CallbackConfig struct { CallbackQueryID string `json:"callback_query_id"` Text string `json:"text"` ShowAlert bool `json:"show_alert"` + URL string `json:"url"` + CacheTime int `json:"cache_time"` } // ChatMemberConfig contains information about a user in a chat for use diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go index 53e50052..4ca56fbf 100644 --- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go +++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/helpers.go @@ -1,6 +1,7 @@ package tgbotapi import ( + "log" "net/url" ) @@ -20,6 +21,7 @@ func NewMessage(chatID int64, text string) MessageConfig { // NewMessageToChannel creates a new Message that is sent to a channel // by username. +// // username is the username of the channel, text is the message text. func NewMessageToChannel(username string, text string) MessageConfig { return MessageConfig{ @@ -316,6 +318,21 @@ func NewWebhookWithCert(link string, file interface{}) WebhookConfig { } } +// NewWebhookWithCert creates a new webhook with a certificate and max_connections. +// +// link is the url you wish to get webhooks, +// file contains a string to a file, FileReader, or FileBytes. +// maxConnections defines maximum number of connections from telegram to your server +func NewWebhookWithCertAndMaxConnections(link string, file interface{}, maxConnections int) WebhookConfig { + u, _ := url.Parse(link) + + return WebhookConfig{ + URL: u, + Certificate: file, + MaxConnections: maxConnections, + } +} + // NewInlineQueryResultArticle creates a new inline query article. func NewInlineQueryResultArticle(id, title, messageText string) InlineQueryResultArticle { return InlineQueryResultArticle{ @@ -479,12 +496,23 @@ func NewEditMessageReplyMarkup(chatID int64, messageID int, replyMarkup InlineKe // NewHideKeyboard hides the keyboard, with the option for being selective // or hiding for everyone. func NewHideKeyboard(selective bool) ReplyKeyboardHide { + log.Println("NewHideKeyboard is deprecated, please use NewRemoveKeyboard") + return ReplyKeyboardHide{ HideKeyboard: true, Selective: selective, } } +// NewRemoveKeyboard hides the keyboard, with the option for being selective +// or hiding for everyone. +func NewRemoveKeyboard(selective bool) ReplyKeyboardRemove { + return ReplyKeyboardRemove{ + RemoveKeyboard: true, + Selective: selective, + } +} + // NewKeyboardButton creates a regular keyboard button. func NewKeyboardButton(text string) KeyboardButton { return KeyboardButton{ diff --git a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go index 1c7b1b0f..e691028d 100644 --- a/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go +++ b/vendor/github.com/go-telegram-bot-api/telegram-bot-api/types.go @@ -12,10 +12,17 @@ import ( // APIResponse is a response from the Telegram API with the result // stored raw. type APIResponse struct { - Ok bool `json:"ok"` - Result json.RawMessage `json:"result"` - ErrorCode int `json:"error_code"` - Description string `json:"description"` + Ok bool `json:"ok"` + Result json.RawMessage `json:"result"` + ErrorCode int `json:"error_code"` + Description string `json:"description"` + Parameters *ResponseParameters `json:"parameters"` +} + +// ResponseParameters are various errors that can be returned in APIResponse. +type ResponseParameters struct { + MigrateToChatID int64 `json:"migrate_to_chat_id"` // optional + RetryAfter int `json:"retry_after"` // optional } // Update is an update response, from GetUpdates. @@ -23,11 +30,23 @@ type Update struct { UpdateID int `json:"update_id"` Message *Message `json:"message"` EditedMessage *Message `json:"edited_message"` + ChannelPost *Message `json:"channel_post"` + EditedChannelPost *Message `json:"edited_channel_post"` InlineQuery *InlineQuery `json:"inline_query"` ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result"` CallbackQuery *CallbackQuery `json:"callback_query"` } +// UpdatesChannel is the channel for getting updates. +type UpdatesChannel <-chan Update + +// Clear discards all unprocessed incoming updates. +func (ch UpdatesChannel) Clear() { + for len(ch) != 0 { + <-ch + } +} + // User is a user on Telegram. type User struct { ID int `json:"id"` @@ -61,12 +80,13 @@ type GroupChat struct { // Chat contains information about the place a message was sent. type Chat struct { - ID int64 `json:"id"` - Type string `json:"type"` - Title string `json:"title"` // optional - UserName string `json:"username"` // optional - FirstName string `json:"first_name"` // optional - LastName string `json:"last_name"` // optional + ID int64 `json:"id"` + Type string `json:"type"` + Title string `json:"title"` // optional + UserName string `json:"username"` // optional + FirstName string `json:"first_name"` // optional + LastName string `json:"last_name"` // optional + AllMembersAreAdmins bool `json:"all_members_are_administrators"` // optional } // IsPrivate returns if the Chat is a private conversation. @@ -103,6 +123,7 @@ type Message struct { Chat *Chat `json:"chat"` ForwardFrom *User `json:"forward_from"` // optional ForwardFromChat *Chat `json:"forward_from_chat"` // optional + ForwardFromMessageID int `json:"forward_from_message_id"` // optional ForwardDate int `json:"forward_date"` // optional ReplyToMessage *Message `json:"reply_to_message"` // optional EditDate int `json:"edit_date"` // optional @@ -110,6 +131,7 @@ type Message struct { Entities *[]MessageEntity `json:"entities"` // optional Audio *Audio `json:"audio"` // optional Document *Document `json:"document"` // optional + Game *Game `json:"game"` // optional Photo *[]PhotoSize `json:"photo"` // optional Sticker *Sticker `json:"sticker"` // optional Video *Video `json:"video"` // optional @@ -314,6 +336,12 @@ type ReplyKeyboardHide struct { Selective bool `json:"selective"` // optional } +// ReplyKeyboardRemove allows the Bot to hide a custom keyboard. +type ReplyKeyboardRemove struct { + RemoveKeyboard bool `json:"remove_keyboard"` + Selective bool `json:"selective"` +} + // InlineKeyboardMarkup is a custom keyboard presented for an inline bot. type InlineKeyboardMarkup struct { InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"` @@ -324,11 +352,15 @@ type InlineKeyboardMarkup struct { // // Note that some values are references as even an empty string // will change behavior. +// +// CallbackGame, if set, MUST be first button in first row. type InlineKeyboardButton struct { - Text string `json:"text"` - URL *string `json:"url,omitempty"` // optional - CallbackData *string `json:"callback_data,omitempty"` // optional - SwitchInlineQuery *string `json:"switch_inline_query,omitempty"` // optional + Text string `json:"text"` + URL *string `json:"url,omitempty"` // optional + 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 } // CallbackQuery is data sent when a keyboard button with callback data @@ -338,7 +370,9 @@ type CallbackQuery struct { From *User `json:"from"` Message *Message `json:"message"` // optional InlineMessageID string `json:"inline_message_id"` // optional - Data string `json:"data"` // optional + ChatInstance string `json:"chat_instance"` + Data string `json:"data"` // optional + GameShortName string `json:"game_short_name"` // optional } // ForceReply allows the Bot to have users directly reply to it without @@ -369,6 +403,49 @@ 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" } +// 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 { + FileID string `json:"file_id"` + Thumb PhotoSize `json:"thumb"` + FileName string `json:"file_name"` + MimeType string `json:"mime_type"` + FileSize int `json:"file_size"` +} + +// 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"` + LastErrorDate int `json:"last_error_date"` // optional + LastErrorMessage string `json:"last_error_message"` // optional +} + +// IsSet returns true if a webhook is currently set. +func (info WebhookInfo) IsSet() bool { + return info.URL != "" +} + // InlineQuery is a Query from Telegram for an inline request. type InlineQuery struct { ID string `json:"id"` @@ -460,6 +537,7 @@ type InlineQueryResultAudio struct { ID string `json:"id"` // required URL string `json:"audio_url"` // required Title string `json:"title"` // required + Caption string `json:"caption"` Performer string `json:"performer"` Duration int `json:"audio_duration"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` @@ -472,6 +550,7 @@ type InlineQueryResultVoice struct { ID string `json:"id"` // required URL string `json:"voice_url"` // required Title string `json:"title"` // required + Caption string `json:"caption"` Duration int `json:"voice_duration"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` @@ -507,6 +586,14 @@ type InlineQueryResultLocation struct { ThumbHeight int `json:"thumb_height"` } +// InlineQueryResultGame is an inline query response game. +type InlineQueryResultGame struct { + Type string `json:"type"` + ID string `json:"id"` + GameShortName string `json:"game_short_name"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup"` +} + // ChosenInlineResult is an inline query result chosen by a User type ChosenInlineResult struct { ResultID string `json:"result_id"` |