add response code check for telegram

This commit is contained in:
Anton Markelov 2017-03-24 17:50:26 +10:00
parent d95491d05d
commit ffa4d70037

View File

@ -92,11 +92,15 @@ func (t *task) sendTelegramAlert() {
panic(err) panic(err)
} }
_, err = http.Post("https://api.telegram.org/bot"+util.Config.TelegramToken+"/sendMessage", "application/json", &telegramBuffer) resp, err := http.Post("https://api.telegram.org/bot"+util.Config.TelegramToken+"/sendMessage", "application/json", &telegramBuffer)
if err != nil { if err != nil {
t.log("Can't send telegram alert!") t.log("Can't send telegram alert!")
panic(err) panic(err)
} }
if resp.StatusCode != 200 {
t.log("Can't send telegram alert! Response code not 200!")
}
} }