feat(reducer): role update on new level

This commit is contained in:
Anhgelus Morhtuuzh 2024-04-16 15:23:15 +02:00
parent c3dc81bd29
commit ef39c156f9
No known key found for this signature in database
GPG key ID: CF4550297832A29F
4 changed files with 32 additions and 8 deletions

View file

@ -10,7 +10,7 @@ import (
func Rank(s *discordgo.Session, i *discordgo.InteractionCreate) {
optMap := utils.GenerateOptionMap(i)
c := xp.GetCopaing(i.Member.User.ID, i.GuildID) // current copaing = member who used /rank
xp.LastEventUpdate(c) // update xp and reset last event
xp.LastEventUpdate(s, c) // update xp and reset last event
msg := "Votre niveau"
m := i.Member
var err error
@ -41,7 +41,7 @@ func Rank(s *discordgo.Session, i *discordgo.InteractionCreate) {
}
c.DiscordID = u.ID // current copaing = member targeted by member who wrote /rank
c.Load() // reload copaing (change line before)
xp.XPUpdate(c) // update xp without resetting event
xp.XPUpdate(s, c) // update xp without resetting event
msg = fmt.Sprintf("Le niveau de %s", m.DisplayName())
}
lvl := xp.Level(c.XP)