bloaterbot/config/config.go
2023-03-05 04:48:14 +01:00

46 lines
726 B
Go

package config
import (
"fmt"
"github.com/BurntSushi/toml"
"log"
"os"
"time"
)
type config struct {
APIToken string
DebugMode bool
PrivilegedUsers []int64
ShutupTime time.Time
Nhentai struct {
EnabledChats []int64
APIEndpoint string
Domain string
}
Balonlyl struct {
EnabledChats []int64
BalonlylAT string
TriggerWords []string
}
}
var BotConfig config
func LoadConfig() {
configFile, err := os.ReadFile("config.toml")
if err != nil {
log.Fatal(err)
}
_, err = toml.Decode(string(configFile), &BotConfig)
if err != nil {
log.Fatal(err)
}
if BotConfig.DebugMode {
fmt.Print("Loaded config from configfile: ")
fmt.Printf("%+v\n", BotConfig)
}
}