mirror of
https://github.com/Luzifer/discord-community.git
synced 2024-11-09 15:40:03 +00:00
Log enabled modules, do not run on no enabled modules
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
38345155d0
commit
d877ce02d4
2 changed files with 10 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
|
config.yaml
|
||||||
discord-community
|
discord-community
|
||||||
.env
|
.env
|
||||||
|
|
9
main.go
9
main.go
|
@ -63,6 +63,7 @@ func main() {
|
||||||
|
|
||||||
discord.Identify.Intents = discordgo.IntentsAll
|
discord.Identify.Intents = discordgo.IntentsAll
|
||||||
|
|
||||||
|
var enabledModules int
|
||||||
for _, mc := range config.ModuleConfigs {
|
for _, mc := range config.ModuleConfigs {
|
||||||
logger := log.WithField("module", mc.Type)
|
logger := log.WithField("module", mc.Type)
|
||||||
mod := GetModuleByName(mc.Type)
|
mod := GetModuleByName(mc.Type)
|
||||||
|
@ -73,6 +74,14 @@ func main() {
|
||||||
if err = mod.Initialize(crontab, discord, mc.Attributes); err != nil {
|
if err = mod.Initialize(crontab, discord, mc.Attributes); err != nil {
|
||||||
logger.WithError(err).Fatal("Unable to initialize module")
|
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 {
|
if err = discord.Open(); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue