Modularize bot: per-guild config system for roles/channels/categories

- Add utils/guild_config.py: centralized config loader per guild (data/guilds/{id}.json)
- Add commandes/config.py: /config set_role, /config set_channel, /config set_category, /config voir, /config reset
- Replace ALL hardcoded role IDs (banquier, gouvernement, citoyen, staff, ems, permis, fbm, ursaff, etc.) with guild_config lookups
- Replace ALL hardcoded channel IDs (welcome, candidature, questions, mp_reception) with guild_config lookups
- Replace ALL hardcoded category IDs (ticket) with guild_config lookups
- Remove duplicate commandes/welcome_message.py (kept utils/ version)
- Remove 20+ hardcoded snowflake IDs across 22 files
- Guilds configure via /config on Discord, no code changes needed
This commit is contained in:
utilisateurqu 2026-08-17 00:12:57 +02:00
parent bc3cb3f3d5
commit 2e38d05152
25 changed files with 368 additions and 125 deletions

View file

@ -4,7 +4,7 @@ from discord.ext import commands
import json
from datetime import datetime
GOUVERNEMENT_ROLE_ID = 1278305482926194701 # Remplace avec l’ID de ton rôle Gouvernement # Remplace par l'ID du rôle Gouvernement
from utils.guild_config import has_role
GOUV_BANQUE = "Gouvernement"
GOUV_COMPTE = "GOUV"
GOUV_RIB = "00000 00000 00000000000 00"
@ -37,7 +37,7 @@ class GouvVirement(commands.Cog):
banque: app_commands.Choice[str] = None
):
# Vérification du rôle Gouvernement
if not any(role.id == GOUVERNEMENT_ROLE_ID for role in interaction.user.roles):
if not has_role(interaction.user, "gouvernement"):
await interaction.response.send_message("❌ Seul le Gouvernement peut utiliser cette commande.", ephemeral=True)
return