modules/commands/level: Do not display percentage on max level

master
Luther Wen Xu 2019-12-13 18:52:06 +07:00
parent e9d2db3023
commit cc9b770cf6
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
1 changed files with 18 additions and 7 deletions

@ -6,6 +6,7 @@ import (
"github.com/bwmarrin/discordgo"
"PermissionGacha/modules/config"
"PermissionGacha/modules/level"
)
@ -21,6 +22,7 @@ func handleLevelCommand(s *discordgo.Session, args []string, m *discordgo.Messag
if xp > levelUpRequirement {
xp -= 100
}
if levels < len(config.LevelRoles) {
s.ChannelMessageSend(
m.ChannelID,
fmt.Sprintf(
@ -28,5 +30,14 @@ func handleLevelCommand(s *discordgo.Session, args []string, m *discordgo.Messag
m.Author.ID, levels, xp, levelUpRequirement, float64(xp)/float64(levelUpRequirement)*100,
),
)
} else {
s.ChannelMessageSend(
m.ChannelID,
fmt.Sprintf(
"<@%s> is now level %d. (%d XP) [MAX LEVEL]",
m.Author.ID, levels, xp,
),
)
}
return nil
}