mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 06:27:03 +01:00
Purchasing rich embeds is now avaliable
This commit is contained in:
parent
aa49b2d473
commit
b8b602713a
@ -515,6 +515,10 @@ def donate_patch():
|
|||||||
subtract_amt = 300
|
subtract_amt = 300
|
||||||
if entry is not None and entry.guest_icon:
|
if entry is not None and entry.guest_icon:
|
||||||
abort(400)
|
abort(400)
|
||||||
|
if item == "send_rich_embed":
|
||||||
|
subtract_amt = 300
|
||||||
|
if entry is not None and entry.send_rich_embed:
|
||||||
|
abort(400)
|
||||||
amt_change = -1 * subtract_amt * amount
|
amt_change = -1 * subtract_amt * amount
|
||||||
subtract = set_titan_token(session["user_id"], amt_change, "BUY " + item + " x" + str(amount))
|
subtract = set_titan_token(session["user_id"], amt_change, "BUY " + item + " x" + str(amount))
|
||||||
if not subtract:
|
if not subtract:
|
||||||
@ -530,6 +534,10 @@ def donate_patch():
|
|||||||
if not entry:
|
if not entry:
|
||||||
entry = Cosmetics(session["user_id"])
|
entry = Cosmetics(session["user_id"])
|
||||||
entry.guest_icon = True
|
entry.guest_icon = True
|
||||||
|
if item == "send_rich_embed":
|
||||||
|
if not entry:
|
||||||
|
entry = Cosmetics(session["user_id"])
|
||||||
|
entry.send_rich_embed = True
|
||||||
db.session.add(entry)
|
db.session.add(entry)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return ('', 204)
|
return ('', 204)
|
||||||
|
@ -63,4 +63,21 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#buy-send-rich-embed-btn").click(function () {
|
||||||
|
var formPatch = patchForm("send_rich_embed", 1);
|
||||||
|
formPatch.done(function (data) {
|
||||||
|
alert("Successfully bought send rich embed perk!");
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
formPatch.fail(function (data) {
|
||||||
|
if (data.status == 400) {
|
||||||
|
Materialize.toast('Item already purchased!', 10000);
|
||||||
|
} else if (data.status == 402) {
|
||||||
|
Materialize.toast('Insufficient token funds!', 10000);
|
||||||
|
} else {
|
||||||
|
Materialize.toast('Purchasing send rich embed perk failed!', 10000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
})();
|
})();
|
@ -58,6 +58,14 @@
|
|||||||
<a class="waves-effect waves-light btn" id="buy-guest-user-avatar-btn" {% if cosmetics.guest_icon %}disabled{% endif %}>{% if cosmetics.guest_icon %}Already Purchased{% else %}Buy{% endif %}</a>
|
<a class="waves-effect waves-light btn" id="buy-guest-user-avatar-btn" {% if cosmetics.guest_icon %}disabled{% endif %}>{% if cosmetics.guest_icon %}Already Purchased{% else %}Buy{% endif %}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col s12">
|
||||||
|
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
|
||||||
|
<h4>Send Rich Embed <strong>[300 tokens]</strong></h4>
|
||||||
|
<p class="flow-text">Lets you and your users access to send rich embed messages directly within your embed!</p>
|
||||||
|
<p>(Note: Embed Links has to be enabled to be displayed in Discord; Titan needs server permissions to Embed Links)</p>
|
||||||
|
<a class="waves-effect waves-light btn" id="buy-send-rich-embed-btn" {% if cosmetics.send_rich_embed %}disabled{% endif %}>{% if cosmetics.send_rich_embed %}Already Purchased{% else %}Buy{% endif %}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block script %}
|
{% block script %}
|
||||||
|
Loading…
Reference in New Issue
Block a user