From a2d34a53170159d04240a2b107a5bb5db4436672 Mon Sep 17 00:00:00 2001 From: lyx0 <66651385+lyx0@users.noreply.github.com> Date: Fri, 29 Oct 2021 17:05:07 +0200 Subject: [PATCH] add dev/production flags --- cmd/main.go | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 9e1304e..142e350 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -1,6 +1,7 @@ package main import ( + "flag" "fmt" "time" @@ -9,12 +10,17 @@ import ( "github.com/lyx0/nourybot/pkg/config" "github.com/lyx0/nourybot/pkg/db" "github.com/lyx0/nourybot/pkg/handlers" + "github.com/sirupsen/logrus" ) var nb *bot.Bot func main() { + // No need to join every channel when on development mode. + runMode := flag.String("mode", "dev", "Mode in which to run. (dev/production") + flag.Parse() + conf := config.LoadConfig() nb = &bot.Bot{ @@ -41,8 +47,18 @@ func main() { handlers.PrivateMessage(message, nb) }) - // nb.TwitchClient.Join("nouryqt", "nourybot") - db.InitialJoin(nb) - // nb.Send("nourybot", "HeyGuys") + if *runMode == "production" { + // Production, joining all regular channels + logrus.Info("[PRODUCTION]: Joining every channel.") + db.InitialJoin(nb) + + } else if *runMode == "dev" { + // Development, only join my two channels + logrus.Info("[DEV]: Joining nouryqt and nourybot.") + + nb.TwitchClient.Join("nouryqt", "nourybot") + nb.Send("nourybot", "[DEV] Badabing Badaboom Pepepains") + } + nb.TwitchClient.Connect() }