Added customizable join/leave messages. Working on the option to disable it

main
supopur 2 years ago
parent 6a33d8a6a2
commit 10ab4c34fe

@ -14,6 +14,26 @@ class EssentialCommands(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
self.bot = 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) @commands.slash_command(guild_ids=guild_ids)
async def ping(self, ctx): async def ping(self, ctx):
if not esconf["commands"]["ping"]: if not esconf["commands"]["ping"]:

@ -14,3 +14,13 @@ unlock = true
lockdown = true lockdown = true
unlockdown = 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:"

Loading…
Cancel
Save