#Command Organization

1 messages · Page 1 of 1 (latest)

mighty mesa
#

Is there a neat way to organize commands? As in, giving each command its own .cs file so you have a file structure such as

📁Bot
⠀└Program.cs
⠀└📁Commands
⠀⠀⠀└ping.cs
⠀⠀⠀└ban.cs
⠀⠀⠀└kick.cs

rather than having just a single massive Commands.cs file that holds everything?

cold patrol
#

For as long as they inherit the correct interface you can split them in their own files. This is also sort of the design you would go for to implement them as microservices, which is also good practice

#

It just boils down to whether you want multiple files with 10 lines of code or whether you want a single with hundreds

#

Personally I'd go with whatever you think is easier to maintain. A huge file is definitely harder on readability if not properly structured/commented. Many smaller ones just make navigation harder if they grow into dozens of files

fleet saddle
#

You can also group them in class file, like your example would have a ModModule that has the methods for ban and kick
and the end of the day it's whatever you're comfortable with

mighty mesa
upper crane
#

might not need public, but making it internal means d.net cant see it

mighty mesa
#

Ah, thank you

#

Forgot internal was default

upper crane
#

yea, its pre annoying