23 lines
402 B
Go
23 lines
402 B
Go
|
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)
|
||
|
}
|
||
|
}
|
||
|
}
|