Compare commits

..

No commits in common. "3fabf4381ee3c610fc3f4e79f68852ae79d40958" and "7cb1ec1bba70268669700c20eb9ce441ec02ca6b" have entirely different histories.

2 changed files with 2 additions and 6 deletions

View file

@ -85,11 +85,8 @@ func NotifyTelegram(msg string) {
return return
} }
client := &http.Client{} client := &http.Client{}
data := "chat_id=" + Cfg.TelegramChat + "&text=" + msg var data = strings.NewReader("chat_id=" + Cfg.TelegramChat + "&text=" + msg)
if Cfg.TelegramTopic != "" { req, err := http.NewRequest("POST", "https://api.telegram.org/bot"+Cfg.TelegramToken+"/sendMessage", data)
data += "&message_thread_id=" + Cfg.TelegramTopic
}
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

View file

@ -30,7 +30,6 @@ type Config struct {
TelegramToken string `config:"tg_token" type:"string"` TelegramToken string `config:"tg_token" type:"string"`
TelegramChat string `config:"tg_chat" type:"string"` TelegramChat string `config:"tg_chat" type:"string"`
TelegramTopic string `config:"tg_topic" type:"string"`
} }
var DefaultConfig = Config{ var DefaultConfig = Config{