galactic-bot/structure/client/components/settings/developer/CamelCase.js
2020-08-17 13:26:57 -07:00

45 lines
1.1 KiB
JavaScript

const { Setting } = require('../../../../interfaces/');
class CamelCaseSetting extends Setting {
constructor(client) {
super(client, {
name: 'camelCase',
module: 'developer',
resolve: 'USER',
default: {
camelCase: false
},
restricted: true,
archivable: false
});
}
async handle(message, params) {
const boolean = this.client.resolver.resolveBoolean(params.join(' '));
if(boolean === null) {
return {
msg: `Unable to parse boolean value.`,
error: true
};
}
await message.author._updateSettings({ [this.index]: boolean });
return {
msg: `Successfully set camelCase to \`${boolean}\`.`,
error: false
};
}
fields(user) {
return {
name: "》 Status",
value: user.format('SETTING_STATUS', { bool: Boolean(user._settings.camelcase) }, true)
};
}
}
module.exports = CamelCaseSetting;