Sorry if bad english! First i run my discord bot and i use the tutorial from "Threebow" Then im in the last part of tutorial i got command !userinfo - show embed but when i lanched !userinfo i got these error in colsole
(node:13056) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ReferenceError: messsage is not defined
(node:13056) [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.
This is my code discord bot code
const botSettings = require("./botsettings.json");
const Discord = require("discord.js");
const prefix = botSettings.prefix;
const bot = new Discord.Client({disableEveryone: true})
bot.on("ready", async () => {
console.log(`Bot is ready! ${bot.user.username}`);
try {
let link = await bot.generateInvite(["ADMINISTRATOR"]);
console.log(link);
} catch(e) {
console.log(e.stack);
}
});
bot.on("message", async message =>{
if(message.author.bot) return;
if(message.channel.type === "dm") return;
let messageArray = message.content.split(" ");
let command = messageArray[0];
let args = messageArray.slice(1);
if(!command.startsWith(prefix)) return;
if(command === `${prefix}userinfo`) {
let embed = new Discord.RichEmbed()
.setAuthor(message.author.username)
.setDescription("This is the user info!")
.setColor("#9B59B6")
.addField("Full username", `${message.author.name}#${message.author.discriminator}`)
.addField("ID", message.author.id)
.addField("Create At", message.author.createAt)
messsage.channel.sendEmbed(embed);
return;
}
});
bot.login(botSettings.token);