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

45 lines
1007 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 {
2020-06-04 19:59:09 +02:00
name: "》Enabled",
value: `\`${guild._settings.silent}\``
};
}
}
module.exports = SilentSetting;