Add the ability to disallow words (banned words)

This commit is contained in:
Jeremy Zhang
2018-07-09 01:37:35 +00:00
parent f0f1f226e3
commit ccf9aed9ec
11 changed files with 601 additions and 0 deletions

View File

@ -161,6 +161,31 @@
<p class="red lighten-4"><strong>Your user account does not have access to change guest avatar url. Please visit the Titan Tokens shop to activate this cosmetic item.</strong></p>
{% endif %}
<input id="guest_icon" value="{{ guild['guest_icon'] }}" {% if not cosmetics.guest_icon %}disabled{% endif %}>
<br>
<p class="flow-text">Banned Words
<span class="switch">
<label>
Disable
<input type="checkbox" id="banned_words_enabled" name="banned_words_enabled" {% if guild['banned_words_enabled'] %}checked{% endif %} >
<span class="lever"></span>
Enable
</label>
</span>
</p>
<p>Prevent users from sending messages from the embed containing these words.</p>
<div class="switch">
<span>Include <a href="{{ url_for("global_banned_words") }}" target="_blank">Global Banned Words</a> to the list</span>
<label>
Disable
<input type="checkbox" id="banned_words_global_included" name="banned_words_global_included" {% if guild['banned_words_global_included'] %}checked{% endif %} >
<span class="lever"></span>
Enable
</label>
</div>
<p>(Hit enter after each word to add to list)</p>
<div id="banned_words" class="chips"></div>
</div>
</div>
</div>
@ -240,5 +265,8 @@
{% endblock %}
{% block script %}
<script>
const BANNED_WORDS = {{ guild["banned_words"]|tojson|safe }};
</script>
<script type="text/javascript" src="{{ url_for('static', filename='js/administrate_guild.js') }}"></script>
{% endblock %}

View File

@ -0,0 +1,25 @@
{% extends 'site_layout.html.j2' %}
{% set title="Global Banned Words" %}
{% block content %}
<h1>Global Banned Words</h1>
<p class="flow-text">These following words are predefined as the global banned words for those who want a sqeaky clean server.</p>
<div class="row">
<div class="col s12">
<div class="card horizontal black-text indigo lighten-5 z-depth-3 hoverable">
<div class="card-stacked">
<div class="card-content">
<p>Upon enforcing banned words along with the <strong>global</strong> banned words (both are enabled in your server dashboard), any messages sent via the embeds that contain these words will be prevented to be sent.</p>
<p>If you have any suggestions on adding more profane words to the global list, feel free to open a pull request and modify <a href="https://github.com/TitanEmbeds/Titan/blob/master/webapp/titanembeds/constants.py" target="_blank">this file.</a></p>
<hr>
<ol>
{% for word in constants.GLOBAL_BANNED_WORDS %}
<li>{{ word }}</li>
{% endfor %}
</ol>
</div>
</div>
</div>
</div>
</div>
{% endblock %}