From 28bbdccdeb8b20f81811a79d4e8bb0337d2c5ad5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 3 Sep 2022 02:18:10 +0200 Subject: [PATCH] add hat badges --- files/routes/hats.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/files/routes/hats.py b/files/routes/hats.py index 999d97896..b9a5b746a 100644 --- a/files/routes/hats.py +++ b/files/routes/hats.py @@ -49,6 +49,14 @@ def buy_hat(v, hat_id): f":marseycapitalistmanlet: @{v.username} has just bought `{hat.name}`, you have received your %5 cut ({int(hat.price * 0.05)} {currency}) :!marseycapitalistmanlet:" ) + hat_count = g.db.query(Hat).filter_by(user_id=v.id).count() + if hat_count >= 24: + badge_grant(user=v.id, badge_id=152) + if hat_count >= 99: + badge_grant(user=ref_user, badge_id=153) + if hat_count >= 249: + badge_grant(user=ref_user, badge_id=154) + return {"message": "Hat bought!"}