49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
const { Setting } = require('../../../../interfaces/');
|
|
|
|
class SilentSetting extends Setting {
|
|
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'silent',
|
|
module: 'moderation',
|
|
usage: "<'on'|'off'>",
|
|
resolve: 'GUILD',
|
|
default: {
|
|
silent: false
|
|
}
|
|
});
|
|
}
|
|
|
|
async handle(message, params) {
|
|
|
|
const parameters = params.join(' ');
|
|
const boolean = this.client.resolver.resolveBoolean(parameters);
|
|
if(boolean === null) return {
|
|
msg: message.format('S_SILENT_INVALID'),
|
|
error: true
|
|
};
|
|
|
|
await message.guild._updateSettings({
|
|
[this.index]: boolean
|
|
});
|
|
|
|
return {
|
|
msg: message.format('S_SILENT_SUCCESS', { value: boolean }),
|
|
error: false
|
|
};
|
|
|
|
}
|
|
|
|
fields(guild) {
|
|
return [
|
|
{
|
|
name: '》 Status',
|
|
value: guild.format('SETTING_STATUS', { bool: Boolean(guild._settings.silent) }, true),
|
|
inline: true
|
|
}
|
|
];
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = SilentSetting; |