43 lines
725 B
Go
43 lines
725 B
Go
package config
|
|
|
|
import (
|
|
"github.com/BurntSushi/toml"
|
|
"log"
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
type config struct {
|
|
APIToken string
|
|
DebugMode bool
|
|
PrivilegedUsers []int64
|
|
Shutup map[int64]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)
|
|
}
|
|
|
|
BotConfig.Shutup = make(map[int64]time.Time)
|
|
|
|
log.Printf("[config] Config loaded as: %+v\n", BotConfig)
|
|
}
|