From 07d61be4be4f5f05a1180b599187af2d62586dbb Mon Sep 17 00:00:00 2001 From: Luther Wen Xu Date: Thu, 12 Dec 2019 14:13:43 +0800 Subject: [PATCH] modules/commands/level: Fix level display This prevents the randomizer from showing values above the level up requirement --- modules/commands/level.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/commands/level.go b/modules/commands/level.go index c52ab9d..05bb0a9 100644 --- a/modules/commands/level.go +++ b/modules/commands/level.go @@ -18,6 +18,9 @@ func handleLevelCommand(s *discordgo.Session, args []string, m *discordgo.Messag rand.Read(randomSource) xp := rawXP - (rawXP % 100) + ((int(randomSource[0]) + 128) % 100) levelUpRequirement := level.GetLevelUpRequirement(levels) + if xp > levelUpRequirement { + xp -= 100 + } s.ChannelMessageSend( m.ChannelID, fmt.Sprintf(