Discord Api 必须为客户提供有效的意图,但代码确实有效
Discord Api Valid intents must be provided for the Client but the code dosent work
我设置了
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
我的 discord.js 机器人。
但现在我只收到错误信息:
Uncaught c:\Users\niko\Documents\bot\receptionist\index.js:8
我的 index.js 中的第 8 行是这样的:
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
const { Client, Intents, MessageEmbed, Presence, Collection, Interaction } = require ('discord.js');
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]
});
删除第一行代码:
const Discord = require('discord.js')
并删除第三行以下代码:
const client= new Discord.Client()
因为您在声明
前缀。
并删除
const bot = client
我设置了
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
我的 discord.js 机器人。
但现在我只收到错误信息:
Uncaught c:\Users\niko\Documents\bot\receptionist\index.js:8
我的 index.js 中的第 8 行是这样的:
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
const { Client, Intents, MessageEmbed, Presence, Collection, Interaction } = require ('discord.js');
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]
});
删除第一行代码:
const Discord = require('discord.js')
并删除第三行以下代码:
const client= new Discord.Client()
因为您在声明 前缀。 并删除
const bot = client