Multiple Command Folders?
I want to make 2 different bots on 2 separate project folders in the same hard drive. My second bot keeps getting errors from Sapphire reading the command folder on my first bot. I don't use any fixed path; I only use relative paths. How do I make Sapphire look into the correct command folder?
9 Replies
I changed the main file of the second bot from
index.js
to something else and it seems to fix the problem. Is it the only solution?Are you trying to run 2 bots in the same process?
Show file/folder structure and code for both. Show package.json and entrypoint and do you start them at the same time using the same token?
When asking for help, make sure to provide as much detail as possible. What have you tried so far? Do you have stack traces that you can show us? What are you trying to achieve? Try to answer these questions and others, so we do not have to ask for them afterwards.
❯ For a good guide on how to ask questions, see the instructions that StackOverflow gives. You should try to always follow these guidelines. ❯ For an excellent video that shows how not to ask technical questions, watch this YouTube video by LiveOverflow. ❯ Asking technical questions (Clarkson) ❯ How to ask questions the smart way (Raymond)
Also please review how to properly ask technical questions ^
They are on 2 different processes with pm2. They both have an index.js file when Bot B keeps loading Bot A's commands. I changed B's index.js to core.js now, and it loaded. So, basically, changing the name of the main file works.
But now I have another issue: sapphire doesn't register any command on B. About the details:
- They have the exact same structure, but sapphire doesn't work on B.
- They also have the same package.json files, except B has its "name", "description", and "main" difference from A.
- Their main index.js files are the same, except for the database path and token (lines 33 and 68).
(The first one is A, and the second one is B, and I have commands in the
commands
folder. The last picture is a slash command from B)
What I have tried:
- Restart each bot.
- Wait for hours for the commands to appear.
- Find a way to force sapphire.js to look at a certain path, but I couldn't find anything comprehensible about this.
- Search this server but no keyword was matched.
What I haven't tried:
- Reinvite B.
I was hoping that someone who has seen this problem before could just quickly tell me why. If it requires me to spend a few hours gathering all the details, as the bot said, it's probably faster for me to just debug it myself.I run them on 2 different processes with the same file name, but I hear it's not the issue for other people. :bugcatMathThink:
Solution
So I switched the "REQUIRES OAUTH2 CODE GRANT" off and it works now! :yay:
Thanks everyone for helping!