TravBot-v3/src/Commands/Utilities/Help.js

36 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const Command = require('../../Structures/Command');
const { MessageEmbed } = require('discord.js');
module.exports = class extends Command {
constructor(...args) {
super(...args, {
aliases: ['help', 'halp']
});
}
async run(message, [command]) {
const embed = new MessageEmbed()
.setColor('BLUE')
.setAuthor(`${message.guild.name} Help Menu`, message.guild.iconURL({ dynamic: true }))
.setThumbnail(this.client.user.displayAvatarURL())
.setFooter(`Requested by ${message.author.username}`, message.author.displayAvatarURL({ dynamic: true }))
.setTimestamp();
if (command) {
const cmd = this.client.commands.get(command) || this.client.command.get(this.aliases.get(command));
if (!cmd) return message.channel.send(`\`${command}\` is not a valid command.`);
embed.setAuthor(`${this.client.utils.captalise(cmd.name)} Command Help`, this.client.user.displayAvatarURL());
embed.setDescription([
`** Aliases:** ${cmd.aliases.length ? cmd.aliases.map(alias => `\`${alias}\``).join(' ') : 'No Aliases'}`,
`** Description:** ${cmd.description}`,
`** Category:** ${cmd.category}`,
`** Usage:** ${cmd.usage}`
]);
}
}
};