You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Haha-Yes/commands/admin/quotation.js

45 lines
1.3 KiB
JavaScript

const { Command } = require('discord-akairo');
const quotationStat = require('../../models').quotationStat;
class quotationCommand extends Command {
constructor() {
super('quotation', {
aliases: ['quotation'],
category: 'admin',
args: [
{
id: 'stat',
type: 'string',
prompt: {
start: 'Do you want to **enable** or **disable** quotation?',
}
}
],
clientPermissions: ['SEND_MESSAGES'],
userPermissions: ['MANAGE_MESSAGES'],
channel: 'guild',
description: {
content: 'enable/disable quotation',
usage: '[enable/disable]',
examples: ['enable']
}
});
}
async exec(message, args) {
if (args.stat.toLowerCase() == 'enable' || args.stat.toLowerCase() == 'disable') {
const quotationstat = await quotationStat.findOne({where: {serverID: message.guild.id}});
if (!quotationstat) {
const body = {serverID: message.guild.id, stat: args.stat};
quotationStat.create(body);
return message.channel.send(`Quotation has been ${args.stat}d`);
} else {
const body = {serverID: message.guild.id, stat: args.stat};
quotationStat.update(body, {where: {serverID: message.guild.id}});
return message.channel.send(`Quotation has been ${args.stat}d`);
}
}
}
}
module.exports = quotationCommand;