Discord.js: Example code on homepage produces UnhandledPromiseRejectionWarning

Created on 12 Apr 2018  路  5Comments  路  Source: discordjs/discord.js

The example code on https://discord.js.org produces an UnhandledPromiseRejectionWarning.

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');

Produces

(node:98840) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Incorrect login details were provided.
(node:98840) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
question (please use Discord instead)

Most helpful comment

image

All 5 comments

This is not an issue on our end- it simply means the provided token is wrong. Feel free to discuss farther on the Discord server if you are having difficulty locating the correct token, we can try our best to help.

Issue was a result of an incorrect token.

He's got fingers of fury! 馃槃 Thanks for the help.

before moving to a less-persistent discussion form, where do we find the token that is missing in this issue? For example, I'm getting this error too, and found my token at https://discordapp.com/developers but my token was called a "Client Secret" so I suppose that's not where you get the correct token, but it does demonstrate how to share where the correct token could be found if anyone knows where to find it.

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shukriadams picture shukriadams  路  3Comments

smchase picture smchase  路  3Comments

tiritto picture tiritto  路  3Comments

Acaretia picture Acaretia  路  3Comments

kvn1351 picture kvn1351  路  3Comments