bloaterbot
This commit is contained in:
parent
52f69d518a
commit
d53b439455
15 changed files with 452 additions and 0 deletions
63
config/config.go
Normal file
63
config/config.go
Normal file
|
@ -0,0 +1,63 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/BurntSushi/toml"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
/*type config struct {
|
||||
Bot struct {
|
||||
APIToken string
|
||||
DebugMode bool
|
||||
PrivilegedUsers []int64
|
||||
}
|
||||
|
||||
Nhentai struct {
|
||||
EnabledChats []int64
|
||||
EnabledUsers []int64
|
||||
}
|
||||
|
||||
Balonlyl struct {
|
||||
EnabledChats []int64
|
||||
}
|
||||
}*/
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue