aboutsummaryrefslogtreecommitdiff
path: root/munch.go
blob: 46245386d13a1628ec2bbcc92faac73ac5e18abc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2021-2021 The Whirlsplash Collective
// SPDX-License-Identifier: GPL-3.0-only

package main

import (
	"github.com/Whirlsplash/munch/pkg/config"
	"github.com/Whirlsplash/munch/pkg/discord"
	"github.com/Whirlsplash/munch/pkg/server"
	"github.com/Whirlsplash/munch/pkg/utilities"
	"github.com/spf13/viper"
	"sync"
)

func main() {
	config.Setup()
	utilities.SetupSignalHandler()

	var wg sync.WaitGroup

	// Discord bot
	if viper.GetBool("discord.enable") {
		wg.Add(1)
		go func() {
			discord.Do()
			wg.Done()
		}()
	}

	// Worlds bot
	if viper.GetBool("worlds.enable") {
		wg.Add(1)
		go func() {
			server.Do()
			wg.Done()
		}()
	}

	wg.Wait()
}