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:
parent
bc3cb3f3d5
commit
2e38d05152
25 changed files with 368 additions and 125 deletions
|
|
@ -3,8 +3,7 @@ from discord import app_commands
|
|||
from discord.ext import commands
|
||||
import json
|
||||
import math
|
||||
|
||||
BANQUE_NATIONALE_ROLE_ID = 1362031086959329470 # Remplace par l’ID réel du rôle banque_nationale
|
||||
from utils.guild_config import has_role
|
||||
|
||||
class CompteBanqueNationale(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
|
|
@ -41,7 +40,7 @@ class CompteBanqueNationale(commands.Cog):
|
|||
|
||||
@app_commands.command(name="voir_banque_nationale", description="Voir solde et transactions du compte banque nationale")
|
||||
async def voir_banque_nationale(self, interaction: discord.Interaction):
|
||||
if not any(role.id == BANQUE_NATIONALE_ROLE_ID for role in interaction.user.roles):
|
||||
if not has_role(interaction.user, "banque_nationale"):
|
||||
await interaction.response.send_message("❌ Vous n'avez pas la permission d'accéder à ce compte.", ephemeral=True)
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue