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:
Mow
2025-10-14 22:37:28 +02:00
parent 22abbcb02d
commit aff236fd0c
8 changed files with 111 additions and 1 deletions

View File

@@ -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
View 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)

View 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 %}

View File

@@ -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>