mime_type and file_size added for file messages
Gleb Sinyavsky zhulik.gleb@gmail.com
Sun, 13 Dec 2015 20:00:20 +0300
3 files changed,
14 insertions(+),
2 deletions(-)
M
bot_test.go
→
bot_test.go
@@ -1,7 +1,7 @@
package tgbotapi_test import ( - "github.com/Syfaro/telegram-bot-api" + "github.com/zhulik/telegram-bot-api" "io/ioutil" "log" "net/http"@@ -184,6 +184,8 @@ msg := tgbotapi.NewAudioUpload(ChatID, "tests/audio.mp3")
msg.Title = "TEST" msg.Duration = 10 msg.Performer = "TEST" + msg.MimeType = "audio/mpeg" + msg.FileSize = 688 _, err := bot.Send(msg) if err != nil {
M
configs.go
→
configs.go
@@ -93,6 +93,8 @@ FilePath string
File interface{} FileID string UseExisting bool + MimeType string + FileSize int } // Params returns map[string]string representation of BaseFile@@ -116,6 +118,14 @@ return params, err
} params["reply_markup"] = string(data) + } + + if len(file.MimeType) > 0 { + params["mime_type"] = file.MimeType + } + + if file.FileSize > 0 { + params["file_size"] = strconv.Itoa(file.FileSize) } return params, nil
M
types_test.go
→
types_test.go
@@ -1,7 +1,7 @@
package tgbotapi_test import ( - "github.com/Syfaro/telegram-bot-api" + "github.com/zhulik/telegram-bot-api" "testing" "time" )