diff options
| author | Fuwn <[email protected]> | 2021-07-05 18:20:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-07-05 18:20:41 -0700 |
| commit | 2bd7869b01e67031bc780e37323c339e4057ea21 (patch) | |
| tree | bffc6e2fe8914af5363e8cab9a1a49271c2ca536 | |
| parent | refactor(utilities): move utilities to seperate package (diff) | |
| download | munch-2bd7869b01e67031bc780e37323c339e4057ea21.tar.xz munch-2bd7869b01e67031bc780e37323c339e4057ea21.zip | |
feat(munch): conditional sub-process spawning (worlds/ discord bot)
| -rw-r--r-- | config.example.yml | 3 | ||||
| -rw-r--r-- | munch.go | 25 |
2 files changed, 18 insertions, 10 deletions
diff --git a/config.example.yml b/config.example.yml index 907638f..07c4ded 100644 --- a/config.example.yml +++ b/config.example.yml @@ -1,4 +1,6 @@ worlds: + enable: false + server: # These shouldn't change ip: 209.240.84.122 port: 6650 @@ -9,5 +11,6 @@ worlds: avatar: Vamp.mov discord: + enable: false token: SoMetOKen22 prefix: m~ @@ -7,6 +7,7 @@ import ( "github.com/Whirlsplash/munch/pkg/config" "github.com/Whirlsplash/munch/pkg/discord" "github.com/Whirlsplash/munch/pkg/server" + "github.com/spf13/viper" "sync" ) @@ -16,18 +17,22 @@ func main() { var wg sync.WaitGroup // Discord bot - wg.Add(1) - go func() { - discord.Do() - wg.Done() - }() - wg.Add(1) + if viper.GetBool("discord.enable") { + wg.Add(1) + go func() { + discord.Do() + wg.Done() + }() + } // Worlds bot - go func() { - server.Do() - wg.Done() - }() + if viper.GetBool("worlds.enable") { + wg.Add(1) + go func() { + server.Do() + wg.Done() + }() + } wg.Wait() } |