Fix Telegram token being checked for content instead of topic
This commit is contained in:
parent
4910d2ca55
commit
3fabf4381e
1 changed files with 4 additions and 6 deletions
10
auth.go
10
auth.go
|
@ -85,13 +85,11 @@ func NotifyTelegram(msg string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
var data *strings.Reader
|
data := "chat_id=" + Cfg.TelegramChat + "&text=" + msg
|
||||||
if Cfg.TelegramToken != "" {
|
if Cfg.TelegramTopic != "" {
|
||||||
data = strings.NewReader("chat_id=" + Cfg.TelegramChat + "&message_thread_id=" + Cfg.TelegramTopic + "&text=" + msg)
|
data += "&message_thread_id=" + Cfg.TelegramTopic
|
||||||
} else {
|
|
||||||
data = strings.NewReader("chat_id=" + Cfg.TelegramChat + "&text=" + msg)
|
|
||||||
}
|
}
|
||||||
req, err := http.NewRequest("POST", "https://api.telegram.org/bot"+Cfg.TelegramToken+"/sendMessage", data)
|
req, err := http.NewRequest("POST", "https://api.telegram.org/bot"+Cfg.TelegramToken+"/sendMessage", strings.NewReader(data))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error("failed telegram request", "error", err)
|
slog.Error("failed telegram request", "error", err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue