From 90054abbaafca3b5c01368c069979bc45f9d77b8 Mon Sep 17 00:00:00 2001 From: Kit Kasune Date: Tue, 20 Apr 2021 18:14:13 +0000 Subject: [PATCH] Add mute evasion detection --- events/guildMemberRemove.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/events/guildMemberRemove.js b/events/guildMemberRemove.js index 63d8fcf..bc43efd 100644 --- a/events/guildMemberRemove.js +++ b/events/guildMemberRemove.js @@ -13,4 +13,29 @@ module.exports = async (client, member) => { ) { try {member.guild.channels.cache.get(tg.lch).send(await sendResponse(member, member.guild.channels.cache.get(tg.lch), 'xdlol', client, tr.responses.get(tr.bindings.get('leave'))));} catch {} } + + let cm = Mute.findOne({uid: member.id}); + if (cm) { + member.guild.members.ban(member.id) + .then(() => message.guild.channels.cache.get('830600344668602409').send("<@&828000073203974166>", new Discord.MessageEmbed() + .setAuthor(member.displayName, client.users.cache.get(member.id).avatarURL()) + .setTitle("Mute Evasion Detected!") + .setDescription(`<@${member.id}> has evaded their mute, and I've automatically banned them!`) + .addField("Original Mod", `<@${cm.id}>`) + .setColor('c77dff') + .setFooter("Kit", client.user.avatarURL()) + .setTimestamp() + )).catch(e => { + console.error(`\n${chalk.red('[ERROR]')} >> ${chalk.yellow(`At [${date}] | Occurred while trying to ban a member for mute evasion`)}`, e); + message.guild.channels.cache.get('830600344668602409').send("<@&828000073203974166> **Failed automatic mute evasion ban!**", new Discord.MessageEmbed() + .setAuthor(member.displayName, client.users.cache.get(member.id).avatarURL()) + .setTitle("Mute Evasion Detected!") + .setDescription(`<@${member.id}> has evaded their mute, but I was not able to automatically ban them! Their user ID is \`${member.id}\`.`) + .addField("Original Mod", `<@${cm.id}>`) + .setColor('c77dff') + .setFooter("Kit", client.user.avatarURL()) + .setTimestamp() + ); + }); + } }; \ No newline at end of file