diff --git a/command/config.go b/bot/config.go similarity index 91% rename from command/config.go rename to bot/config.go index 55105f4..ed534ce 100644 --- a/command/config.go +++ b/bot/config.go @@ -1,4 +1,4 @@ -package command +package bot const ( defaultPrefix = "!" @@ -25,6 +25,10 @@ type ( Emojis []string Channels []string } + + WeatherConfig struct { + Token string `mapstructure:"token"` + } ) func NewConfig() Config { diff --git a/cmd/bb/main.go b/cmd/bb/main.go index 6e5b08b..33166a9 100644 --- a/cmd/bb/main.go +++ b/cmd/bb/main.go @@ -12,6 +12,7 @@ import ( "strings" "syscall" + "git.kill0.net/chill9/beepboop/bot" "git.kill0.net/chill9/beepboop/command" "git.kill0.net/chill9/beepboop/lib" @@ -22,9 +23,7 @@ import ( ) var ( - defaultReactions []string = []string{"👍", "🌶️", "🤣", "😂", "🍆", "🍑", "❤️", "💦", "😍", "💩", "🔥", "🍒", "🎉", "🥳", "🎊"} - - C command.Config + C bot.Config handlers []command.CommandHandler = []command.CommandHandler{ command.NewCoinHandler(), @@ -53,7 +52,6 @@ func main() { lib.SeedMathRand() - viper.SetDefault("handler.reaction.emojis", defaultReactions) viper.SetEnvPrefix("BEEPBOOP") viper.AutomaticEnv() viper.SetConfigName("config") diff --git a/command/command.go b/command/command.go index 51b7dc8..4ffa05b 100644 --- a/command/command.go +++ b/command/command.go @@ -1,8 +1,11 @@ package command -import "github.com/bwmarrin/discordgo" +import ( + "git.kill0.net/chill9/beepboop/bot" + "github.com/bwmarrin/discordgo" +) type CommandHandler interface { Handle(s *discordgo.Session, m *discordgo.MessageCreate) - SetConfig(config Config) + SetConfig(config bot.Config) } diff --git a/command/ping.go b/command/ping.go index 92d72f1..1566809 100644 --- a/command/ping.go +++ b/command/ping.go @@ -3,13 +3,14 @@ package command import ( "strings" + "git.kill0.net/chill9/beepboop/bot" "github.com/bwmarrin/discordgo" log "github.com/sirupsen/logrus" ) type ( PingHandler struct { - config Config + config bot.Config } ) @@ -17,7 +18,7 @@ func NewPingHandler() *PingHandler { return new(PingHandler) } -func (h *PingHandler) SetConfig(config Config) { +func (h *PingHandler) SetConfig(config bot.Config) { h.config = config } diff --git a/command/random.go b/command/random.go index f6c7590..2f61581 100644 --- a/command/random.go +++ b/command/random.go @@ -7,6 +7,7 @@ import ( "strconv" "strings" + "git.kill0.net/chill9/beepboop/bot" "github.com/bwmarrin/discordgo" log "github.com/sirupsen/logrus" @@ -35,14 +36,14 @@ type ( } CoinHandler struct { - config Config + config bot.Config } RollHandler struct { - config Config + config bot.Config } RouletteHandler struct { - config Config + config bot.Config } ) @@ -153,7 +154,7 @@ func NewRollHandler() *RollHandler { return new(RollHandler) } -func (h *RollHandler) SetConfig(config Config) { +func (h *RollHandler) SetConfig(config bot.Config) { h.config = config } @@ -199,7 +200,7 @@ func NewRouletteHandler() *RouletteHandler { return new(RouletteHandler) } -func (h *RouletteHandler) SetConfig(config Config) { +func (h *RouletteHandler) SetConfig(config bot.Config) { h.config = config } @@ -229,7 +230,7 @@ func NewCoinHandler() *CoinHandler { return new(CoinHandler) } -func (h *CoinHandler) SetConfig(config Config) { +func (h *CoinHandler) SetConfig(config bot.Config) { h.config = config } diff --git a/command/time.go b/command/time.go index 0a505f7..3916192 100644 --- a/command/time.go +++ b/command/time.go @@ -5,13 +5,14 @@ import ( "strings" "time" + "git.kill0.net/chill9/beepboop/bot" "github.com/bwmarrin/discordgo" log "github.com/sirupsen/logrus" ) type ( TimeHandler struct { - config Config + config bot.Config } ) @@ -19,7 +20,7 @@ func NewTimeHandler() *TimeHandler { return new(TimeHandler) } -func (h *TimeHandler) SetConfig(config Config) { +func (h *TimeHandler) SetConfig(config bot.Config) { h.config = config } diff --git a/command/version.go b/command/version.go index 8917055..b8b6285 100644 --- a/command/version.go +++ b/command/version.go @@ -4,6 +4,7 @@ import ( "fmt" "runtime" + "git.kill0.net/chill9/beepboop/bot" "github.com/bwmarrin/discordgo" ) @@ -13,7 +14,7 @@ const ( type ( VersionHandler struct { - config Config + config bot.Config Name string } ) @@ -24,7 +25,7 @@ func NewVersionHandler(s string) *VersionHandler { return h } -func (h *VersionHandler) SetConfig(config Config) { +func (h *VersionHandler) SetConfig(config bot.Config) { h.config = config }