Subcommand Organization

I'm switching back to the sapphire subcommand plugin from kanames since it's not updated and I'm running into a minor issue I'm not sure how to solve. With the sapphire subcommand plugin all subcommands in a single top level subcommand are supposed to have the chatinputrun methods defined in the same file. This makes my subcommand files very long and hard to get to the code for individual commands. I've tried putting the logic for the commands in their own file, but then I get "Error [EMPTY_MODULE]: A compatible class export was not found" for files that define command logic but not the commands themselves because I have them grouped together in the commands folder like in the attached image. The game_parent file is where the command registration is and the chatinput run methods there call methods from guess/whack etc to perform command logic. I can move them to somewhere not under commands folder but I'd like to keep them all the logic together so it's not confusing. Is there a better way to do this?
Solution:
I'm not entirely sure if it'll work but I think you can prefix the files that have utility functions with a _ so they're not loaded as pieces. If that doesn't work then yes you'll have to put them outside the commands folder.
Jump to solution
5 Replies
Solution
Favna
Favna11mo ago
I'm not entirely sure if it'll work but I think you can prefix the files that have utility functions with a _ so they're not loaded as pieces. If that doesn't work then yes you'll have to put them outside the commands folder.
KB
KB11mo ago
It would work, yeah
Ravelt
Ravelt11mo ago
Oh excellent let me try that thats works thanks!
Ravelt
Ravelt11mo ago
Is there a way for the hot module plugin to reload a piece if theres been in a change in an imported function?
Favna
Favna10mo ago
no it uses chokidar, which wont detect that and if you want to restart on every change just use something like tsc-watch
Want results from more Discord servers?
Add your server