bloaterbot/bot.go
2023-03-19 22:46:00 +01:00

29 lines
627 B
Go

package main
import (
"log"
"time"
"watn3y/bloaterbotv3/botIO"
"watn3y/bloaterbotv3/commands"
"watn3y/bloaterbotv3/commands/notify"
"watn3y/bloaterbotv3/text"
)
func bot() {
updates, bot := botIO.Authenticate()
go notify.NotifyHandler(bot)
now := time.Now().UTC()
for update := range updates {
if update.Message == nil || update.Message.Time().UTC().Unix() < now.UTC().Unix() {
continue
}
log.Printf("[bot] Recieved Message: [%s] %s", update.Message.From.FirstName, update.Message.Text)
if update.Message.IsCommand() {
commands.Commands(update, bot)
} else {
text.Matcher(update, bot)
}
}
}