From 96a104444e0fd64c3a220b763abf57386a7d909e Mon Sep 17 00:00:00 2001 From: Jqs7 <7@jqs7.com> Date: Wed, 5 Aug 2015 09:44:09 +0800 Subject: [PATCH] Updated to the last tgbot API --- methods.go | 8 ++++++++ types.go | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/methods.go b/methods.go index a724303..9c8474d 100644 --- a/methods.go +++ b/methods.go @@ -99,6 +99,8 @@ type StickerConfig struct { // VideoConfig contains information about a SendVideo request. type VideoConfig struct { ChatID int + Duration int + Caption string ReplyToMessageID int ReplyMarkup interface{} UseExistingVideo bool @@ -600,6 +602,12 @@ func (bot *BotAPI) SendVideo(config VideoConfig) (Message, error) { if config.ReplyToMessageID != 0 { v.Add("reply_to_message_id", strconv.Itoa(config.ReplyToMessageID)) } + if config.Duration != 0 { + v.Add("duration", strconv.Itoa(config.Duration)) + } + if config.Caption != "" { + v.Add("caption", config.Caption) + } if config.ReplyMarkup != nil { data, err := json.Marshal(config.ReplyMarkup) if err != nil { diff --git a/types.go b/types.go index f3c4e69..fda3298 100644 --- a/types.go +++ b/types.go @@ -73,6 +73,7 @@ type Message struct { Photo []PhotoSize `json:"photo"` Sticker Sticker `json:"sticker"` Video Video `json:"video"` + Caption string `json:"caption"` Contact Contact `json:"contact"` Location Location `json:"location"` NewChatParticipant User `json:"new_chat_participant"` @@ -136,7 +137,6 @@ type Video struct { Thumbnail PhotoSize `json:"thumb"` MimeType string `json:"mime_type"` FileSize int `json:"file_size"` - Caption string `json:"caption"` } // Contact contains information about a contact, such as PhoneNumber and UserId. @@ -144,7 +144,7 @@ type Contact struct { PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name"` - UserID string `json:"user_id"` + UserID int `json:"user_id"` } // Location contains information about a place, such as Longitude and Latitude.