From 0331f3e29e6a9fee00586f0986925d5bf8935c60 Mon Sep 17 00:00:00 2001 From: Akulij Date: Tue, 25 Mar 2025 12:16:48 +0800 Subject: [PATCH] make admin notification function more readable --- cmd/app/main.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/app/main.go b/cmd/app/main.go index a99501a..d4f000a 100644 --- a/cmd/app/main.go +++ b/cmd/app/main.go @@ -384,13 +384,14 @@ func DownloadFile(filepath string, url string) error { func notifyAdminAboutError(bc BotController, errorMessage string) { // Check if AdminID is set in the config adminID := *bc.cfg.AdminID - if adminID != 0 { - msg := tgbotapi.NewMessage( - adminID, - fmt.Sprintf("Error occurred: %s", errorMessage), - ) - bc.bot.Send(msg) - } else { + if adminID == 0 { log.Println("AdminID is not set in the configuration.") } + + + msg := tgbotapi.NewMessage( + adminID, + fmt.Sprintf("Error occurred: %s", errorMessage), + ) + bc.bot.Send(msg) }