1
0
Fork 0

remove donator option

akairo
loicbersier 4 years ago
parent b9955991f3
commit 9e17dbc09c

@ -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};

Loading…
Cancel
Save