remotes/1693045480750635534/spooky-22
Aevann1 2021-08-09 14:21:29 +02:00
parent 44a8e4df9a
commit a76ea8c7a6
3 changed files with 11 additions and 11 deletions

View File

@ -53,9 +53,9 @@ def transfer_coins(v, username):
amount = request.form.get("amount", "")
amount = int(amount) if amount.isdigit() else None
if amount is None or amount <= 0: return {"error": f"Invalid amount of {app.config['SITE_NAME']}coins."}, 400
if v.coins < amount: return {"error": f"You don't have enough {app.config['SITE_NAME']}coins"}, 400
if amount < 100: return {"error": f"You have to gift at least 100 {app.config['SITE_NAME']}coins."}, 400
if amount is None or amount <= 0: return {"error": f"Invalid amount of {app.config['COINS_NAME']}."}, 400
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
@ -64,9 +64,9 @@ def transfer_coins(v, username):
g.db.commit()
transfer_message = f"🤑 [@{v.username}]({v.url}) has gifted you {amount} {app.config['SITE_NAME']}coins!"
transfer_message = f"🤑 [@{v.username}]({v.url}) has gifted you {amount} {app.config['COINS_NAME']}!"
send_notification(v.id, receiver, transfer_message)
return {"message": f"{amount} {app.config['SITE_NAME']}coins transferred!"}, 200
return {"message": f"{amount} {app.config['COINS_NAME']} transferred!"}, 200
return "", 204

View File

@ -79,7 +79,7 @@
<div><img 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.animatedname %}{% if v.patron %}patron{% else %}leaderboard{% endif %}{% endif %}">{{v.username}}</div>
<div class="text-small-extra text-purple"><i class="fad fa-coins mr-1"></i><span id="user-coins-amount">{{v.coins}}</span> {{"SITE_NAME" | app_config}}coins</div>
<div class="text-small-extra text-purple"><i class="fad fa-coins mr-1"></i><span id="user-coins-amount">{{v.coins}}</span> {{"COINS_NAME" | app_config}}</div>
</div>
</div>
</a>

View File

