This code isn't working, it never logs Ready!
to the console. It's also not logging out any errors, so I believe it may have logged in correctly but just isn't working. Does anyone have any pointers?
var Discord = require("discord.js");
var client = new Discord.Client();
client.login('myEmail', 'myPassword', output);
client.on('ready', () => {
console.log("Ready!");
});
function output(error, token) {
console.log("errorz!");
if (error) {
console.log("There was an error logging in: ${error}");
return;
} else {
console.log("`Logged in. Token: ${token}`");
}
}
Just to make sure I am doing this right, I have put this in a file called discord-fisher.js
and I am running it using node discord-fisher.js
from the terminal.
Per the documentation for Discord.js for Client#login
:
.login( token )
Logs the client in, establishing a websocket connection to Discord.
So when you use login
, you don't provide your email or password details, you provide your API token associated with your account .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.