This commit is contained in:
Erik 2020-05-05 16:33:14 +03:00
parent 5656096bb1
commit 1e04bfec0d
4 changed files with 26 additions and 27 deletions

View File

@ -1,4 +1,4 @@
[C_HELP]
[C_HELP_USAGE]
**__HELP MENU__**
For a list of all available commands, use `{prefix}commands [ group ]`.

View File

@ -7,7 +7,8 @@ class HelpCommand extends Command {
super(client, {
name: 'help',
module: 'information',
description: 'Get help!'
description: 'Get help!',
showUsage: true
});
this.client = client;
@ -16,32 +17,29 @@ class HelpCommand extends Command {
}
async execute(message, { params }) {
if (params.length === 0)
await message.embed({
//title: message.format('C_HELP_TITLE'),
description: message.format('C_HELP')
});
else {
const key = params[0];
let [result] = this.client.resolver.components(key, 'command');
if (!result) [result] = this.client.resolver.components(key, 'setting');
if (!result)
return await message.embed({
description: message.format('C_HELP_404', { component: key })
});
let index = `${result.type.slice(0, 1).toUpperCase()}_${result.name.toUpperCase()}_HELP`;
const [ key ] = params;
let [ result ] = this.client.resolver.components(key, 'command');
if (!result) [ result ] = this.client.resolver.components(key, 'setting');
if (!result)
return await message.embed({
description: message.format('C_HELP_TEMPLATE', {
desc: result.description,
component: result.name.toUpperCase(),
text: message.format(index)
})
description: message.format('C_HELP_404', { component: key })
});
}
//let index = `${result.type.slice(0, 1).toUpperCase()}_${result.name.toUpperCase()}_HELP`;
return await message.embed({
description: message.format('C_HELP_TEMPLATE', {
desc: message.format(result.description),
component: result.name.toUpperCase(),
text: message.format(result.example)
})//,
// fields: [
// {
// name: '',
// value: message.format(result.examples)
// }
// ]
});
}

View File

@ -49,7 +49,7 @@ const Message = Structures.extend('Message', (Message) => {
async resolve() {
if(this.command.showUsage && !this.parameters) {
if (this.command.showUsage && !this.parameters.length) {
return this._showUsage();
}
@ -100,7 +100,7 @@ const Message = Structures.extend('Message', (Message) => {
return super.edit(str);
}
_showUsage() {
async _showUsage() {
//TODO: format this
return await this.embed({
title: `**${this.command.name.toUpperCase()} USAGE**`,

View File

@ -17,7 +17,8 @@ class Setting extends Component {
this.module = opts.module;
this.restricted = Boolean(opts.restricted);
this.description = opts.description || "A basic setting.";
this.description = `S_${opts.name}_DESCRIPTION`;
this.examples = `S_${opts.name}_EXAMPLES`;
this.archiveable = Boolean(opts.archiveable);
this.index = opts.index || opts.name;