feat: leveling system
This commit is contained in:
1 parent
2bce787c05
commit
8ba26f8bb9
9 files changed
+271
-381
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user