Skip to content

Commit

Permalink
Allow bot to run even if a config fails to load
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonhasacat committed Feb 7, 2024
1 parent 87b9d1d commit 889cb26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/bot/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/VATUSA/discord-bot-v3/pkg/constants"
"gopkg.in/yaml.v3"
"io/ioutil"
"log"
"os"
)

Expand Down Expand Up @@ -41,7 +42,7 @@ type ConditionConfig struct {
func LoadAllServerConfigOrPanic(configPath string) map[string]ServerConfig {
configs, err := LoadAllServerConfig(configPath)
if err != nil {
panic(err.Error())
log.Printf(err.Error())
}
return configs
}
Expand All @@ -56,7 +57,8 @@ func LoadAllServerConfig(configPath string) (map[string]ServerConfig, error) {
if !f.IsDir() {
cfg, err := LoadServerConfig(fmt.Sprintf("%s/%s", configPath, f.Name()))
if err != nil {
return nil, err
log.Printf(err.Error())
return nil, nil
}
configs[cfg.ID] = *cfg
}
Expand Down

0 comments on commit 889cb26

Please sign in to comment.