Discord.js intents | Not working Discord v14 Node.js v19.3.0



每次我运行它时它总是给我一个错误在我改变代码后它总是一个不同的错误

这是我的方法,我发现,我在最新版本的node.js和discord.js编码这个

const { Client, Intents } = require('discord.js');
const fs = require('fs');
// Create a new client
const client = new Client({
intents: new Intents(Intents.ALL),
});

我的错误是TypeError: Cannot read properties of undefined (reading 'ALL')

我也试过了

const client = new Client({
intents: new Intents([
'GUILDS',
'GUILD_MESSAGES',
'MESSAGE_CONTENT',
'GUILD_MEMBERS',
]),
});

仍然给我一个错误TypeError: Intents不是构造函数

我不知道有什么其他的方法来解决这个问题,有人能帮我吗?

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

并将此添加到开头

const { Client, Events, GatewayIntentBits } = require('discord.js');

最新更新