client.on('message', message => { if (!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.length).split(/ +/); const commandName = args.shift().toLowerCase(); const command = client.commands.get(commandName) || client.commands.find (cmd => cmd.aliases && cmd.aliases.includes(commandName)); try { command.run(message, args); } catch (error) { console.error(error); const commandErrorEmbed = new Discord.MessageEmbed() .setTitle('Error whilst executing this command. . .') .setColor(greyColor) .setTimestamp() .setFooter('All rights reserved • OG Development', 'https://i.imgur.com/wMdKQYB.png') .addField('Reasons for the error are likely:', '• An unknown commandn• Command not entered correctlyn• An internal Error has occured') message.reply(commandErrorEmbed); } }) client.login(token)