I'm coding a bot using discord.js. I'm trying to setup a system where the bot is allowed to send a message as long as it is not blacklisted. However, every time I run the function, I get this message: ReferenceError: res is not defined
I've tried moving var res
so many times and I can't figure it out. Does anyone know how to arrange this properly?
function getNum() {
var randNum = [
"1",
"2",
"3",
];
// Blacklist Entries Start
var blacklistNum = [
"1"
];
// Blacklist Entries End
return randNum[Math.floor(Math.random()*randNum.length)];
return;
}
if(res === blacklistNum) {
getNum();
}
getNum();
message.channel.send(res);