- Joined
- Jun 10, 2019
- Messages
- 1
- Reaction score
- 0
I have a probleme in coding a discord bot ...
TypeError: Can not read property 'filter' of undefined
bot.command = new Discord.Collection ();
fs.readdir ('./ comands /', (err, files) => { if (err) console.log (err);
let jsFile = files.filter (f => f.split ("."). pop () === "js");
if (jsFile.lenght <= 0) { console.log ("I can not find the command");
return;
}
jsFile.forEach ((f, i) => { let props = require (`./commands / $ {f}`);
bot.command.set (props.help.name, props);
}); });
TypeError: Can not read property 'filter' of undefined
bot.command = new Discord.Collection ();
fs.readdir ('./ comands /', (err, files) => { if (err) console.log (err);
let jsFile = files.filter (f => f.split ("."). pop () === "js");
if (jsFile.lenght <= 0) { console.log ("I can not find the command");
return;
}
jsFile.forEach ((f, i) => { let props = require (`./commands / $ {f}`);
bot.command.set (props.help.name, props);
}); });