all repos — telegram-bot-api @ eb6b784a5a27882aa5c911db45bfacecc31dad98

Golang bindings for the Telegram Bot API

mime_type and file_size added for file messages
Gleb Sinyavsky zhulik.gleb@gmail.com
Sun, 13 Dec 2015 20:00:20 +0300
commit

eb6b784a5a27882aa5c911db45bfacecc31dad98

parent

a274ce7a9f689a8804c8d3c4d499225ed224c54a

3 files changed, 14 insertions(+), 2 deletions(-)

jump to
M bot_test.gobot_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.goconfigs.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.gotypes_test.go

@@ -1,7 +1,7 @@

package tgbotapi_test import ( - "github.com/Syfaro/telegram-bot-api" + "github.com/zhulik/telegram-bot-api" "testing" "time" )