bloaterbot/bot.go
watn3y 6375fe5af1 A bunch of Changes
Docker is broken as of now, will fix later
2023-12-29 05:15:23 +01:00

43 lines
854 B
Go

package main
import (
"time"
"github.com/rs/zerolog/log"
"watn3y.de/bloaterbot/botIO"
"watn3y.de/bloaterbot/commands"
"watn3y.de/bloaterbot/commands/notify"
"watn3y.de/bloaterbot/inline/nenefoot"
"watn3y.de/bloaterbot/text"
)
func bot() {
updates, bot := botIO.Authenticate()
go notify.NotifyHandler(bot)
for update := range updates {
log.Debug().Interface("update", update).Msg("Recieved update")
if update.InlineQuery != nil && update.Message == nil {
nenefoot.Nenefoot(update, bot)
continue
}
if update.Message != nil {
if update.Message.Time().UTC().Unix() < time.Now().UTC().Unix() {
continue
}
if update.Message.IsCommand() {
commands.Commands(update, bot)
} else {
text.Matcher(update, bot)
continue
}
}
log.Info().Interface("update", update).Msg("Unable to parse update")
}
}