Please help me
the text of the error I get in the terminal:
fs.readdir("./komutlar/",(err,files) => { ^
TypeError: Cannot read properties of undefined (reading 'readdir') at Object. (C:\Users\tDiff\Desktop\TDIFF\tdıff.js:15:4) enter code here
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MEMBERS
]
})
const {token} = require("./ayarlar.json")
const {fs} = require("fs");
const { Options } = require("discord.js");
global.client = client;
client.commands = (global.commands = []);
fs.readdir("./komutlar/",(err,files) => { // where l got the error
if(err) throw err;
files.forEach(f => {
if(!f.endsWith(".js")) return;
let p = require(`./komutlar/${f}`)
client.commands.push({
name:p.name.toLowerCase(),
description:p.description,
options:p.options,
type:p.type,
});
console.log(`✔ Komut eklendi: ${p.name}`);
})
});
fs.readdir("./events/",(err,files) => { // where l got the error
files.forEach(f => {
if(!f.endsWith(".js"))return;
const e = require(`./events${f}`);
let eName = f.split(".")[0];
client.on(eName, (...args) => {
e()
})
})
});
client.once("ready",() => {
console.log(`${client.user.tag} Aktif!`);
client.user.setPresence({
activities:[
{
name:"TDIFF",
type:"LISTENING"
}
],
status:"dnd"
})
})
client.login(token)```