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): self.bot = bot @commands.Cog.listener() async def on_member_join(self, member): try: # 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> {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*" ) await welcome_channel.send(welcome_message) except Exception as e: print(f"Erreur lors de l'envoi du message de bienvenue: {e}") async def setup(bot): await bot.add_cog(WelcomeMessage(bot))