Discord Api 必须向客户提供有效意图,但代码不起作用
我为我的discord.js 机器人设置了
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
。
但现在我只收到错误消息:
未捕获的 c:\Users\niko\Documents\bot\receptionist\index.js:8
我的 index.js 中的第 8 行是这样的:
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
I set up the
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
for my discord.js bot.
But now I just get the error message:
Uncaught c:\Users\niko\Documents\bot\receptionist\index.js:8
The line 8 in my index.js is this:
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
删除代码的第一行,其中指出:
并删除以下代码的第三行:
因为您在声明后使用以下意图声明客户端
前缀。
并且还删除
remove the first line of the code which states:
and also delete the third line of the code which follows :
because you're declaring the client with the intents below after declaring the
prefix.
And also delete