+Commands{change name, help, read} better error catching.
This commit is contained in:
parent
c8853d48a6
commit
5583eee966
6 changed files with 135 additions and 87 deletions
33
commands/help.ts
Normal file
33
commands/help.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { client } from "../main";
|
||||
import { capitalize, COLOR } from "../scripts/functions";
|
||||
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
description: "Show a description of a command",
|
||||
args: "**command** - the command you'd like to know more about",
|
||||
execute(msg, args) {
|
||||
const command = args[0].toLowerCase();
|
||||
if (command === "") {
|
||||
msg.reply(`Please provide a command, like "!help help", or "!help races"\nAlternatively type "!list" for a list of commands`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (client.commands.has(command)) {
|
||||
const commandData: any = client.commands.get(command);
|
||||
const helpEmbed: object = {
|
||||
color: COLOR,
|
||||
title: capitalize(commandData.name),
|
||||
description: commandData.description,
|
||||
fields: [
|
||||
{
|
||||
name: 'Arguments',
|
||||
value: commandData.args
|
||||
}
|
||||
]
|
||||
}
|
||||
msg.channel.send("{ embed: helpEmbed }");
|
||||
} else {
|
||||
msg.reply(`That command does not exist`);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue