-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
}, | ||
}; |