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,9 +3,7 @@ from discord import app_commands
|
|||
from discord.ext import commands, tasks
|
||||
import dateparser
|
||||
from datetime import datetime, timezone
|
||||
|
||||
ROLE_PING_ID = 1278319901651632138 # ID du rôle citoyen # Rôle pour l'annonce principale
|
||||
REMINDER_ROLE_ID = 1303750986900439151 # ID du rôle rappels sessions # Rôle pour les rappels (à adapter !)
|
||||
from utils.guild_config import get_role_id
|
||||
|
||||
presence_data = {}
|
||||
|
||||
|
|
@ -114,6 +112,9 @@ class AnnonceSession(commands.Cog):
|
|||
reminder1_date = reminder1_date.astimezone(timezone.utc)
|
||||
reminder2_date = reminder2_date.astimezone(timezone.utc)
|
||||
|
||||
ping_role_id = get_role_id(interaction.guild.id, "citoyen")
|
||||
reminder_role_id = get_role_id(interaction.guild.id, "session_reminders")
|
||||
|
||||
message = (
|
||||
"# <:VV:1339237574593609780> - **SESSION VICTORIA’S VICE**\n"
|
||||
"\n"
|
||||
|
|
@ -130,7 +131,7 @@ class AnnonceSession(commands.Cog):
|
|||
"> - Je serai absent : <:uncheck:1297296882778902598> **(0)**\n"
|
||||
"> - Je serai en retard : ⏰ **(0)**\n"
|
||||
"---"
|
||||
f"> - **`PING`** : <@&{ROLE_PING_ID}>"
|
||||
f"> - **`PING`** : <@&{ping_role_id}>"
|
||||
)
|
||||
|
||||
await interaction.response.send_message(
|
||||
|
|
@ -208,8 +209,9 @@ class AnnonceSession(commands.Cog):
|
|||
channel = self.bot.get_channel(data["channel_id"])
|
||||
if channel:
|
||||
msg = await channel.fetch_message(msg_id)
|
||||
reminder_role_id = get_role_id(data.get("guild_id", 0), "session_reminders")
|
||||
await channel.send(
|
||||
f"<@&{REMINDER_ROLE_ID}> ⏰ **{label}**\nLa session RP approche !\nAnnonce : {msg.jump_url}"
|
||||
f"<@&{reminder_role_id}> ⏰ **{label}**\nLa session RP approche !\nAnnonce : {msg.jump_url}"
|
||||
)
|
||||
|
||||
@check_sessions.before_loop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue