UnhandledPromiseRejectionWarning Discord bot

250 Views Asked by At

I'm trying to create my own discord bot to learn more code and to make features for my server. I've been following this tutorial on how to get started but when I run the nodemon --inspect index.js, I get this message and it doesn't work as intended (see picture).

UnhandledPromiseRejectionWarning: AbortError: The user aborted a request.

Error Message

It's the most basic of command and I've just copy-pasted so I don't understand what I've done wrong.

Here's 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 === 'ping') {
    msg.reply('pong');
  }
});

client.login('TOKEN');
0

There are 0 best solutions below