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?
push0
push0•76d ago
No description
Favna
Favna•76d ago
have you considered using sapphire instead of your own handler? since that's what this server is for
push0
push0•76d ago
no, im new on djs i dont even know what that is..
Favna
Favna•76d ago
makes me wonder how you found this server then
push0
push0•76d ago
eh.. by looking 😂
Favna
Favna•76d ago
looking where
push0
push0•76d ago
anyway, how exactly sapphire works and whats that? disboard
Favna
Favna•76d ago
a framework for discordjs. https://sapphirejs.dev
Sapphire Framework
Home | Sapphire
Sapphire is a next-gen Discord bot framework for developers of all skill levels to make the best JavaScript/TypeScript based bots possible.
push0
push0•76d ago
how it works
Favna
Favna•76d ago
there is a guide on the site and a whole forum channel of hundreths of posts of information in #sapphire-support. Please put in some effort. if you dont want to put effort in making your bot then by all means that's fine too but then pay someone to make it for you
push0
push0•76d ago
the bot itself its working, i just had issues with the commands.
Favna
Favna•76d ago
that's basically the same as not working considering that the core functionality lol
push0
push0•76d ago
eh...
Favna
Favna•76d ago
anyway betwen the djs guide and the sapphire guide you should be able to get a simple bot running with some commands As for why your code wasnt working, you're not instantiating instances of what I assume are your command classes. It's honestly also a really messy way to load commands IMHO. If you look at how sapphire did it, much more thought goes into it.
Want results from more Discord servers?
Add your server
More Posts
Running Async Code in PrecinditionsI didn’t see this in the docs. But, is it possible to run async code in preconditions? TLDR: I needButtons InteractionsHello fellows, I have some questions. I'm a developer with experience with jda-ktx and JDA, I'm notGetting Data from .env FileI created a new Sapphire app using the CLI. I am using swc. And, I want to ask how do access env varTesting and Sapphire/discord.jsHeya. I'm new to Sapphire and Discord, but not new to JavaScript or coding in general. I'd love som/twitchadd (name) (link)name = choice name link = choice valueplease helpwe need help with a non respondent monitor and we have tried unplugging and changing the cords PLEASHello ,I need some Help about listeners in sapphire frameworkany one have a working example of ("guildMemberAdd") , a bot that welcome user when they join the seTypescript error in @ApplyOptions```ts import { ApplyOptions } from '@sapphire/decorators'; import { Command } from '@sapphire/framewIs there events listing like discord.js does?Just like in the screenshot, discord.js has listed out all events . So where I can find the same fomaking a !help command. where do i get the commands from?im trying to make a help command since I've started learning about paginated messages, but where wouthis.error()Is there any way of using `this.error()` but not trigger `messageCommandDenied`? This is because on Throwing errors in commands/subcommandsJust curious if there is a way to throw an error in an application command/subcommand and have it haDynamic subcommand methodsHey, i am creating some subcommands that basically have the same runner method, but i would wanna knHow do i use "separators" command in sapphire?Hi! Im new at sapphire/framework, i was reading the docs and seeing there is a `separators` options Limit command to specified roles?I honestly haven't done this in a while (not since pre-application commands) and am new to using SapHow to reference client in main file?I am trying to get `<Client>.users` from the index.ts but I am unsure as to how I would get around tList registered commands and listenersHi, i love working with sapphire it's amazing. I'm just wondering is there a way to obtain some sortCannot find moduleAnyone know what I need to install? (Ubuntu 22, image attached)Module augmentation does not workI recently updated my project with the latest versions of typescript and @sapphire/framework, and thConflicting typesI use the latest version of djs (14.14.1) and it seems like it has different types for taking the re