ReferenceError:command is not defined

javascript

#1

I have a problem i added 2 commands its Help and 8ball but when i start it and do help it shuts down and gives me a error saying command is not defined. Also my “Config” were it says { "Prefix" : "-" }
That also dont work please comment the problem im so confused.

const Discord = require("discord.js");
const client = new Discord.Client();
const config = require("./config.json");

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', msg => {

  if (msg.content === 'ping') {
    msg.reply('Pong!');
  }

  if(command === "help") {
    message.author.sendMessage("**Commands: [help] gives information on the bot [8ball] random thing were i can respawn to you");
    message.channel.sendMessage("**I just messaged you the commands, go to your direct messages!**");
  }

  if(command === "8ball") {
    if (args[1]) message.channel.sendMessage(fortunes[Math.floor(Math.random() * fortunes.length)]);
      else message.channel.sendMessage("```diff\n- I do not understand```");
    

});

client.login('TOKEN');

#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.