Show the correct message when removing comment

This commit is contained in:
loicbersier 2019-11-13 22:35:59 +01:00
parent 52c61d4e89
commit 45ee8c5dc3

View file

@ -35,8 +35,8 @@ class addDonatorCommand extends Command {
let userComment = '';
if (args.userComment) {
userComment = args.userComment;
} else if (args.userComment == '') {
userComment = null;
} else if (!args.userComment) {
userComment = '';
}
const Donator = await donator.findOne({where: {userID: args.id}});
@ -53,11 +53,13 @@ class addDonatorCommand extends Command {
if (messageContent == 'y' || messageContent == 'yes') {
const body = {comment: userComment};
donator.update(body, {where: {userID: args.id}});
if (userComment == null) {
console.log(userComment);
if (userComment == '') {
return message.channel.send(`Removed the comment from ${this.client.users.get(args.id).username}#${this.client.users.get(args.id).discriminator} (${args.id})`);
}
} else {
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}`);
}
}
})
.catch(() => {
return message.channel.send('Took too long to answer. didin\'t update anything.');