This commit is contained in:
Lizandro Guarnizo
2026-05-16 20:54:11 -05:00
parent f08416f11f
commit 562ffa4184
5 changed files with 44 additions and 6 deletions
+12 -2
View File
@@ -213,9 +213,19 @@ func sendTelegramAdmin(mensaje string) {
continue
}
ts := &TelegramService{BotToken: cfg.BotToken}
if err := ts.SendMessage(cfg.ChatID, mensaje); err != nil {
log.Printf("[Notif] Error enviando telegram admin (cfg %d): %v", cfg.ID, err)
sendErr := ts.SendMessage(cfg.ChatID, mensaje)
logEntry := &models.TelegramLog{
TelegramConfigID: cfg.ID,
Titulo: "Notificación del sistema",
Mensaje: mensaje,
Estado: "ok",
}
if sendErr != nil {
log.Printf("[Notif] Error enviando telegram admin (cfg %d): %v", cfg.ID, sendErr)
logEntry.Estado = "failed"
logEntry.ErrorMsg = sendErr.Error()
}
_ = models.CreateTelegramLog(logEntry)
}
}