mirror of
https://github.com/watn3y/steamsalty.git
synced 2025-09-09 17:42:24 +02:00
v0.3
Some checks failed
Build and Push to Docker Hub on changes to master branch / docker (push) Has been cancelled
Some checks failed
Build and Push to Docker Hub on changes to master branch / docker (push) Has been cancelled
- added start command - added info command
This commit is contained in:
parent
9c64a3e4b5
commit
453f03d832
5 changed files with 98 additions and 7 deletions
28
bot.go
28
bot.go
|
@ -1,10 +1,36 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"watn3y/steamsalty/botIO"
|
||||
"watn3y/steamsalty/commands"
|
||||
"watn3y/steamsalty/steam"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func bot() {
|
||||
steam.StartWatchers(botIO.Authenticate())
|
||||
updates, bot := botIO.Authenticate()
|
||||
|
||||
go steam.StartWatchers(bot)
|
||||
|
||||
for update := range updates {
|
||||
log.Debug().Interface("update", update).Msg("Received update")
|
||||
|
||||
if update.Message == nil || update.Message.Text == "" {
|
||||
log.Debug().Int("UpdateID", update.UpdateID).Msg("Unable to parse update")
|
||||
continue
|
||||
}
|
||||
if update.Message.Time().UTC().Unix() < time.Now().UTC().Unix() {
|
||||
log.Debug().Int("UpdateID", update.UpdateID).Msg("Skipping old update")
|
||||
continue
|
||||
}
|
||||
|
||||
log.Info().Int64("ChatID", update.Message.Chat.ID).Int64("UserID", update.Message.From.ID).Str("Text", update.Message.Text).Msg("Recieved Message")
|
||||
|
||||
if update.Message.IsCommand() {
|
||||
commands.Commands(update, bot)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue