all repos — telegram-bot-api @ c4515aa388616a8605506b814ffe5a62e4eae46e

Golang bindings for the Telegram Bot API

Small fixes
Gleb Sinyavsky zhulik.gleb@gmail.com
Sat, 21 Nov 2015 14:44:26 +0300
commit

c4515aa388616a8605506b814ffe5a62e4eae46e

parent

207a1a08f29fa32366ce1daafd54921613ba484e

3 files changed, 6 insertions(+), 23 deletions(-)

jump to
M bot.gobot.go

@@ -423,20 +423,3 @@ http.HandleFunc(pattern, handler)

return handler } - -// SendChatAction sets a current action in a chat. -// -// Requires ChatID and a valid Action (see Chat constants). -func (bot *BotAPI) SendChatAction(config ChatActionConfig) error { - v, err := config.Values() - if err != nil { - return err - } - - _, err = bot.MakeRequest("sendChatAction", v) - if err != nil { - return err - } - - return nil -}
M bot_test.gobot_test.go

@@ -2,13 +2,13 @@ package tgbotapi_test

import ( "github.com/zhulik/telegram-bot-api" + "io/ioutil" "log" "net/http" "net/http/httptest" "os" "strings" "testing" - "io/ioutil" ) func TestMain(m *testing.M) {

@@ -117,8 +117,6 @@ t.Fail()

} } - - func TestSendWithNewPhotoWithFileBytes(t *testing.T) { bot, err := tgbotapi.NewBotAPI(os.Getenv("TELEGRAM_API_TOKEN"))

@@ -138,7 +136,6 @@ t.Fail()

} } - func TestSendWithNewPhotoWithFileReader(t *testing.T) { bot, err := tgbotapi.NewBotAPI(os.Getenv("TELEGRAM_API_TOKEN"))

@@ -157,7 +154,6 @@ if err != nil {

t.Fail() } } - func TestSendWithNewPhotoReply(t *testing.T) { bot, err := tgbotapi.NewBotAPI(os.Getenv("TELEGRAM_API_TOKEN"))

@@ -435,7 +431,7 @@ if err != nil {

t.Fail() } - err = bot.SendChatAction(tgbotapi.NewChatAction(76918703, tgbotapi.ChatTyping)) + _, err = bot.Send(tgbotapi.NewChatAction(76918703, tgbotapi.ChatTyping)) if err != nil { t.Fail()
M configs.goconfigs.go

@@ -415,6 +415,10 @@ v.Add("action", config.Action)

return v, nil } +func (config ChatActionConfig) Method() string { + return "sendChatAction" +} + // UserProfilePhotosConfig contains information about a GetUserProfilePhotos request. type UserProfilePhotosConfig struct { UserID int