hi i dont know anything of coding, but i have tried to make a discord bot with a tutorial but on vs code i get this error:
TypeError: Cannot read properties of undefined (reading 'FLAGS')
and this are the first 14 line of the code
require('dotenv').config();
const {REST} = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { Client, Intents, Collection } = require('discord.js');
const { Player } = require("discord-player")
const fs = require('fs');
const path = require('path');
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_VOICE_STATES]
});
if someone know what i can do it would be appreciated.
CodePudding user response:
Intents
is now GatewayIntentBits
as of v14
https://discordjs.guide/additional-info/changes-in-v14.html#enum-values
https://discord-api-types.dev/api/discord-api-types-v10/enum/GatewayIntentBits
CodePudding user response:
i've tried with GatewayIntentBits and it shows this error
TypeError: Cannot read properties of undefined (reading 'GUILDS')
on this lines of code, idk how to put the GatewayIntentBits.
require('dotenv').config();
const {REST} = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { Client, Intents, Collection, GatewayIntentBits } = require('discord.js');
const { Player } = require("discord-player")
const fs = require('fs');
const path = require('path');
const client = new Client({
intents: [GatewayIntentBits.FLAGS.GUILDS, GatewayIntentBits.FLAGS.GUILD_MESSAGES, GatewayIntentBits.FLAGS.GUILD_VOICE_STATES]
});