Javascript "undefined reading 'FLAGS'?
Ich habe eine Fehlermeldung bekommen:
TypeError: Cannot read properties of undefined (reading 'FLAGS') at Object.<anonymous> (D:\Discord\Discord Bot\index.js:7:17) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47
Hier ist der Code:
// Dependencies
const { Client, Intents, Collection } = require('discord.js');
const bot = new Client({
restTimeOffset: 0,
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_PRESENCES
]
})
const { readdirSync } = require('fs');
const config = require('./config.json');
// Das ready Event
bot.on('ready', async() => {
console.log(Der Bot ist nun eingeloggt! Name: ${bot.user.tag});
Findet jemand den Fehler?
1 Antwort
Nutzer, der sehr aktiv auf gutefrage ist
Intents.FLAGS.GUILDS
FLAGS ist Undefinded ergo gibts auch keine .GUILDS
kann daran liegen das dein Node.js nicht aktuell ist für die benötigte discord version. oder die discord.js ist zu alt .