mirror of
https://github.com/skylanix/MamieHenriette.git
synced 2026-02-06 06:40:35 +01:00
Ajouter un modèle d'avertissement et des fonctionnalités de modération
Ajout d'un nouveau modèle Warning dans database/models.py pour suivre les avertissements donnés aux utilisateurs. Mise à jour de database/schema.sql pour créer la table correspondante 'warning'. Amélioration du bot Discord pour gérer les commandes d'avertissement. Ajout d'une route de modération dans webapp pour de futures fonctionnalités de modération. Mise à jour de template.html pour inclure un lien vers la page de modération.
This commit is contained in:
@@ -2,4 +2,4 @@ from flask import Flask
|
||||
|
||||
webapp = Flask(__name__)
|
||||
|
||||
from webapp import commandes, configurations, index, humeurs, protondb, live_alert, twitch_auth
|
||||
from webapp import commandes, configurations, index, humeurs, protondb, live_alert, twitch_auth, moderation
|
||||
|
||||
9
webapp/moderation.py
Normal file
9
webapp/moderation.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from flask import render_template
|
||||
from webapp import webapp
|
||||
from database.models import Warning
|
||||
|
||||
@webapp.route("/moderation")
|
||||
def moderation():
|
||||
warnings = Warning.query.order_by(Warning.created_at.desc()).all()
|
||||
return render_template("moderation.html", warnings=warnings)
|
||||
|
||||
30
webapp/templates/moderation.html
Normal file
30
webapp/templates/moderation.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{% extends "template.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Modération Discord</h1>
|
||||
<p>Liste des avertissements émis sur le serveur Discord.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Utilisateur</th>
|
||||
<th>Discord ID</th>
|
||||
<th>Date & Heure</th>
|
||||
<th>Raison</th>
|
||||
<th>Staff</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for warning in warnings %}
|
||||
<tr>
|
||||
<td>{{ warning.username }}</td>
|
||||
<td>{{ warning.discord_id }}</td>
|
||||
<td>{{ warning.created_at.strftime('%d/%m/%Y %H:%M') if warning.created_at else 'N/A' }}</td>
|
||||
<td>{{ warning.reason }}</td>
|
||||
<td>{{ warning.staff_name }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<li><a href="/live-alert">Alerte live</a></li>
|
||||
<li><a href="/commandes">Commandes</a></li>
|
||||
<li><a href="/humeurs">Humeurs</a></li>
|
||||
<li><a href="/moderation">Modération</a></li>
|
||||
<li><a href="/protondb">ProtonDB</a></li>
|
||||
<li><a href="/configurations">Configurations</a></li>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user