-1
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD] });

C:\Users\pulokgamer\Desktop\MUSIC BOT\index.js:2 const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });

TypeError: Cannot read properties of undefined (reading 'FLAGS')

Rajesh Pandya
  • 1,540
  • 4
  • 18
  • 31
  • 1
    Does this answer your question? [Discord.js v13 code breaks when upgrading to v14](https://stackoverflow.com/questions/73028854/discord-js-v13-code-breaks-when-upgrading-to-v14) – Zsolt Meszaros Apr 07 '23 at 17:57

1 Answers1

0

In discord.js v14 the previous v13 Intents class was updated to IntentsBitField. It operates pretty similarly just with a few different naming conventions.

Change:

const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD] });

To:

const { Client, IntentsBitField } = require('discord.js');
const client = new Client({ intents: [IntentsBitField.Flags.GuildVoiceStates, IntentsBitField.Flags.GuildMessages, IntentsBitField.Flags.Guilds] });

IntentsBitField
GatewayIntentBits

Finbar
  • 1,127
  • 1
  • 5
  • 17