feat: leveling system
This commit is contained in:
@@ -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