waves hello! I'm hoping I can get some help. i'm following a tutorial and trying to get this to work but i just... can't figure it out.
require("dotenv").config();
const { token } = process.env;
const { Client, Collection, GatewayIntentBits } = require("discord.js");
const fs = require("fs");
const client = new Client({ intents: GatewayIntentBits.Guilds });
client.commands = new Collection();
client.commandArray = {};
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.login(token);
I'm getting this error:
require(`./functions/${folder}/${file}`)(client);
^
TypeError: require(...) is not a function
at Object.<anonymous> (V:\Shattered Realms V4\src\bot.js:17:45)
Any help?