Adding member emu and more member join and leave

This commit is contained in:
hax4dayz 2020-04-10 20:31:41 +02:00
parent 463f16b184
commit 9a19a290d5
3 changed files with 47 additions and 0 deletions

View File

@ -137,6 +137,29 @@ client.on('guildMemberAdd', member => {
}
);
//Member leave
client.on('guildMemberRemove', member => {
var today = new Date();
var date = today.getMonth()+1+'-'+(today.getDate())+'-'+today.getFullYear();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
global.dateTime = date+' '+time;
const channel = member.guild.channels.cache.find(ch => ch.id === `${ModLog}`);
const guild = member.guild
if (!channel) return;
const MemberLeaveEmbed = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('Member Leave')
.addFields(
{ name: 'Username', value: member.user.tag, inline: false },
{ name: 'Member ID', value: member.user.id, inline: false },
{ name: 'Account creation date', value: member.user.createdAt, inline: false },
{ name: 'Server leave date', value: dateTime, inline: false },
{ name: 'Server member count', value: `${guild.memberCount}`, inline: false },
)
.setTimestamp()
channel.send(MemberLeaveEmbed)
});
//Log deleted messages
client.on('messageDelete', async message => {
const fetchedLogs = await message.guild.fetchAuditLogs({

12
commands/emujoin.js Normal file
View File

@ -0,0 +1,12 @@
module.exports = {
name: 'emujoin',
aliases: ['joinemu'],
description: 'This is for testing purposes only. Remove from release.',
usage: 'N/A',
cooldown: 0,
botmanager:true,
hidden:true,
execute(message, args) {
global.client = new Discord.Client()
client.emit("guildMemberAdd", message.member)
}}

12
commands/emuleave.js Normal file
View File

@ -0,0 +1,12 @@
module.exports = {
name: 'emuleave',
aliases: ['leaveemu'],
description: 'This is for testing purposes only. Remove from release.',
usage: '',
cooldown: 0,
botmanager:true,
hidden:true,
execute(message, args) {
global.client = new Discord.Client()
client.emit("guildMemberRemove", message.member)
}}