ReferenceError: message is not defined
at Object. (C:\Users\kompic\Desktop\21master10\main.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.j
at internal/main/run_main_module.js:17:47
Here is code:
const Discord = require(“discord.js”);
const client = new Discord.Client();
const prefix = " ";
const fs = require(“fs”);
const { execute } = require("./commands/youtube");
const youtube = require("./commands/youtube");
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync("./commands/").filter(file => file.endsWith(".js"));
for(const file of commandFiles){
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
client.once(“ready”, () => {
console.log("21master10 is online!");
});
client.on(“message”, message =>{
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === "ping"){
client.commands.get("ping").execute(message, args);
} else if (command == "youtube"){
client.commands.get("youtube").execute(message, args);
}
else if (command == "whats up"){
message.channel.send("whats up").execute(message, args);
} else if (command == "hi"){
client.commands.get("hi").execute(message, args);
} else if (command == 'beep') {
message.channel.send('Boop.');
} else if (command == "info"){
message.channel.send(`Your username: ${message.author.username}\nYour ID: ${message.author.id}`);
} else if (command == "server"){
message.channel.send(`Server name: ${message.guild.name}\nTotal members: ${message.guild.memberCount}`);
}
});