From ae88ec1b9b73e3cd74d6f561ff5baca42374eebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=81scar=20M=2E=20Lage?= Date: Thu, 28 Nov 2024 23:24:17 +0100 Subject: [PATCH] Del: leftovers --- internal/bot/controller.go | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/internal/bot/controller.go b/internal/bot/controller.go index 632a1d6..b3ca5c0 100644 --- a/internal/bot/controller.go +++ b/internal/bot/controller.go @@ -83,41 +83,3 @@ func ProcesarMensaje(update tgbotapi.Update, db *gorm.DB) { log.Printf("Evento %s registrado con éxito para el %s", command, timestamp.Format("2006-01-02 15:04")) } - -func ProcesarMensaje2(update tgbotapi.Update, db *gorm.DB) { - if update.Message == nil || update.Message.Text == "" { - return - } - - parts := strings.Fields(update.Message.Text) - command := strings.ToUpper(parts[0]) - var timestamp time.Time - - if len(parts) == 1 { - timestamp = update.Message.Time() - } else { - parsedTime, err := time.Parse("15:04", parts[1]) - if err != nil { - log.Println("Formato de hora inválido:", parts[1]) - return - } - now := time.Now() - timestamp = time.Date(now.Year(), now.Month(), now.Day(), parsedTime.Hour(), parsedTime.Minute(), 0, 0, now.Location()) - } - - if command != "ON" && command != "OFF" { - log.Println("Comando desconocido:", command) - return - } - - event := HeatingEvent{ - EventType: command, - Timestamp: timestamp, - } - if err := db.Create(&event).Error; err != nil { - log.Printf("Error al guardar el evento %s: %v", command, err) - return - } - - log.Printf("Evento %s registrado con éxito a las %s", command, timestamp.Format("15:04")) -}