From 76b7aaa01a3a65cadf15a4b20a0dbf813d97e87f Mon Sep 17 00:00:00 2001 From: Luther Wen Xu Date: Sun, 5 Jan 2020 17:00:23 +0800 Subject: [PATCH] modules/active+config: Allow multiple unnerfed channels --- modules/active/xp.go | 8 +++++++- modules/config/config.go | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/active/xp.go b/modules/active/xp.go index 645be4f..9bc2230 100644 --- a/modules/active/xp.go +++ b/modules/active/xp.go @@ -22,7 +22,13 @@ func Reward(s *discordgo.Session, m *discordgo.MessageCreate) { } amountToIncrement := calculateIncrement(m.Author.ID) - if m.ChannelID != config.GeneralChannelID { + found := false + for _, v := range config.GeneralChannelID { + if v == m.ChannelID { + found = true + } + } + if !found { amountToIncrement /= config.NotInGeneralNerf } multiplier, err := db.GetPrestigeMultiplier(m.Author.ID) diff --git a/modules/config/config.go b/modules/config/config.go index 0da36e8..fb18152 100644 --- a/modules/config/config.go +++ b/modules/config/config.go @@ -18,8 +18,8 @@ type config struct { } type activeNerf struct { - GeneralChannelID string `json:"channelID"` - NotInGeneralNerf int `json:"nerfFactor"` + GeneralChannelID []string `json:"channelID"` + NotInGeneralNerf int `json:"nerfFactor"` } type Reward struct { @@ -61,7 +61,7 @@ func init() { //Exposed Variables var ( - GeneralChannelID string + GeneralChannelID []string NotInGeneralNerf int ) var Admins []string