From 52c61d4e89d27ed7bf464b543448b75b9cfb12c7 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Wed, 13 Nov 2019 20:26:43 +0100 Subject: [PATCH] if no comment remove the comment --- commands/owner/addDonator.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/commands/owner/addDonator.js b/commands/owner/addDonator.js index 5e61ca4..6078456 100644 --- a/commands/owner/addDonator.js +++ b/commands/owner/addDonator.js @@ -35,6 +35,8 @@ class addDonatorCommand extends Command { let userComment = ''; if (args.userComment) { userComment = args.userComment; + } else if (args.userComment == '') { + userComment = null; } const Donator = await donator.findOne({where: {userID: args.id}}); @@ -51,6 +53,9 @@ class addDonatorCommand extends Command { if (messageContent == 'y' || messageContent == 'yes') { const body = {comment: userComment}; donator.update(body, {where: {userID: args.id}}); + if (userComment == null) { + return message.channel.send(`Removed the comment from ${this.client.users.get(args.id).username}#${this.client.users.get(args.id).discriminator} (${args.id})`); + } return message.channel.send(`You edited the comment for ${this.client.users.get(args.id).username}#${this.client.users.get(args.id).discriminator} (${args.id}) with ${args.userComment}`); } })