remove donator option

This commit is contained in:
loicbersier 2020-08-03 11:56:52 +02:00
parent b9955991f3
commit 9e17dbc09c

View file

@ -20,6 +20,11 @@ class addDonatorCommand extends Command {
id: 'userComment', id: 'userComment',
type: 'string', type: 'string',
match: 'rest' match: 'rest'
},
{
id: 'remove',
match: 'flag',
flag: ['--remove']
} }
], ],
channel: 'guild', channel: 'guild',
@ -32,13 +37,23 @@ class addDonatorCommand extends Command {
} }
async exec(message, args) { 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 = ''; let userComment = '';
if (args.userComment) { if (args.userComment) {
userComment = args.userComment; userComment = args.userComment;
} else if (!args.userComment) { } else if (!args.userComment) {
userComment = ''; userComment = '';
} }
const Donator = await donator.findOne({where: {userID: args.id}});
if (!Donator) { if (!Donator) {
const body = {userID: args.id, comment: userComment}; const body = {userID: args.id, comment: userComment};