From c954cfa00d46f3beb0545afd4eebeb5f889c3ba5 Mon Sep 17 00:00:00 2001 From: Aayu5h Date: Tue, 14 Feb 2023 15:57:44 +0530 Subject: [PATCH] fixed ban urself --- src/commands/developers/ban.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/commands/developers/ban.js b/src/commands/developers/ban.js index c38a40f..c1eb496 100644 --- a/src/commands/developers/ban.js +++ b/src/commands/developers/ban.js @@ -3,15 +3,22 @@ const Discord = require('discord.js'); const Schema = require('../../database/models/userBans'); const webhookClientLogs = new Discord.WebhookClient({ - id: "", - token: "", + id: "", + token: "", }); module.exports = async (client, interaction, args) => { const boolean = interaction.options.getBoolean('new'); const member = interaction.options.getUser('user'); - + if (boolean == true) { + if (member.id === interaction.user.id) { // add the check here + return client.errNormal({ + error: `You cannot ban yourself from the bot`, + type: `editreply` + }, interaction); + } + Schema.findOne({ User: member.id }, async (err, data) => { if (data) { return client.errNormal({ @@ -79,4 +86,3 @@ module.exports = async (client, interaction, args) => { } } - \ No newline at end of file