此代码不起作用,它从不记录 Ready!
到控制台。它也没有注销任何错误,所以我相信它可能已正确登录,但无法正常工作。有谁指点一下吗?
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}`");
}
}
为了确保我做得正确,我将其放入名为 discord-fisher.js
的文件中我正在使用 node discord-fisher.js
运行它从终端。
最佳答案
每the documentation for Discord.js对于Client#login
:
.login( token )
Logs the client in, establishing a websocket connection to Discord.
因此,当您使用登录
时,您无需提供电子邮件或密码详细信息,而是提供与您的帐户关联的 API token 。
关于javascript - 为什么我无法登录 Discord.js 客户端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44899453/