aboutsummaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
Diffstat (limited to 'user')
-rw-r--r--user/xp.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/user/xp.go b/user/xp.go
index 7e58665..6dbed59 100644
--- a/user/xp.go
+++ b/user/xp.go
@@ -87,10 +87,17 @@ func (c *Copaing) GetXPForDays(n uint) (uint, error) {
}
func (c *Copaing) GetBoost(m *discordgo.Member) float64 {
+ boost := 1.0
if m.PremiumSince != nil {
- return 2.0
+ boost = max(boost, 2.0)
}
- return 1.0
+ cfg := config.GetGuildConfig(c.GuildID)
+ for _, r := range cfg.BoostXpRoles {
+ if slices.Contains(m.Roles, r.RoleID) {
+ boost = max(boost, r.Boost)
+ }
+ }
+ return boost
}
// GetBestXP returns n Copaing with the best XP within d days (d <= cfg.DaysXPRemain; d < 0 <=> d = cfg.DaysXPRemain)