56 lines
1.8 KiB
JavaScript
56 lines
1.8 KiB
JavaScript
const { Command } = require('../../../../interfaces/');
|
|
|
|
class HelpCommand extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
name: 'help',
|
|
module: 'information',
|
|
disabled: true //REMOVE THIS ONCE DONE
|
|
});
|
|
|
|
this.client = client;
|
|
|
|
}
|
|
|
|
async execute(message, { params }) {
|
|
|
|
if (!params.length) return message.embed({
|
|
description: message.format('C_HELP')
|
|
});
|
|
|
|
const [ key ] = params;
|
|
let [ result ] = this.client.resolver.components(key, 'command');
|
|
if (!result) [ result ] = this.client.resolver.components(key, 'setting');
|
|
if (!result) result = this.client.resolver.componentsByTag(key, 'any', false);
|
|
if (!result) return message.embed({
|
|
description: message.format('C_HELP_404', { component: key })
|
|
});
|
|
|
|
if (result instanceof Array) {
|
|
|
|
} else return message.embed(result.usageEmbed(message, true));
|
|
|
|
// //let index = `${result.type.slice(0, 1).toUpperCase()}_${result.name.toUpperCase()}_HELP`;
|
|
// const em = {
|
|
// description: message.format('C_HELP_TEMPLATE', {
|
|
// desc: message.format(result.description),
|
|
// component: result.name.toUpperCase(),
|
|
// text: result.examples.map((ex) => `\`{prefix}${result.type === 'command' ? result.name.toLowerCase() : `settings ${result.name.toLowerCase()}`} ${ex}\``).join('\n')
|
|
// })
|
|
// };
|
|
// if (result.aliases.length) em.fields = [
|
|
// {
|
|
// name: 'Aliases',
|
|
// value: result.aliases.map((al) => al.toLowerCase()).join(', ')
|
|
// }
|
|
// ];
|
|
|
|
// return message.embed(em);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = HelpCommand; |