From ee98f085f736ec6ebcce176cca794733ebba6d1d Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 7 Nov 2021 15:53:42 +0200 Subject: [PATCH] fdfd --- files/helpers/const.py | 5 +---- files/routes/users.py | 24 +++++++++--------------- files/templates/header.html | 2 +- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index f9ec69436..55701bd25 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -98,7 +98,6 @@ if SITE == 'rdrama.net': ZOZBOT_ACCOUNT = 1833 AUTOPOLLER_ACCOUNT = 6176 TAX_RECEIVER_ID = 747 - TAX_RATE = 0.01 PIZZA_SHILL_ID = 2424 CARP_ID = 995 LAWLZ_ID = 3833 @@ -111,8 +110,7 @@ elif SITE == "pcmemes.net": LONGPOSTBOT_ACCOUNT = 1832 ZOZBOT_ACCOUNT = 1833 AUTOPOLLER_ACCOUNT = 3369 - TAX_RECEIVER_ID = 1 - TAX_RATE = 0 + TAX_RECEIVER_ID = 1577 PIZZA_SHILL_ID = 0 CARP_ID = 0 LAWLZ_ID = 0 @@ -125,7 +123,6 @@ else: ZOZBOT_ACCOUNT = 5 AUTOPOLLER_ACCOUNT = 6 TAX_RECEIVER_ID = 7 - TAX_RATE = 0 PIZZA_SHILL_ID = 0 CARP_ID = 0 LAWLZ_ID = 0 diff --git a/files/routes/users.py b/files/routes/users.py index 7b02024b9..f9a5e590b 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -128,26 +128,20 @@ 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 - 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() - tax_receiver.coins += tax - 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) - taxed = amount-tax - receiver.coins += taxed - else: taxed = amount - + tax = math.ceil(amount*0.01) + tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).first() + tax_receiver.coins += tax + 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 - - send_notification(receiver.id, f"🤑 [@{v.username}]({v.url}) has gifted you {taxed} {app.config['COINS_NAME']}!") - + send_notification(receiver.id, f"🤑 [@{v.username}]({v.url}) has gifted you {amount-tax} {app.config['COINS_NAME']}!") g.db.add(receiver) g.db.add(v) g.db.commit() - return {"message": f"{taxed} {app.config['COINS_NAME']} transferred!"}, 200 + return {"message": f"{amount-tax} {app.config['COINS_NAME']} transferred!"}, 200 return {"message": f"You can't transfer {app.config['COINS_NAME']} to yourself!"}, 400 diff --git a/files/templates/header.html b/files/templates/header.html index 75c450983..a2194635d 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -109,7 +109,7 @@
{{v.username}}
-
{{v.coins}} {{'COINS_NAME' | app_config}}
+
{{v.coins}} {{'COINS_NAME' | app_config}}
{% if v.procoins %}
{{v.procoins}} Marseybux
{% endif %}