Commit 2eac74a8 authored by Imran Hussain's avatar Imran Hussain
Browse files

Add a help command

parent 550f2ffd
const prefix = '!';
module.exports = {
name: 'help',
description: 'List all of my commands or info about a specific command.',
aliases: ['commands'],
usage: '[command name]',
cooldown: 5,
execute(message, args) {
const data = [];
const {commands} = message.client;
if (!args.length) {
data.push('Here\'s a list of all my commands:');
data.push( =>', '));
data.push(`\nYou can send \`${prefix}help [command name]\` to get info on a specific command!`);
return, {split: true})
.then(() => {
if ( === 'dm') return;
message.reply('I\'ve sent you a DM with all my commands!');
.catch((error) => {
console.error(`Could not send help DM to ${}.\n`, error);
message.reply('it seems like I can\'t DM you!');
const name = args[0].toLowerCase();
const command = commands.get(name) || commands.find((c) => c.aliases && c.aliases.includes(name));
if (!command) {
return message.reply('that\'s not a valid command!');
data.push(`**Name:** ${}`);
if (command.aliases) data.push(`**Aliases:** ${command.aliases.join(', ')}`);
if (command.description) data.push(`**Description:** ${command.description}`);
if (command.usage) data.push(`**Usage:** ${prefix}${} ${command.usage}`);
data.push(`**Cooldown:** ${command.cooldown || 3} second(s)`);, {split: true});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment