diff --git a/commands.py b/commands.py index 4b7b05e..2268941 100644 --- a/commands.py +++ b/commands.py @@ -14,6 +14,26 @@ class EssentialCommands(commands.Cog): def __init__(self, bot): self.bot = bot + + @discord.Cog.listener() + async def on_member_join(self, member): + # Send a welcome message with an embed to the specified channel + welcome_title = esconf['events']['welcome_title'] + welcome_message = esconf['events']['welcome_content'] + welcome_channel = self.bot.get_channel(esconf["events"]['welcome_channel_id']) + embed = discord.Embed(title=welcome_title.format(member=member), description=welcome_message.format(member=member), color=0x00ff00) + await welcome_channel.send(embed=embed) + + @discord.Cog.listener() + async def on_member_remove(self, member): + # Send a goodbye message with an embed to the specified channel + gb_title = esconf['events']['goodbye_title'] + gb_message = esconf['events']['goodbye_content'] + gb_channel = self.bot.get_channel(esconf["events"]['welcome_channel_id']) + embed = discord.Embed(title=gb_title.format(member=member), description=gb_message.format(member=member), color=0xff0000) + + await gb_channel.send(embed=embed) + @commands.slash_command(guild_ids=guild_ids) async def ping(self, ctx): if not esconf["commands"]["ping"]: diff --git a/config.toml b/config.toml index 1c317fc..ff011cf 100644 --- a/config.toml +++ b/config.toml @@ -14,3 +14,13 @@ unlock = true lockdown = true unlockdown = true +[events] +goodbye_enabled=true +goodbye_channel_id=1081330679519907982 +goodbye_title="Goodbye!" +goodbye_content="{member.display_name} has left the server." +welcome_enabled=true +welcome_channel_id=1081330679519907982 +welcome_title="Welcome!" +welcome_content="Welcome to the server {member.mention} :wave:" +