add dev/production flags

This commit is contained in:
lyx0 2021-10-29 17:05:07 +02:00
parent a33b72f4ff
commit a2d34a5317

View file

@ -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()
}