-1

it keeps giving me an error every time I run it and it's always a different error after I change the code

This is my method that I found, Im coding this in the latest version of node.js and 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),
});

My error for this is TypeError: Cannot read properties of undefined (reading 'ALL')

I tried this too

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

And still it gives me an error TypeError: Intents is not a constructor

I don't know any other way to fix, this can someone help me?

  • The guide shows how to setup a client with intents: https://discordjs.guide/creating-your-bot/main-file.html#creating-the-main-file – Elitezen Jan 03 '23 at 01:29

1 Answers1

-1

By adding this

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

And adding this to the beginning

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