From 088fbb981fd55091ca7b97eed7b53def72d8d5e0 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 19:11:39 +0200 Subject: [PATCH] fdsfds --- files/routes/users.py | 38 ++++++++++++++++++----------------- files/templates/userpage.html | 28 +++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index 3024ed233..b162e19af 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -202,25 +202,27 @@ 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 - tax = math.ceil(amount*0.03) - tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).first() - tax_receiver.coins += tax/3 - 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) + if not v.patron and not receiver.patron: + tax = math.ceil(amount*0.03) + tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).first() + tax_receiver.coins += tax/3 + 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) - if request.host == 'rdrama.net': - carp = g.db.query(User).filter_by(id=CARP_ID).first() - carp.coins += tax/3 - log_message = f"[@{v.username}]({v.url}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.url})" - send_notification(CARP_ID, log_message) - g.db.add(carp) - - dad = g.db.query(User).filter_by(id=DAD_ID).first() - dad.coins += tax/3 - log_message = f"[@{v.username}]({v.url}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.url})" - send_notification(DAD_ID, log_message) - g.db.add(dad) + if request.host == 'rdrama.net': + carp = g.db.query(User).filter_by(id=CARP_ID).first() + carp.coins += tax/3 + log_message = f"[@{v.username}]({v.url}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.url})" + send_notification(CARP_ID, log_message) + g.db.add(carp) + + dad = g.db.query(User).filter_by(id=DAD_ID).first() + dad.coins += tax/3 + log_message = f"[@{v.username}]({v.url}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.url})" + send_notification(DAD_ID, log_message) + g.db.add(dad) + else: tax = 0 receiver.coins += amount-tax v.coins -= amount diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 5d04e2f85..6ad228c95 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -15,7 +15,33 @@ } - + + +{% if v and not v.patron %} + +{% endif %} + {{u.username}}'s profile - {{'SITE_NAME' | app_config}} {% if u.is_private %}