Log enabled modules, do not run on no enabled modules

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-07-23 00:58:28 +02:00
parent 38345155d0
commit d877ce02d4
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D
2 changed files with 10 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
config.yaml
discord-community
.env

View file

@ -63,6 +63,7 @@ func main() {
discord.Identify.Intents = discordgo.IntentsAll
var enabledModules int
for _, mc := range config.ModuleConfigs {
logger := log.WithField("module", mc.Type)
mod := GetModuleByName(mc.Type)
@ -73,6 +74,14 @@ func main() {
if err = mod.Initialize(crontab, discord, mc.Attributes); err != nil {
logger.WithError(err).Fatal("Unable to initialize module")
}
enabledModules++
logger.Debug("Enabled module")
}
if enabledModules == 0 {
log.Warn("No modules were enabled, quitting now")
return
}
if err = discord.Open(); err != nil {