Files
xiao/commands/settings/clearsetting.js
T
2017-05-20 14:18:21 +00:00

35 lines
1.3 KiB
JavaScript

const { Command } = require('discord.js-commando');
module.exports = class ClearSettingCommand extends Command {
constructor(client) {
super(client, {
name: 'clear-setting',
group: 'settings',
memberName: 'clear-setting',
description: 'Removes a custom setting from your server.',
guildOnly: true,
args: [
{
key: 'setting',
prompt: 'What setting do you want to clear? `inviteGuard`, `modLog`, `memberLog`, `joinMsg`, `leaveMsg`, `staffRole`, or `singleRole`?',
type: 'string',
validate: setting => {
if (['inviteGuard', 'modLog', 'memberLog', 'joinMsg', 'leaveMsg', 'staffRole', 'singleRole'].includes(setting)) return true;
return 'Please enter either `inviteGuard`, `modLog`, `memberLog`, `joinMsg`, `leaveMsg`, `staffRole`, or `singleRole`.';
}
}
]
});
}
hasPermission(msg) {
return msg.member.hasPermission('ADMINISTRATOR');
}
run(msg, args) {
const { setting } = args;
msg.guild.settings.remove(setting);
return msg.say(`${setting} has been removed from your server settings.`);
}
};