I am not great at coding, really i'm still learning, but usually I can solve my own problems, however, i'm stuck here. I 'm not sure what is preventing the bot from running, Here is my current code:
const Discord = require("discord.js");
const TOKEN = "myToken";
const PREFIX = "f!"
var bot = new Discord.Client();
bot.on("ready", function() {
console.log("Ready");
});
bot.on("message", function (message) {
if (message.author.equals(bot.user)) return;
if (!message.content.startsWith(PREFIX)) return;
var args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]) {
case "ping";
message.channel.sendMessage("Pong!");
break;
}
});
bot.login(TOKEN);
However, when i run it in cmd with the command "node index", it doesn't run, even though the previous version I made did work, when i try to run this version, I get the following error statements;
SyntaxError: Unexpected token )
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:588:28)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:607:3
Any help would be appreciated, sorry if i sound like a total idiot.