commands

Is there any way to ignore a command inside the commands folder ?! i have an abstract class that extend Command ! but i do not want to set the abstract class as command , only the child classes that extends the abstract class
Solution:
move BaseSelfRoleCommand out of the commands folder
Jump to solution
13 Replies
Oreo ™
Oreo ™10mo ago
are you declaring the class inside the commands folder?
Oreo ™
Oreo ™10mo ago
why move the declaration of the abstract class into a different folder and it should be fine maybe a lib folder
-_-العربي الفصيح-_-
but i need the child classes that extend from that abstract class , to be commands
Oreo ™
Oreo ™10mo ago
if the abstract class extends the base Command class its gonna work
-_-العربي الفصيح-_-
yeah it will , but it will also consider that abstract as command, and i do not want that
Oreo ™
Oreo ™10mo ago
what have u tested this? or are u just speculating
-_-العربي الفصيح-_-
i tested it
Ben
Ben10mo ago
That 100% should work as I am doing the same thing with my bot. Can you send your file stucture
-_-العربي الفصيح-_-
i think you didn't understand me one sec I have an abstract class called BaseSelfRoleCommand. The BaseSelfRoleCommand extend the Command. And i have two class ColorCommand and GenderCommand , both this classes extends BaseSelfRoleCommand and all this class are inside commands . the problem is , that sapphire create 3 commands , instead of just 2 (color,gender) so if i send !!color , or !! gender , it works (!! is my prefix bot) but the problem is when i also send !!baseselfrole , it also works , wich have no meaning to set it as a command
Solution
Ben
Ben10mo ago
move BaseSelfRoleCommand out of the commands folder
-_-العربي الفصيح-_-
Thanks a lot , it worked !! now i feel dump
Ben
Ben10mo ago
For the reference of others, the file layout should look like this.
src
│ ...other stuff

├───commands
│ ColorCommand.ts
│ GenderCommand.ts
│ ...other stuff

└───lib
│ BaseSelfRoleCommand.ts
src
│ ...other stuff

├───commands
│ ColorCommand.ts
│ GenderCommand.ts
│ ...other stuff

└───lib
│ BaseSelfRoleCommand.ts
Want results from more Discord servers?
Add your server