From defab624609a8283c9eb9a60bca62c33a83625cd Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Sun, 4 Apr 2021 23:06:49 -0500 Subject: [PATCH] Return if member tries to ban/kick themself --- bot.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bot.js b/bot.js index 5e0a517..fe13745 100644 --- a/bot.js +++ b/bot.js @@ -444,6 +444,11 @@ async function ban(message) { const member = members.array()[0]; + if (member === message.member) { + message.reply("you can't ban yourself!"); + return; + } + let verificationEmbed = new Discord.MessageEmbed() .setTitle(`Are you sure you would like to ban \`${member.user.tag}\`?`) .setAuthor(member.user.tag, member.user.avatarURL()) @@ -501,6 +506,12 @@ async function kick(message) { const member = members.array()[0]; + if (member === message.member) { + message.reply("you can't ban yourself!"); + return; + } + + const verificationEmbed = new Discord.MessageEmbed() .setTitle(`Are you sure you would like to kick \`${member.user.tag}\`?`) .setDescription("React to this message to verify")