This commit is contained in:
lyx0 2021-10-21 00:07:18 +02:00
parent fdfe327bb3
commit a0a4632b22
3 changed files with 6 additions and 4 deletions

View file

@ -15,6 +15,7 @@ type Config struct {
func LoadConfig() *Config { func LoadConfig() *Config {
err := godotenv.Load() err := godotenv.Load()
if err != nil { if err != nil {
log.Fatal("Error loading .env") log.Fatal("Error loading .env")
} }
@ -24,6 +25,7 @@ func LoadConfig() *Config {
Oauth: os.Getenv("TWITCH_PASS"), Oauth: os.Getenv("TWITCH_PASS"),
BotUserId: os.Getenv("BOT_USER_ID"), BotUserId: os.Getenv("BOT_USER_ID"),
} }
log.Info("Config loaded succesfully") log.Info("Config loaded succesfully")
return cfg return cfg

View file

@ -10,6 +10,8 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
// Command contains all the logic for routing mesasges containing commands
// and will forward the messages to the specific command handlers.
func Command(message twitch.PrivateMessage, nb *bot.Bot) { func Command(message twitch.PrivateMessage, nb *bot.Bot) {
logrus.Info("fn Command") logrus.Info("fn Command")

View file

@ -6,10 +6,8 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
// HandlePrivateMessage takes in a twitch.Privatemessage, // PrivateMessage checks messages for correctness and forwards
// *twitch.Client and *config.Config and has the logic to decide if the provided // commands to the command handler.
// PrivateMessage is a command or not and passes it on accordingly.
// Typical twitch message tags https://paste.ivr.fi/nopiradodo.lua
func PrivateMessage(message twitch.PrivateMessage, nb *bot.Bot) { func PrivateMessage(message twitch.PrivateMessage, nb *bot.Bot) {
log.Info("fn PrivateMessage") log.Info("fn PrivateMessage")
// log.Info(message) // log.Info(message)