diff --git a/files/routes/awards.py b/files/routes/awards.py
index 53f2b261a..a56979ed9 100755
--- a/files/routes/awards.py
+++ b/files/routes/awards.py
@@ -409,6 +409,29 @@ def buy(v, award):
if v.coins < price: return {"error": "Not enough coins."}, 400
v.coins -= price
v.coins_spent += price
+ if v.coins_spent >= 1000000 and not v.has_badge(73):
+ new_badge = Badge(badge_id=73, user_id=v.id)
+ g.db.add(new_badge)
+ old_badge = v.has_badge(72)
+ if old_badge: old_badge.delete()
+ elif v.coins_spent >= 500000 and not v.has_badge(72):
+ new_badge = Badge(badge_id=72, user_id=v.id)
+ g.db.add(new_badge)
+ old_badge = v.has_badge(71)
+ if old_badge: old_badge.delete()
+ elif v.coins_spent >= 250000 and not v.has_badge(71):
+ new_badge = Badge(badge_id=71, user_id=v.id)
+ g.db.add(new_badge)
+ old_badge = v.has_badge(70)
+ if old_badge: old_badge.delete()
+ elif v.coins_spent >= 100000 and not v.has_badge(70):
+ new_badge = Badge(badge_id=70, user_id=v.id)
+ g.db.add(new_badge)
+ old_badge = v.has_badge(69)
+ if old_badge: old_badge.delete()
+ elif v.coins_spent >= 10000 and not v.has_badge(69):
+ new_badge = Badge(badge_id=69, user_id=v.id)
+ g.db.add(new_badge)
g.db.add(v)
g.db.add(v)
@@ -528,9 +551,13 @@ def award_post(pid, v):
elif kind == "pause":
author.mute = True
send_notification(995, f"@{v.username} bought {kind} award!")
+ new_badge = Badge(badge_id=68, user_id=author.id)
+ g.db.add(new_badge)
elif kind == "unpausable":
author.unmutable = True
send_notification(995, f"@{v.username} bought {kind} award!")
+ new_badge = Badge(badge_id=67, user_id=author.id)
+ g.db.add(new_badge)
post.author.received_award_count += 1
g.db.add(post.author)
@@ -641,9 +668,13 @@ def award_comment(cid, v):
elif kind == "pause":
author.mute = True
send_notification(995, f"@{v.username} bought {kind} award!")
+ new_badge = Badge(badge_id=68, user_id=author.id)
+ g.db.add(new_badge)
elif kind == "unpausable":
author.unmutable = True
send_notification(995, f"@{v.username} bought {kind} award!")
+ new_badge = Badge(badge_id=67, user_id=author.id)
+ g.db.add(new_badge)
c.author.received_award_count += 1
g.db.add(c.author)
diff --git a/files/routes/users.py b/files/routes/users.py
index 9e533668a..23e75c804 100755
--- a/files/routes/users.py
+++ b/files/routes/users.py
@@ -128,15 +128,6 @@ def transfer_coins(v, username):
if v.coins < amount: return {"error": f"You don't have enough {app.config['COINS_NAME']}"}, 400
if amount < 100: return {"error": f"You have to gift at least 100 {app.config['COINS_NAME']}."}, 400
- v.coins -= amount
- receiver.coins += amount-tax
-
- transfer_message = f"🤑 [@{v.username}]({v.url}) has gifted you {amount} {app.config['COINS_NAME']}!"
- send_notification(receiver.id, transfer_message)
-
- g.db.add(receiver)
- g.db.add(v)
-
if TAX_RATE and TAX_RECEIVER_ID:
tax = math.ceil(amount*TAX_RATE)
tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).first()
@@ -144,6 +135,15 @@ def transfer_coins(v, username):
log_message = f"[@{v.username}]({v.url}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.url})"
send_notification(TAX_RECEIVER_ID, log_message)
g.db.add(tax_receiver)
+ receiver.coins += amount-tax
+
+ v.coins -= amount
+
+ transfer_message = f"🤑 [@{v.username}]({v.url}) has gifted you {amount} {app.config['COINS_NAME']}!"
+ send_notification(receiver.id, transfer_message)
+
+ g.db.add(receiver)
+ g.db.add(v)
g.db.commit()
return {"message": f"{amount-tax} {app.config['COINS_NAME']} transferred!"}, 200
diff --git a/files/templates/default.html b/files/templates/default.html
index b0d1a9194..6be3deef6 100755
--- a/files/templates/default.html
+++ b/files/templates/default.html
@@ -274,8 +274,18 @@
{% block Banner %}
{% if '@' not in request.path %}
+
-
+
{% endif %}
{% endblock %}
diff --git a/files/templates/header.html b/files/templates/header.html
index 02fdef995..9a6c8fe03 100755
--- a/files/templates/header.html
+++ b/files/templates/header.html
@@ -48,7 +48,7 @@
{% else %}
{% endif %}
-