forked from Galactic/galactic-bot
50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
|
const { Command } = require('../../../../interfaces/');
|
||
|
|
||
|
class HelpCommand extends Command {
|
||
|
|
||
|
constructor(client) {
|
||
|
|
||
|
super(client, {
|
||
|
name: 'help',
|
||
|
module: 'information',
|
||
|
description: 'Get help!'
|
||
|
});
|
||
|
|
||
|
this.client = client;
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
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`;
|
||
|
return await message.embed({
|
||
|
description: message.format('C_HELP_TEMPLATE', {
|
||
|
desc: result.description,
|
||
|
component: result.name.toUpperCase(),
|
||
|
text: message.format(index)
|
||
|
})
|
||
|
});
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
module.exports = HelpCommand;
|