feat: leveling system

This commit is contained in:
2026-03-17 15:35:25 +00:00
parent 2bce787c05
commit 8ba26f8bb9
9 changed files with 271 additions and 381 deletions
+2 -2
View File
@@ -56,9 +56,9 @@ func (r *Repo) UpsertLevel(ctx context.Context, lvl *Level) error {
func (r *Repo) SetLevel(ctx context.Context, guildID, userID int64, level int) error {
const q = `
INSERT INTO levels (guild, user_id, level, xp)
VALUES ($1, $2, $3, 99)
VALUES ($1, $2, $3, 0)
ON CONFLICT (guild, user_id)
DO UPDATE SET level = EXCLUDED.level, xp = 99
DO UPDATE SET level = EXCLUDED.level, xp = 0
`
_, err := r.db.ExecContext(ctx, q, guildID, userID, level)
return err