fix(command): /rank prochain niveau not working

This commit is contained in:
Anhgelus Morhtuuzh 2024-04-15 19:30:02 +02:00
parent 9f9c27f422
commit e78c8d8c42
No known key found for this signature in database
GPG key ID: CF4550297832A29F

View file

@ -9,7 +9,7 @@ import (
func Rank(s *discordgo.Session, i *discordgo.InteractionCreate) {
optMap := utils.GenerateOptionMap(i)
c := xp.GetCopaing(i.User.ID, i.GuildID) // current copaing = member who used /rank
c := xp.GetCopaing(i.Member.User.ID, i.GuildID) // current copaing = member who used /rank
xp.LastEventUpdate(c) // update xp and reset last event
msg := "Votre niveau"
m := i.Member
@ -45,13 +45,13 @@ func Rank(s *discordgo.Session, i *discordgo.InteractionCreate) {
msg = fmt.Sprintf("Le niveau de %s", m.DisplayName())
}
lvl := xp.Level(c.XP)
nxtLvl := xp.XPForLevel(lvl + 1)
nxtLvlXP := xp.XPForLevel(lvl + 1)
err = resp.Message(fmt.Sprintf(
"%s : **%d**\n> XP : %d\n> Prochain niveau dans %d XP",
msg,
lvl,
c.XP,
nxtLvl-lvl,
nxtLvlXP-xp.XPForLevel(lvl),
)).Send()
if err != nil {
utils.SendAlert("rank.go - Sending rank", err.Error())