@ -25,7 +25,7 @@
<meta property="og:article:author" content="@{{u.username}}" />
<meta property="article:section" content="{{u.username}}'s profile - {{"SITE_NAME" | app_config}}" />
<meta property="article:published_time" content="{{u.created_date}}" />
<meta property="og:description" name="description" content="{{u.coins}} {{"SITE_NAME" | app_config}}coins - Joined {{u.created_date}} - {% if u.stored_subscriber_count >=1 and not u.is_private and not u.is_nofollow %}{{u.stored_subscriber_count}} Followers - {% endif %}{% if not u.is_private %}{{u.post_count}} Posts - {{u.comment_count}} Comments - {% endif %}{{u.bio}}" />
<meta property="og:description" name="description" content="{{u.coins}} {{"COINS_NAME" | app_config}} - Joined {{u.created_date}} - {% if u.stored_subscriber_count >=1 and not u.is_private and not u.is_nofollow %}{{u.stored_subscriber_count}} Followers - {% endif %}{% if not u.is_private %}{{u.post_count}} Posts - {{u.comment_count}} Comments - {% endif %}{{u.bio}}" />
<meta property="og:author" name="author" content="@{{u.username}}" />
<meta property="og:title" content="{{u.username}}" />
<meta property="og:image" content="{% if u.bannerurl %}{{u.banner_url}}{% else %}{{'/assets/images/preview.png' | full_link}}{% endif %}" />
@ -36,7 +36,7 @@
<meta name="twitter:site" content="{{request.host_url}}">
<meta name="twitter:title" content="{{u.username}}'s profile - {{"SITE_NAME" | app_config}}" />
<meta name="twitter:creator" content="@{{u.username}}">
<meta name="twitter:description" content="{{u.coins}} {{"SITE_NAME" | app_config}}coins - Joined {{u.created_date}} - {% if u.stored_subscriber_count >=1 and not u.is_private and not u.is_nofollow %}{{u.stored_subscriber_count}} Followers -{% endif %} {% if not u.is_private %} {{u.post_count}} Posts - {{u.comment_count}} Comments -{% endif %} {{u.bio}}" />
<meta name="twitter:description" content="{{u.coins}} {{"COINS_NAME" | app_config}} - Joined {{u.created_date}} - {% if u.stored_subscriber_count >=1 and not u.is_private and not u.is_nofollow %}{{u.stored_subscriber_count}} Followers -{% endif %} {% if not u.is_private %} {{u.post_count}} Posts - {{u.comment_count}} Comments -{% endif %} {{u.bio}}" />
<meta name="twitter:image" content="{% if u.bannerurl %}{{u.banner_url}}{% else %}{{'/assets/images/preview.png' | full_link}}{% endif %}" />
<meta name="twitter:url" content="{{u.url | full_link}}" />
{% endblock %}
@ -151,7 +151,7 @@
{% if u.customtitle %}<p class="font-weight-bolder" style="color: #{{u.titlecolor}}">{{u.customtitle | safe}}</p>{% endif %}
<div class="font-weight-bolder">
<span id="profile-coins-amount">{{u.coins}}</span> {{"SITE_NAME" | app_config}}coins&nbsp;&nbsp; {% if u.stored_subscriber_count >=1 and not u.is_nofollow %}<a href="/@{{u.username}}/followers">{{u.stored_subscriber_count}} follower{{'s' if u.stored_subscriber_count != 1 else ''}}</a>&nbsp;&nbsp; {% endif %}joined <span data-toggle="tooltip" data-placement="bottom" title="" data-original-title="{{u.created_datetime}}">{{u.created_date}}</span>
<span id="profile-coins-amount">{{u.coins}}</span> {{"COINS_NAME" | app_config}}&nbsp;&nbsp; {% if u.stored_subscriber_count >=1 and not u.is_nofollow %}<a href="/@{{u.username}}/followers">{{u.stored_subscriber_count}} follower{{'s' if u.stored_subscriber_count != 1 else ''}}</a>&nbsp;&nbsp; {% endif %}joined <span data-toggle="tooltip" data-placement="bottom" title="" data-original-title="{{u.created_datetime}}">{{u.created_date}}</span>
</div>
{% if u.bio_html %}
@ -172,7 +172,7 @@
<a class="btn btn-primary" href="javascript:void(0)" onclick="toggleElement('profile-toggleable', 'message')">Message</a>
<a class="btn btn-primary" href="javascript:void(0)" onclick="post('/@{{u.username}}/suicide', function(){window.location.reload(true);})">Get them help</a>
<a class="btn btn-primary" href="javascript:void(0)" onclick="toggleElement('profile-toggleable', 'coin-transfer')">Gift {{"SITE_NAME" | app_config}}coins</a>
<a class="btn btn-primary" href="javascript:void(0)" onclick="toggleElement('profile-toggleable', 'coin-transfer')">Gift {{"COINS_NAME" | app_config}}</a>
<form class="d-none profile-toggleable" id="message" action="/@{{u.username}}/message" method="post">
<pre></pre>
<textarea id="input-message" form="message" name="message" rows="3" class="form-control" required></textarea>
@ -346,7 +346,7 @@
{% endif %}
{% if u.customtitle %}<p style="color: #{{u.titlecolor}}">{{u.customtitle | safe}}</p>{% endif %}
<div class="font-weight-normal">
<span class="font-weight-bold">{{u.coins}}</span> {{"SITE_NAME" | app_config}}coins&nbsp;&nbsp;{% if u.stored_subscriber_count >=1 and not u.is_nofollow %}<a href="/@{{u.username}}/followers" class="font-weight-bold">{{u.stored_subscriber_count}} follower{{'s' if u.stored_subscriber_count != 1 else ''}}</a>&nbsp;&nbsp; {% endif %}<br>joined <span data-toggle="tooltip" data-placement="bottom" title="" data-original-title="{{u.created_datetime}}" class="font-weight-bold">{{u.created_date}}</span>
<span class="font-weight-bold">{{u.coins}}</span> {{"COINS_NAME" | app_config}}&nbsp;&nbsp;{% if u.stored_subscriber_count >=1 and not u.is_nofollow %}<a href="/@{{u.username}}/followers" class="font-weight-bold">{{u.stored_subscriber_count}} follower{{'s' if u.stored_subscriber_count != 1 else ''}}</a>&nbsp;&nbsp; {% endif %}<br>joined <span data-toggle="tooltip" data-placement="bottom" title="" data-original-title="{{u.created_datetime}}" class="font-weight-bold">{{u.created_date}}</span>
</div>
{% if u.bio_html %}
<p class="text-muted text-break">{{u.bio_html | safe}}</p>