From d877ce02d4755df51114ecc457dfcd342322e534 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 23 Jul 2021 00:58:28 +0200 Subject: [PATCH] Log enabled modules, do not run on no enabled modules Signed-off-by: Knut Ahlers --- .gitignore | 1 + main.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index eaaf257..1147927 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +config.yaml discord-community .env diff --git a/main.go b/main.go index 82c561c..a1272fc 100644 --- a/main.go +++ b/main.go @@ -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 {