Added config generator
This commit is contained in:
parent
dbb7552fe3
commit
d4fd21d98e
4 changed files with 104 additions and 7 deletions
|
@ -11,7 +11,10 @@ type config struct {
|
|||
APIToken string
|
||||
DebugMode bool
|
||||
PrivilegedUsers []int64
|
||||
Shutup map[int64]time.Time
|
||||
Shutup map[int64]time.Time //is always filled at startup, not present in config
|
||||
Webserver struct {
|
||||
Port string
|
||||
}
|
||||
Balonlyl struct {
|
||||
EnabledChats []int64
|
||||
BalonlylAT string
|
||||
|
@ -50,3 +53,65 @@ func LoadConfig() {
|
|||
log.Debug().Interface("config", BotConfig).Msg("")
|
||||
|
||||
}
|
||||
|
||||
func EncodeToml() {
|
||||
|
||||
exampleConfig := config{
|
||||
APIToken: "1234567:h8Y7ma7hMG93kxDx5o",
|
||||
DebugMode: false,
|
||||
PrivilegedUsers: []int64{1234567,9764382423},
|
||||
Webserver: struct{ Port string }{
|
||||
Port: "3000",
|
||||
},
|
||||
Balonlyl: struct {
|
||||
EnabledChats []int64
|
||||
BalonlylAT string
|
||||
TriggerWords []string
|
||||
}{
|
||||
EnabledChats: []int64{353454534,8743658},
|
||||
BalonlylAT: "@Balonlyl",
|
||||
TriggerWords: []string{"French, France"},
|
||||
},
|
||||
GayPoints: struct {
|
||||
EnabledChats []int64
|
||||
ModifyUsers []int64
|
||||
}{
|
||||
EnabledChats: []int64{353454534,8743658},
|
||||
ModifyUsers: []int64{3827468324,1736576},
|
||||
},
|
||||
Download: struct {
|
||||
Prefix string
|
||||
Yourls struct {
|
||||
APIPath string
|
||||
Signature string
|
||||
}
|
||||
}{
|
||||
Prefix: "https://bloater.example.com",
|
||||
Yourls: struct {
|
||||
APIPath string
|
||||
Signature string
|
||||
}{
|
||||
APIPath: "https://short.com/yourls-api.php",
|
||||
Signature: "kfn83h28r",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
f, err := os.Create("config.toml.example")
|
||||
if err != nil {
|
||||
log.Panic().Err(err).Msg("error encoding config file. Cannot open 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.Info().Msg("Wrote example config to config.toml.example. Bye Bye")
|
||||
os.Exit(0)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue