galactic-bot/structure/client/components/settings/developer/Debug.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

const { Setting } = require('../../../../interfaces/');
class DebugSetting extends Setting {
constructor(client) {
super(client, {
name: 'debug',
module: 'developer',
guarded: true,
resolve: 'GUILD',
default: {
debug: false
},
archivable: false
});
}
async handle(message, params) {
if(!message.author.developer) return { error: true, ignore: true };
const parameters = params.join(' ');
const boolean = this.client.resolver.resolveBoolean(parameters);
if(boolean === null) return {
msg: `The argument provided is not a boolean value. *(__t__rue, __f__alse)*`,
error: true
};
await message.guild._updateSettings({
[this.index]: boolean
});
return {
msg: `Successfully set the debugging to \`${boolean}\`.`,
error: false
};
}
fields(guild) {
return {
name: "》Debugging",
value: `\`${guild.debug}\``
};
}
}
module.exports = DebugSetting;