setting to enable message commands

This commit is contained in:
Erik 2022-07-27 12:43:13 +03:00
parent 5e4736f97f
commit cbb2e31cc9
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -0,0 +1,55 @@
const { Setting } = require("../../../interfaces");
class TextCommands extends Setting {
constructor(client) {
super(client, {
name: 'textcommands',
display: 'Text Commands',
description: 'Message based commands configuration',
module: 'administration',
default: {
enabled: false,
prefix: '-'
},
commandOptions: [
{
name: 'enabled',
type: 'BOOLEAN', flag: true, valueOptional: true, defaultValue: true,
description: 'Toggle enable state'
},
{
name: 'prefix',
type: 'STRING',
description: 'Prefix to use'
}
]
});
}
async execute(invoker, { enabled, prefix }, setting) {
if (enabled) setting.enabled = enabled.value;
if (prefix) setting.prefix = prefix.value;
return { index: 'SETTING_SUCCESS_ALT' };
}
fields(guild) {
const setting = guild._settings[this.name];
return [{
name: 'GENERAL_STATUS',
value: guild.format('GENERAL_STATE', {
bool: setting.enabled
}, { code: true }),
inline: true
}, {
name: 'GENERAL_PREFIX',
value: setting.prefix,
inline: true
}];
}
}
module.exports = TextCommands;