Add user title coin cost parameter.

remotes/1693045480750635534/spooky-22
Snakes 2022-06-06 19:02:23 -04:00
parent 4aeb438c6b
commit dece3fd460
4 changed files with 15 additions and 3 deletions

View File

@ -131,8 +131,11 @@ AGENDAPOSTER_MSG = """Hi @{username},\n\nYour {type} has been automatically remo
PIN_LIMIT = 3
POST_RATE_LIMIT = "1/second;2/minute;10/hour;50/day"
USER_TITLE_COST = 0
if SITE in {'rdrama.net','devrama.xyz'}:
HOLE_COST = 200000
USER_TITLE_COST = 25
NOTIFICATIONS_ID = 1046
AUTOJANNY_ID = 2360
SNAPPY_ID = 261

View File

@ -55,4 +55,7 @@ def inject_constants():
"CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "MOOSE_ID":MOOSE_ID, "AEVANN_ID":AEVANN_ID,
"PIZZASHILL_ID":PIZZASHILL_ID, "config":app.config.get, "DEFAULT_COLOR":DEFAULT_COLOR,
"COLORS":COLORS, "ADMIGGERS":ADMIGGERS, "datetime":datetime, "time":time,
"LOTTERY_ENABLED": LOTTERY_ENABLED}
"LOTTERY_ENABLED": LOTTERY_ENABLED,
# Below this line really should be refactored as params to render_template
"USER_TITLE_COST": USER_TITLE_COST,
}

View File

@ -917,6 +917,10 @@ def settings_title_change(v):
v.customtitle = filter_emojis_only(new_name)
if USER_TITLE_COST and v.coins < USER_TITLE_COST:
return render_template("settings_profile.html", v=v, error=f"Changing flair costs {USER_TITLE_COST} DC.")
v.coins -= USER_TITLE_COST
if len(v.customtitle) < 1000:
g.db.add(v)
g.db.commit()

View File

@ -470,11 +470,13 @@
<form id="profile-settings" action="/settings/title_change" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input maxlength=100 {% if v.flairchanged %}disabled{% endif %} autocomplete="off" id="customtitlebody" type="text" name="title" class="form-control" placeholder='Enter a flair here' value="{% if v.flairchanged %}Your flair has been locked until {{ti}}{% elif v.customtitleplain %}{{v.customtitleplain}}{% endif %}">
<input maxlength=100 {% if v.flairchanged %}disabled{% endif %} autocomplete="off" id="customtitlebody" type="text" name="title" class="form-control" placeholder='Enter a flair here' value="{% if v.flairchanged %}Your flair has been locked until {{ti}}{% elif USER_TITLE_COST > v.coins %}Need {{USER_TITLE_COST}} DC to change flair!{% elif v.customtitleplain %}{{v.customtitleplain}}{% endif %}">
<div class="d-flex mt-2">
<a class="format" role="button"><i class="btn btn-secondary format d-inline-block m-0 fas fa-smile-beam" onclick="loadEmojis('customtitlebody')" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"></i></a>
&nbsp;&nbsp;&nbsp;
<small>Limit of 100 characters</small>
<small>Limit of 100 characters
{%- if USER_TITLE_COST %} — Costs {{USER_TITLE_COST}} DC to change.{% endif -%}
</small>
<input {% if v.flairchanged %}disabled{% endif %} autocomplete="off" class="btn btn-primary ml-auto" id="titleSave" type="submit" value="Change Flair">
</div>
</form>