added proper logging to most of the code
This commit is contained in:
parent
65c6020e49
commit
7d4c9c5ab9
21 changed files with 218 additions and 283 deletions
|
@ -2,7 +2,7 @@ package config
|
|||
|
||||
import (
|
||||
"github.com/BurntSushi/toml"
|
||||
"log"
|
||||
"github.com/rs/zerolog/log"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
@ -12,12 +12,7 @@ type config struct {
|
|||
DebugMode bool
|
||||
PrivilegedUsers []int64
|
||||
Shutup map[int64]time.Time
|
||||
Nhentai struct {
|
||||
EnabledChats []int64
|
||||
APIEndpoint string
|
||||
Domain string
|
||||
}
|
||||
Balonlyl struct {
|
||||
Balonlyl struct {
|
||||
EnabledChats []int64
|
||||
BalonlylAT string
|
||||
TriggerWords []string
|
||||
|
@ -38,17 +33,20 @@ type config struct {
|
|||
var BotConfig config
|
||||
|
||||
func LoadConfig() {
|
||||
|
||||
configFile, err := os.ReadFile("config.toml")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Panic().Err(err).Msg("rror opening config file")
|
||||
}
|
||||
|
||||
_, err = toml.Decode(string(configFile), &BotConfig)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Panic().Err(err).Msg("error decoding config file")
|
||||
}
|
||||
|
||||
BotConfig.Shutup = make(map[int64]time.Time)
|
||||
|
||||
log.Printf("[config] Config loaded as: %+v\n", BotConfig)
|
||||
log.Info().Msg("loaded config file")
|
||||
log.Debug().Interface("config", BotConfig).Msg("")
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue