forked from Galactic/galactic-bot
indexing
This commit is contained in:
parent
2202de48ea
commit
feb9df0043
59
src/structure/components/settings/administration/Indexing.js
Normal file
59
src/structure/components/settings/administration/Indexing.js
Normal 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;
|
Loading…
Reference in New Issue
Block a user