From 9e17dbc09ce6df83343a7ab1cb2f89dd704e9820 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Mon, 3 Aug 2020 11:56:52 +0200 Subject: [PATCH] remove donator option --- commands/owner/addDonator.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/commands/owner/addDonator.js b/commands/owner/addDonator.js index 35fc8c2f..58b23d77 100644 --- a/commands/owner/addDonator.js +++ b/commands/owner/addDonator.js @@ -20,6 +20,11 @@ class addDonatorCommand extends Command { id: 'userComment', type: 'string', match: 'rest' + }, + { + id: 'remove', + match: 'flag', + flag: ['--remove'] } ], channel: 'guild', @@ -32,13 +37,23 @@ class addDonatorCommand extends Command { } async exec(message, args) { + const Donator = await donator.findOne({where: {userID: args.id}}); + + if (args.remove) { + if (Donator) { + Donator.destroy({where: {userID: args.id}}); + return message.channel.send('successfully removed the following id from the donators: ' + args.id); + } else { + return message.channel.send('Did not find the id, is he a donator?'); + } + } + let userComment = ''; if (args.userComment) { userComment = args.userComment; } else if (!args.userComment) { userComment = ''; } - const Donator = await donator.findOne({where: {userID: args.id}}); if (!Donator) { const body = {userID: args.id, comment: userComment};