This commit is contained in:
Erik 2022-07-30 17:59:55 +03:00
parent 2202de48ea
commit feb9df0043
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -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;