fix(command): reset-user not working and can reset bot

This commit is contained in:
Anhgelus Morhtuuzh 2024-04-16 16:10:08 +02:00
parent ac73839583
commit 6c2436093b
No known key found for this signature in database
GPG key ID: CF4550297832A29F
2 changed files with 8 additions and 2 deletions

View file

@ -28,8 +28,14 @@ func ResetUser(s *discordgo.Session, i *discordgo.InteractionCreate) {
return return
} }
m := v.UserValue(s) m := v.UserValue(s)
if m.Bot {
if err := resp.Message("Les bots n'ont pas de niveau :upside_down:").Send(); err != nil {
utils.SendAlert("commands/reset.go - Copaing not set", err.Error())
}
return
}
xp.GetCopaing(m.ID, i.GuildID).Reset() xp.GetCopaing(m.ID, i.GuildID).Reset()
if err := resp.Message("Le a bien été reset.").Send(); err != nil { if err := resp.Message("Le copaing bien été reset.").Send(); err != nil {
utils.SendAlert("commands/reset.go - Sending success (copaing)", err.Error()) utils.SendAlert("commands/reset.go - Sending success (copaing)", err.Error())
} }
} }

View file

@ -186,7 +186,7 @@ func (c *Copaing) GetUserBase() *gokord.UserBase {
} }
func (c *Copaing) Reset() { func (c *Copaing) Reset() {
gokord.DB.Where("guild_id = ? AND discord_id", c.GuildID, c.DiscordID).Delete(c) gokord.DB.Where("guild_id = ? AND discord_id = ?", c.GuildID, c.DiscordID).Delete(c)
} }
func getRedisClient() (*redis.Client, error) { func getRedisClient() (*redis.Client, error) {