Haha-Yes/commands/admin/untag.js

40 lines
1 KiB
JavaScript
Raw Normal View History

2018-12-30 01:44:10 +01:00
const { Command } = require('discord-akairo');
2019-07-08 22:10:14 +02:00
const Tag = require('../../models').Tag;
2018-12-30 01:44:10 +01:00
class UnTagCommand extends Command {
2019-01-02 08:09:45 +01:00
constructor() {
super('untag', {
2019-02-08 19:42:43 +01:00
aliases: ['untag', 'removetag', 'delete'],
2019-01-02 08:09:45 +01:00
category: 'admin',
2019-06-16 15:11:52 +02:00
userPermissions: ['MANAGE_MESSAGES'],
2019-01-02 08:09:45 +01:00
args: [
{
id: 'trigger',
2019-06-20 02:48:01 +02:00
type: 'string',
2019-06-23 03:41:59 +02:00
match: 'rest',
prompt: {
start: 'wich tag do you want to remove?',
}
2019-01-02 08:09:45 +01:00
}
],
channelRestriction: 'guild',
description: {
content: 'Remove created custom autoresponse',
usage: '[trigger]',
examples: ['do you know da wea']
}
});
}
async exec(message, args) {
2019-07-08 22:10:14 +02:00
const tag = await Tag.findOne({where: {trigger: args.trigger, serverID: message.guild.id}});
if (tag) {
Tag.destroy({where: {trigger: args.trigger, serverID: message.guild.id}});
return message.channel.send('Sucesffuly deleted the following tag: ' + args.trigger);
} else {
return message.channel.send('Did not find the specified tag, are you sure it exist?');
}
2019-01-02 08:09:45 +01:00
}
2018-12-30 01:44:10 +01:00
}
module.exports = UnTagCommand;