I am having some issues with my help command, when i want to get some information about a command
const Discord = require("discord.js"); const { MessageEmbed } = require("discord.js"); const { COLOR, PREFIX } = require("../../config.js");
module.exports = {
config: {
name: “help”,
aliases: [“h”],
description: “Help Command!”,
usage: “Help | ”,
},
run: async(client, message, args) => {
let embed = new MessageEmbed()
.setColor(COLOR)
.setTitle(`${client.user.username} Commands!`)
.setDescription(`Use ${PREFIX}Help <Command Name> For More Command Information!` +
"\n\n**Economy**\n`Addmoney, Balance, Beg, Buy, Daily, Deposit, Fish, Leaderboard, Pay, Removemoney, Rob, Roulette, Sell, Setbackground, Setinfo, Slots, Store, Weekly, Withdraw, Work`" + "\n\n" + "**Fun**\n`Ascii, Calculate, Coinflip, Dog, Hack, Howgoofy, Howjajaja, Meme, Motivation, Randomnumber, Rate, Roast, Say, Snipe, Status, Tts, Urbandictionary`" + "\n\n" +
"**Games**\n`Akinator, Blackjack, Connectfour, Duelquiz, Gunfight, Horserace, Memory, Poker, RPS, Russianroulette, Tictactoe, Trivia`" + "\n\n" + "**Image**\n`Avatar, Avatarfusion, Captcha, Clyde, Faceplam, Fire, Gif, Jail, Mission, Scary, Tobecontinued, Triggered, Tweet, Wasted`" + "\n\n" + "**Music**\n`Join, Leave, Loop, Musictrivia, Nowplaying, Pause, Play, Queue, Remove, Resume, Search, Shuffle, Skip, Skipall, Skipto, Stop, Stopmusictrivia, Volume`" + "\n\n" +
"**Information**\n`Calladmin, Channelinfo, Feedback, Help, Instasearch, Invites, Level, News, Ping, Poll, Roleinfo, Rolememberinfo, Serverinfo, Translate, Uptime, Weather, Whois, Wikipedia`")
.setFooter(`Requested By ${message.author.username}`)
.setTimestamp();
if (!args.length) return message.channel.send(embed);
let cmd =
client.commands.get(args[0].toLowerCase()) ||
client.commands.get(client.aliases.get(args[0].toLowerCase()));
let embed2 = new MessageEmbed()
.setColor(COLOR)
.setTitle(`${cmd.name} Information!`)
.addField(`Aliases`, cmd.aliases || "None!")
.addField(`Usage`, cmd.usage || "No Usage")
.addField(`Description`, cmd.description || "No Description!")
.setTimestamp();
if (cmd) {
return message.channel.send(embed2);
} else {
return message.channel.send(embed);
}
}
};
Here my error
(node:7824) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘name’ of undefined
At Object.run (/app/commands/info/help.js:33:24)
At module.exports (/app/events/guild/message.js:34:38)
at processTicksAndRejections (internal/process/task_queues.js:88:5)
(node:7824) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7824) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code._
Anyone have an idea?