diff --git a/src/structure/components/settings/administration/TextCommands.js b/src/structure/components/settings/administration/TextCommands.js new file mode 100644 index 0000000..6ae5d5a --- /dev/null +++ b/src/structure/components/settings/administration/TextCommands.js @@ -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; \ No newline at end of file