From 668499846b870e069655b289f216da34c328c716 Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 27 Feb 2023 17:02:45 +0200 Subject: [PATCH] try to fix mbux bug --- files/helpers/regex.py | 2 -- files/routes/users.py | 23 +++++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 54ac5140dd..a4f9fd9642 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -93,8 +93,6 @@ link_fix_regex = re.compile("(\[.*?\]\()(?!http|\/)(.*?\))(?!([^<]*<\/(code|pre| css_url_regex = re.compile('url\(\s*[\'"]?(.*?)[\'"]?\s*\)', flags=re.I|re.A) -marseybux_li = (0,2500,5000,10000,25000,50000,100000,250000) - linefeeds_regex = re.compile("([^\n])\n([^\n])", flags=re.A) greentext_regex = re.compile("(\n|^)>([^ >][^\n]*)", flags=re.A) diff --git a/files/routes/users.py b/files/routes/users.py index b0a951b434..fe42b4f27f 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -1331,6 +1331,8 @@ tiers={ 200: 6 } +marseybux_li = (0,2500,5000,10000,25000,50000,100000,250000) + def claim_rewards(v): g.db.flush() transactions = g.db.query(Transaction).filter_by(email=v.email, claimed=None).all() @@ -1346,20 +1348,21 @@ def claim_rewards(v): transaction.claimed = True g.db.add(transaction) - v.pay_account('marseybux', marseybux) + if marseybux: + v.pay_account('marseybux', marseybux) - send_repeatable_notification(v.id, f"You have received {marseybux} Marseybux! You can use them to buy awards or hats in the [shop](/shop) or gamble them in the [casino](/casino).") - g.db.add(v) + send_repeatable_notification(v.id, f"You have received {marseybux} Marseybux! You can use them to buy awards or hats in the [shop](/shop) or gamble them in the [casino](/casino).") + g.db.add(v) - v.patron_utc = time.time() + 2937600 + v.patron_utc = time.time() + 2937600 - if highest_tier > v.patron: - v.patron = highest_tier - for badge in g.db.query(Badge).filter(Badge.user_id == v.id, Badge.badge_id > 20, Badge.badge_id < 28).all(): - g.db.delete(badge) - badge_grant(badge_id=20+highest_tier, user=v) + if highest_tier > v.patron: + v.patron = highest_tier + for badge in g.db.query(Badge).filter(Badge.user_id == v.id, Badge.badge_id > 20, Badge.badge_id < 28).all(): + g.db.delete(badge) + badge_grant(badge_id=20+highest_tier, user=v) - print(f'@{v.username} rewards claimed successfully!', flush=True) + print(f'@{v.username} rewards claimed successfully!', flush=True) def claim_rewards_all_users():