【发布时间】:2021-11-16 17:19:53
【问题描述】:
所以我想使用 discord.js 在 JavaScript 中创建一个有趣的机器人 discord。
我写了这段代码:
const Discord = require("discord.js")
const client = new Discord.client()
client.once('ready',() => {
console.log("Ready !");
});
client.login('token');
但是当我尝试运行它时,我得到了这个错误:
/home/runner/MelodicPlainApplicationprogrammer/node_modules/discord.js/src/rest/RESTManager.js:32 常量令牌 = this.client.token ?? this.client.accessToken; ^ SyntaxError: Unexpected token '?'
这是在 repl.it 上的,当我在 VSCode 中时,它可以工作。
为什么?
【问题讨论】:
-
您已使用您的令牌权限更改了“令牌”?
-
您是否尝试生成和使用新令牌?
标签: javascript discord discord.js bots