I don't now why it don't works
code : require('dotenv').config();
const { Client, Collection, GatewayIntentBits } = require("discord.js");
const fs = require("fs");
const logs = require("discord-logs")
const { Guilds, GuildMembers, GuildMessages, MessageContent } = GatewayIntentBits;
const { User, Message, GuildMember } = MessageContent;
const client = new Client({
intents: [Guilds, GuildMembers, GuildMessages],
partials: [User, Message, GuildMember],
});
client.commands = new Collection();
client.commandArray = [];
logs(client, {
debug: true
});
const functionFolders = fs.readdirSync(
./src/functions
);
for (const folder of functionFolders) {
const functionFiles = fs
.readdirSync(./src/functions/${folder}
)
.filter(file => file.endsWith('.js'));
for (const file of functionFiles)
require(./functions/${folder}/${file}
)(client);
}
client.handleEvents();
client.handleCommands();
client.handleLogs();
client.login("censuredcode");8 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.seems like your files in /functions don't export a function like you expect them to
ok and how can I solve it?
you should export what you expect them to export, i don't really know what your code is like so you have to fix it yourself
ok
this also is more of a general js problem, more appropriate for #other-js-ts
ok I will post the same error there thanks for the help
Codeblocks:
```js
const Discord = require("discord.js");
// further code
```
becomes
Inline Code:
`console.log('inline!');` becomes
console.log('inline!');