galactic-bot/structure/client/components/settings/moderation/Silent.js

45 lines
1006 B
JavaScript
Raw Normal View History

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: "》Silent",
value: `\`${guild._settings.silent}\``
};
}
}
module.exports = SilentSetting;