Haha-Yes/commands/owner/removeResponse.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-07-08 22:10:29 +02:00
const { Command } = require('discord-akairo');
const autoResponse = require('../../models').autoresponse;
class removeResponseCommand extends Command {
constructor() {
super('removeResponse', {
aliases: ['removeResponse'],
2019-07-08 22:48:04 +02:00
category: 'owner',
ownerOnly: 'true',
2019-07-08 22:10:29 +02:00
userPermissions: ['MANAGE_MESSAGES'],
args: [
{
id: 'trigger',
type: 'string',
match: 'rest',
prompt: {
2019-11-15 21:39:53 +01:00
start: 'which tag do you want to remove?',
2019-07-08 22:10:29 +02:00
}
}
],
channelRestriction: 'guild',
description: {
content: 'Remove created custom autoresponse',
usage: '[trigger]',
examples: ['do you know da wea']
}
});
}
async exec(message, args) {
2019-07-08 23:49:36 +02:00
const autoresponse = await autoResponse.findOne({where: {trigger: args.trigger}});
2019-07-08 22:10:29 +02:00
if (autoresponse) {
autoResponse.destroy({where: {trigger: args.trigger}});
2019-07-09 01:52:51 +02:00
return message.channel.send('successfully deleted the following autoresponse: ' + args.trigger);
2019-07-08 22:10:29 +02:00
} else {
return message.channel.send('Did not find the specified autoresponse, are you sure it exist?');
}
}
}
module.exports = removeResponseCommand;