forked from Galactic/galactic-bot
setting to enable message commands
This commit is contained in:
parent
5e4736f97f
commit
cbb2e31cc9
@ -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;
|
Loading…
Reference in New Issue
Block a user