A bunch of Changes
Docker is broken as of now, will fix later
This commit is contained in:
parent
1a6953900c
commit
6375fe5af1
27 changed files with 258 additions and 81 deletions
|
@ -38,14 +38,14 @@ var BotConfig config
|
|||
|
||||
func LoadConfig() {
|
||||
|
||||
configFile, err := os.ReadFile("config.toml")
|
||||
configFile, err := os.ReadFile("data/config.toml")
|
||||
if err != nil {
|
||||
log.Panic().Err(err).Msg("error opening config file")
|
||||
log.Panic().Err(err).Msg("error opening data/config.toml")
|
||||
}
|
||||
|
||||
_, err = toml.Decode(string(configFile), &BotConfig)
|
||||
if err != nil {
|
||||
log.Panic().Err(err).Msg("error decoding config file")
|
||||
log.Panic().Err(err).Msg("error decoding data/config.toml")
|
||||
}
|
||||
|
||||
BotConfig.Shutup = make(map[int64]time.Time)
|
||||
|
@ -102,18 +102,18 @@ func EncodeToml() {
|
|||
},
|
||||
}
|
||||
|
||||
f, err := os.Create("config.toml.example")
|
||||
f, err := os.Create("data/config.toml.example")
|
||||
if err != nil {
|
||||
log.Panic().Err(err).Msg("error encoding config file. Cannot open config.toml.example")
|
||||
log.Panic().Err(err).Msg("error encoding config file. Cannot open data/config.toml.example")
|
||||
}
|
||||
|
||||
if err := toml.NewEncoder(f).Encode(exampleConfig); err != nil {
|
||||
log.Panic().Err(err).Msg("error encoding config file")
|
||||
}
|
||||
if err := f.Close(); err != nil {
|
||||
log.Panic().Err(err).Msg("error encoding config file. Cannot close config.toml.example")
|
||||
log.Panic().Err(err).Msg("error encoding config file. Cannot close data/config.toml.example")
|
||||
|
||||
}
|
||||
|
||||
log.Info().Msg("Wrote example config to config.toml.example. Bye Bye")
|
||||
log.Info().Msg("Wrote example config to data/config.toml.example. Bye Bye")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue