forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-11-07 15:53:42 +02:00
parent 975ee8fd9d
commit ee98f085f7
3 changed files with 11 additions and 20 deletions

View File

@ -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

View File

@ -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

View File

@ -109,7 +109,7 @@
<div><img loading="lazy" src="{{v.profile_url}}" class="profile-pic-35"></div>
<div class="text-left pl-2">
<div style="color: #{{v.namecolor}}" class="text-small font-weight-bold {% if v.patron %}patron{% endif %}"><span {% if v.patron %}class="patron" style="background-color:#{{v.namecolor}};"{% endif %}>{{v.username}}</span></div>
<div class="text-small-extra text-primary"><img class="mr-1 ml-1" data-bs-toggle="tooltip" data-bs-placement="bottom" height="13" src="/assets/images/emojis/marseycoin.webp" title="" data-bs-original-title="{{'COINS_NAME' | app_config}}" aria-label="{{'COINS_NAME' | app_config}}"><span>{{v.coins}}</span> {{'COINS_NAME' | app_config}}</div>
<div class="text-small-extra text-primary"><img class="mr-1 ml-1" data-bs-toggle="tooltip" data-bs-placement="bottom" height="13" src="/assets/images/emojis/marseycoin.webp" title="" data-bs-original-title="{{'COINS_NAME' | app_config}}" aria-label="{{'COINS_NAME' | app_config}}"><span id="user-coins-amount">{{v.coins}}</span> {{'COINS_NAME' | app_config}}</div>
{% if v.procoins %}<div class="text-small-extra text-primary"><img class="mr-1 ml-1" data-bs-toggle="tooltip" data-bs-placement="bottom" height="13" src="/assets/images/emojis/marseybux.webp" title="" data-bs-original-title="Marseybux" aria-label="Marseybux"><span>{{v.procoins}}</span> Marseybux</div>{% endif %}
</div>
</div>