Visionarily
New Coder
Hello, I am working on a code for a Discord bot for my server, and I'm currently stumped on a magic 8 ball feature, go figure. I'm trying to get it to check if there is a message after the 8 ball command, and if not, send a message to the same channel telling the user to supply it a message to answer.
This is my code:
It returns an error saying message.reply or message.send isn't a function. I'm new to Javascript, so I'm probably doing something very wrong here. I'd appreciate anyone's advice on how to at least make this code function and to learn more about JS.
This is my code:
JavaScript:
if (commandName === '8ball') {
const message = args.join(' ').slice(0);
if (message.length < 10)
return message.reply('You need to supply a question.');
const messages = [
'8ball messages here'
];
const pEmbed = new Discord.MessageEmbed()
.setTimestamp('')
.setColor(`${bedcolor}`)
.randomMessage = messages[Math.floor(Math.random() * messages.length)];
return message.reply(pEmbed);
It returns an error saying message.reply or message.send isn't a function. I'm new to Javascript, so I'm probably doing something very wrong here. I'd appreciate anyone's advice on how to at least make this code function and to learn more about JS.