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
|
|
@ -1,6 +1,7 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
from utils.logger import log_info, log_error
|
||||
from utils.guild_config import get_guild_channel
|
||||
|
||||
class WelcomeMessage(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
|
|
@ -9,16 +10,22 @@ class WelcomeMessage(commands.Cog):
|
|||
@commands.Cog.listener()
|
||||
async def on_member_join(self, member):
|
||||
try:
|
||||
# ID du salon discussion
|
||||
welcome_channel_id = 1278483527783944242
|
||||
welcome_channel = member.guild.get_channel(welcome_channel_id)
|
||||
# Récupérer le salon de bienvenue depuis la config
|
||||
welcome_channel = get_guild_channel(member.guild, "welcome")
|
||||
|
||||
if welcome_channel:
|
||||
cand_ch = get_guild_channel(member.guild, "candidature")
|
||||
cand2_ch = get_guild_channel(member.guild, "candidature_2")
|
||||
quest_ch = get_guild_channel(member.guild, "questions")
|
||||
cand_mention = cand_ch.mention if cand_ch else "#candidature"
|
||||
cand2_mention = cand2_ch.mention if cand2_ch else "#candidature-2"
|
||||
quest_mention = quest_ch.mention if quest_ch else "#questions"
|
||||
|
||||
welcome_message = (
|
||||
f"## BIENVENUE <:panda_welcome:1297298999849517056> !\n\n"
|
||||
f"> **L'équipe staff te souhaite la bienvenue sur Victoria's Vice {member.mention} !**\n\n"
|
||||
f"> Pour ta candidature <:arrow_1:1297491509201080362> <#1278477608392196176> / <#1278477152215371806> \n\n"
|
||||
f"> Si tu as des questions <:arrow_1:1297491509201080362> <#1279037583820718120>\n\n"
|
||||
f"> Pour ta candidature <:arrow_1:1297491509201080362> {cand_mention} / {cand2_mention} \n\n"
|
||||
f"> Si tu as des questions <:arrow_1:1297491509201080362> {quest_mention}\n\n"
|
||||
f"*> Bien cordialement, L'équipe staff de Victoria's Vice*"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue