aboutsummaryrefslogtreecommitdiff
path: root/commands/stats.go
diff options
context:
space:
mode:
authorWilliam Hergès <william@herges.fr>2025-08-31 16:26:59 +0200
committerWilliam Hergès <william@herges.fr>2025-08-31 16:26:59 +0200
commit0fe0cf1c148316d667018d3f5b3e9d91f0f6c797 (patch)
tree130a1f1901c0f4f94c99cf888da2029c8b83391e /commands/stats.go
parent6ac00e89615838154607319bdff428f778bdd432 (diff)
fix(stats): bad where condition for member
Diffstat (limited to 'commands/stats.go')
-rw-r--r--commands/stats.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/commands/stats.go b/commands/stats.go
index 3d487d3..351090f 100644
--- a/commands/stats.go
+++ b/commands/stats.go
@@ -87,12 +87,15 @@ func statsAll(s *discordgo.Session, i *discordgo.InteractionCreate, days uint) (
}
func statsMember(s *discordgo.Session, i *discordgo.InteractionCreate, days uint, discordID string) (io.WriterTo, error) {
- _, err := s.GuildMember(i.GuildID, i.Member.User.ID)
+ _, err := s.GuildMember(i.GuildID, discordID)
if err != nil {
return nil, err
}
return stats(s, i, days, func(before, after string) *gorm.DB {
- return gokord.DB.Raw(before+"WHERE guild_id = ? and created_at > ? and copaing_id = ?"+after, i.GuildID, exp.TimeStampNDaysBefore(days), discordID)
+ return gokord.DB.Raw(
+ before+"WHERE guild_id = ? and created_at > ? and copaing_id = ?"+after,
+ i.GuildID, exp.TimeStampNDaysBefore(days), user.GetCopaing(discordID, i.GuildID).ID,
+ )
})
}
@@ -171,6 +174,9 @@ func generatePlot(s *discordgo.Session, i *discordgo.InteractionCreate, days uin
p := plot.New()
p.Title.Text = "Évolution de l'XP"
p.X.Label.Text = "Jours"
+ if gokord.Debug {
+ p.X.Label.Text = "Secondes"
+ }
p.Y.Label.Text = "XP"
p.Add(plotter.NewGrid())