heating-monitor/internal/bot/routes.go

23 lines
402 B
Go
Raw Permalink Normal View History

2024-11-28 13:52:58 +01:00
package bot
import (
"log"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"gorm.io/gorm"
)
func StartBot(bot *tgbotapi.BotAPI, db *gorm.DB) {
u := tgbotapi.NewUpdate(0)
u.Timeout = 60
updates := bot.GetUpdatesChan(u)
for update := range updates {
if update.Message != nil {
log.Printf("Mensaje recibido: %s", update.Message.Text)
ProcesarMensaje(update, db)
}
}
}