push0
push0
Explore posts from servers
SIASapphire - Imagine a framework
Created by push0 on 3/4/2024 in #discordjs-support
commands doesnt work
client.commands = new Collection(); const commandFiles = fs.readdirSync('/root/eye/Eye/Eye/commands/').filter(file => file.endsWith('.js')); for (const file of commandFiles) { const command = require(/root/eye/Eye/Eye/commands/${file}); client.commands.set(command.name, command); } client.on('messageCreate', message => { if (!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.length).trim().split(/ +/); const commandName = args.shift().toLowerCase(); if (!client.commands.has(commandName)) return; const command = client.commands.get(commandName); try { command.execute(message, args); } catch (error) { console.error(error); message.reply('There was an error trying to execute that command!'); } }); client.login(token); i did this for register my commands folder and make use every .js on that exactly folder where all the commands for the server are there, but it doesnt work...why?
21 replies