go-bot/config/config.go

36 lines
621 B
Go
Raw Normal View History

2024-04-01 09:42:29 +08:00
package config
import (
"log"
2024-04-01 09:42:29 +08:00
"github.com/BurntSushi/toml"
)
2024-04-01 09:42:29 +08:00
type Config struct {
Server struct {
2024-04-03 22:07:38 +08:00
APIURL string
POSTURL string
}
Group struct {
AllowGroup []string
AllowUser []string
AllowRole []string
BlockGroup []string
BlockUser []string
GroupNotAllow []string
UserNotAllow []string
RoleNotAllow []string
}
}
var GlobalConfig Config
func init() {
// var config Config
if _, err := toml.DecodeFile("config.toml", &GlobalConfig); err != nil {
2024-04-03 22:07:38 +08:00
println("配置文件不正确,请修改正确的配置文件!")
log.Fatal(err)
}
// fmt.Println(config.Group)
2024-04-01 09:42:29 +08:00
}