From 0e3372e07d3b582d825ee1925ca030b0c6e1a5ca Mon Sep 17 00:00:00 2001 From: Supositware Date: Tue, 12 Mar 2019 20:27:51 +0100 Subject: [PATCH] fixed for when the concerned user dosent have DM activated --- commands/admin/ban.js | 4 +++- commands/admin/kick.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/commands/admin/ban.js b/commands/admin/ban.js index bd0f5bb9..8c893473 100644 --- a/commands/admin/ban.js +++ b/commands/admin/ban.js @@ -38,7 +38,9 @@ class BanCommand extends Command { if(member.id === message.author.id) return message.channel.send('Why would you ban yourself ?'); - await member.send(`https://youtu.be/55-mHgUjZfY\nYou have been banned from **${message.guild.name}** for the following reasons: "**${reasons}**"`); + await member.send(`https://youtu.be/55-mHgUjZfY\nYou have been banned from **${message.guild.name}** for the following reasons: "**${reasons}**"`) + .catch(() => console.log('could not send message to the concerned user')); + return member.ban(`Banned by : ${message.author.username} for the following reasons : ${reasons}`) .then(() => message.reply(`${member.user.username} was succesfully banned with the following reasons "${reasons}".`)); } diff --git a/commands/admin/kick.js b/commands/admin/kick.js index 8d7a4f26..6705adb3 100644 --- a/commands/admin/kick.js +++ b/commands/admin/kick.js @@ -38,7 +38,9 @@ class KickCommand extends Command { if(!reasons) reasons = 'Nothing have been specified.'; - await member.send(`You have been kicked from **${message.guild.name}** for the following reasons: "**${reasons}**"`); + await member.send(`You have been kicked from **${message.guild.name}** for the following reasons: "**${reasons}**"`) + .catch(() => console.log('could not send message to the concerned user')); + return member.kick(`Kicked by : ${message.author.username} for the following reasons : ${reasons}`) .then(() => message.reply(`${member.user.username} was succesfully kicked with the following reasons "${reasons}".`)) .catch(err => console.error(err));