Skip to content

Commit

Permalink
[New] Added guildMemberRemove event
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Nov 18, 2021
1 parent db858d1 commit 0f1cb08
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion events/guildMemberRemove.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,54 @@
module.exports = {
name: "guildMemberRemove",
async execute(guildmember) {},
async execute(guild) {
const checkCustomChannel = await guild.client.db.get(
`leave_${guild.guild.id}`
);

const welcomeEmbed = {
color: "#9dcc37",
title: `Member left the server!`,
thumbnail: {
url: `${
guild.user.avatarURL() ||
guild.guild.iconURL() ||
guild.guild.client.user.avatarURL()
}`,
},
fields: [
{
name: ":man_detective: Member",
value: `${guild.toString()}`,
},
{
name: ":clock2: Joined Server",
value: `${guild.joinedAt.toDateString()}`,
},
{
name: ":calendar_spiral: Joined Discord",
value: `${guild.user.createdAt.toDateString()}`,
},
],
};

const sendWelcome = (channel) => {
return channel.send({
embeds: [welcomeEmbed],
});
};

if (checkCustomChannel) {
const customchannel = guild.guild.channels.cache.find(
(channel) => channel.id === checkCustomChannel
);
if (!customchannel) return;
return sendWelcome(customchannel);
}

if (guild.guild.systemChannel) {
return sendWelcome(guild.guild.systemChannel);
} else {
return;
}
},
};

0 comments on commit 0f1cb08

Please sign in to comment.