|
|
|
@ -6,6 +6,7 @@ import (
|
|
|
|
|
|
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
|
|
|
|
|
|
"PermissionGacha/modules/config"
|
|
|
|
|
"PermissionGacha/modules/level"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -21,12 +22,22 @@ func handleLevelCommand(s *discordgo.Session, args []string, m *discordgo.Messag
|
|
|
|
|
if xp > levelUpRequirement {
|
|
|
|
|
xp -= 100
|
|
|
|
|
}
|
|
|
|
|
s.ChannelMessageSend(
|
|
|
|
|
m.ChannelID,
|
|
|
|
|
fmt.Sprintf(
|
|
|
|
|
"<@%s> is now level %d. (%d XP/%d XP) [%.1f%%]",
|
|
|
|
|
m.Author.ID, levels, xp, levelUpRequirement, float64(xp)/float64(levelUpRequirement)*100,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
if levels < len(config.LevelRoles) {
|
|
|
|
|
s.ChannelMessageSend(
|
|
|
|
|
m.ChannelID,
|
|
|
|
|
fmt.Sprintf(
|
|
|
|
|
"<@%s> is now level %d. (%d XP/%d XP) [%.1f%%]",
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|