From 8a20285029129d4a4137e7d3b37ccc28622a5dfb Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Sat, 27 Feb 2021 15:43:04 +0100 Subject: [PATCH] Fix --- notifications.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/notifications.go b/notifications.go index 5804682..7467bd0 100644 --- a/notifications.go +++ b/notifications.go @@ -27,10 +27,12 @@ func sendNotification(text string) { if err := saveNotification(n); err != nil { log.Println("Failed to save notification:", err.Error()) } - if appConfig.Notifications.Telegram.Enabled { - err := sendTelegramMessage(n.Text, "", appConfig.Notifications.Telegram.BotToken, appConfig.Notifications.Telegram.ChatID) - if err != nil { - log.Println("Failed to send Telegram notification:", err.Error()) + if an := appConfig.Notifications; an != nil { + if tg := an.Telegram; tg != nil && tg.Enabled { + err := sendTelegramMessage(n.Text, "", tg.BotToken, tg.ChatID) + if err != nil { + log.Println("Failed to send Telegram notification:", err.Error()) + } } } }