galactic-bot/structure/client/components/settings/moderation/Silent.js
2020-06-04 12:59:09 -05:00

45 lines
1007 B
JavaScript

const { Setting } = require('../../../../interfaces/');
class SilentSetting extends Setting {
constructor(client) {
super(client, {
name: 'silent',
module: 'moderation',
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: "》Enabled",
value: `\`${guild._settings.silent}\``
};
}
}
module.exports = SilentSetting;