38 lines
772 B
Go
38 lines
772 B
Go
package main
|
|
|
|
import (
|
|
"gopkg.in/yaml.v3"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
type Settings struct {
|
|
BotToken string `yaml:"token"`
|
|
MaxRatio float32 `yaml:"maxRatio"`
|
|
MaxQueueLength int `yaml:"maxQueueLength"`
|
|
MaxProjects int `yaml:"maxProjects"`
|
|
Admin int64 `yaml:"admin"`
|
|
Password string `yaml:"password"`
|
|
Blacklist []int64 `yaml:"blacklist"`
|
|
Whitelist []int64 `yaml:"whitelist"`
|
|
Mac string `yaml:"mac"`
|
|
DontPrint bool `yaml:"dontPrint"`
|
|
}
|
|
|
|
func getSettings() Settings {
|
|
|
|
file, err := os.ReadFile("./config.yml")
|
|
if err != nil {
|
|
log.Fatalln("Error reading config", err)
|
|
}
|
|
|
|
var s = Settings{}
|
|
err = yaml.Unmarshal(file, &s)
|
|
if err != nil {
|
|
log.Fatalln("Error parsing config", err)
|
|
}
|
|
|
|
return s
|
|
|
|
}
|