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
d.js toolkit
d.js toolkit2y ago
• 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.
d4
d42y ago
seems like your files in /functions don't export a function like you expect them to
Ascensor Rural
Ascensor RuralOP2y ago
ok and how can I solve it?
d4
d42y ago
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
Ascensor Rural
Ascensor RuralOP2y ago
ok
d4
d42y ago
this also is more of a general js problem, more appropriate for #other-js-ts
Ascensor Rural
Ascensor RuralOP2y ago
ok I will post the same error there thanks for the help
d.js docs
d.js docs2y ago
Codeblocks: ```js const Discord = require("discord.js"); // further code ``` becomes
const Discord = require("discord.js");
// further code
const Discord = require("discord.js");
// further code
Inline Code: `console.log('inline!');` becomes console.log('inline!');
Want results from more Discord servers?
Add your server