62 lines
1.6 KiB
JavaScript
62 lines
1.6 KiB
JavaScript
const { Setting } = require('../../../../interfaces/');
|
|
|
|
class DisabledCommandsSetting extends Setting {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
name: 'disabledCommands',
|
|
module: 'administration',
|
|
aliases: ['disabled', 'disableCommands', 'disableCommand', 'disableCmd', 'disableCmds', 'disabledCmds', 'disable'],
|
|
usage: "<+|-|list> [command..]",
|
|
resolve: 'GUILD',
|
|
default: {
|
|
disabledCommands: [
|
|
'command:strike'
|
|
]
|
|
},
|
|
examples: [
|
|
'list',
|
|
'add command:strike',
|
|
'remove command:strike'
|
|
]
|
|
});
|
|
|
|
}
|
|
|
|
async handle(message, params) {
|
|
|
|
const parameters = params.join(' ').toLowerCase();
|
|
|
|
let type = null;
|
|
for(const [ key, value ] of Object.entries(Constants.Types)) {
|
|
if(value.includes(parameters)) type = key;
|
|
}
|
|
|
|
if(!type) return {
|
|
msg: message.format('S_PERMISSIONTYPE_INVALIDTYPE'),
|
|
error: true
|
|
};
|
|
|
|
await message.guild._updateSettings({ [this.index]: type });
|
|
|
|
const description = message.format('S_PERMISSIONTYPE_DESCRIPTIONS', { type }, true);
|
|
return {
|
|
msg: `${message.format('S_PERMISSIONTYPE_SUCCESS', { type, description })}`,
|
|
error: false
|
|
};
|
|
|
|
}
|
|
|
|
fields(guild) {
|
|
return [
|
|
{
|
|
name: '》Disabled Commands',
|
|
value: `\`${guild._settings.permissionType}\``
|
|
}
|
|
];
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = DisabledCommandsSetting; |