modules/commands/level: Fix level display

This prevents the randomizer from showing values above the level up requirement
master
Luther Wen Xu 2019-12-12 14:13:43 +07:00
parent 5e89a5d9f9
commit 07d61be4be
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
1 changed files with 3 additions and 0 deletions

@ -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(