diff --git a/src/structure/components/settings/administration/Indexing.js b/src/structure/components/settings/administration/Indexing.js new file mode 100644 index 0000000..149ff22 --- /dev/null +++ b/src/structure/components/settings/administration/Indexing.js @@ -0,0 +1,59 @@ +const { Setting } = require("../../../interfaces"); + +// setting for guild indexing and description +class IndexSetting extends Setting { + + constructor(client) { + + super(client, { + name: 'indexing', + module: 'administration', + description: 'Configure guild indexing for the dashboard', + display: 'Indexing', + default: { + enabled: false, + description: null + }, + commandOptions: [ + { + name: 'enabled', + description: 'Toggle enable state', + type: 'BOOLEAN', flag: true, valueOptional: true, defaultValue: true + }, + { + name: 'description', + description: 'A description ' + } + ] + }); + + } + + async execute(invoker, { enabled, description }, setting) { + + if (enabled) setting.enabled = enabled.value; + if (description) setting.description = description.value; + return { index: 'SETTING_SUCCES_ALT' }; + + } + + fields(guild) { + const setting = guild._settings[this.name]; + return [ + { + name: 'GENERAL_STATUS', + value: guild.format('GENERAL_STATE', { + bool: Boolean(setting.enabled) + }, { code: true }), + inline: true + }, + { + name: 'GENERAL_DESCRIPTION', + value: setting.description || '**N/A**' + } + ]; + } + +} + +module.exports = IndexSetting; \ No newline at end of file