Vicy_Publique/utils/welcome_message.py

38 lines
1.7 KiB
Python
Raw Permalink Normal View History

2026-08-16 19:37:15 +02:00
import discord
from discord.ext import commands
from utils.logger import log_info, log_error
from utils.guild_config import get_guild_channel
2026-08-16 19:37:15 +02:00
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")
2026-08-16 19:37:15 +02:00
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"
2026-08-16 19:37:15 +02:00
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"
2026-08-16 19:37:15 +02:00
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))