54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
package config
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/BurntSushi/toml"
|
|
)
|
|
|
|
type Config struct {
|
|
Bot BotConfig `toml:"bot"`
|
|
Features FeatureConfig `toml:"features"`
|
|
}
|
|
|
|
type BotConfig struct {
|
|
Token string `toml:"token"`
|
|
GuildID uint64 `toml:"guild_id"`
|
|
}
|
|
|
|
type FeatureConfig struct {
|
|
Dictionary DictionaryConfig `toml:"dictionary"`
|
|
XDTracker XDTrackerConfig `toml:"xd_tracker"`
|
|
IconChanger IconChangerConfig `toml:"icon_changer"`
|
|
Starboard StarboardConfig `toml:"starboard"`
|
|
}
|
|
|
|
type DictionaryConfig struct {
|
|
Enabled bool `toml:"enabled"`
|
|
}
|
|
|
|
type XDTrackerConfig struct {
|
|
Enabled bool `toml:"enabled"`
|
|
}
|
|
|
|
type IconChangerConfig struct {
|
|
Enabled bool `toml:"enabled"`
|
|
ChannelID uint64 `toml:"channel_id"`
|
|
Interval time.Duration `toml:"interval"`
|
|
}
|
|
|
|
type StarboardConfig struct {
|
|
Enabled bool `toml:"enabled"`
|
|
ChannelID uint64 `toml:"channel_id"`
|
|
WebhookURL string `toml:"webhook_url"`
|
|
Threshold int `toml:"threshold"`
|
|
}
|
|
|
|
func Load(path string) (*Config, error) {
|
|
var cfg Config
|
|
_, err := toml.DecodeFile(path, &cfg)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &cfg, nil
|
|
}
|