Thin Mint
Thin Mint

Reputation: 23

Error running a discord bot using node js

I am trying to run a discord bot and it says that there is an "Unexpected end of input" when i try to run it. Here is the code:

const Discord = require('discord.js');
const client = new Discord.Client();

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

client.on('message'), msg => {
  if (msg.content === 'ree') {
    message.author.kick("FURRY SLUR")
};
 client.login('token');

And here is the error

SyntaxError: Unexpected end of input
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Upvotes: 0

Views: 327

Answers (2)

Rek
Rek

Reputation: 149

You're missing a closing });, just right before the login function.

client.on('message', msg => {
  if (msg.content === 'ree' && msg.guild && msg.member.kickable) {
    msg.member.kick('FURRY SLUR')
      .catch(console.error);
  }
});

client.login('token');

Upvotes: 3

Jack Bashford
Jack Bashford

Reputation: 44087

You've closed your on prematurely, and you haven't closed the if.

client.on('message', msg => {
  if (msg.content === 'ree') {
    message.author.kick("FURRY SLUR");
  }
});

Upvotes: 0

Related Questions