Modules
Robo.js ain't just about powerβit's all about keeping things neat and tidy too. That's where modules come in. Picture a module like a mini-bot, all packed up inside your main bot. You've got commands and events, all hanging out together under one roof.
Using modules is totally up to you. If you prefer to keep things simple, that's okay too!
What's in a Module? πβ
In the land of Robo.js, modules are your go-to when you want to bundle commands and events into neat little subfolders. It's like having a bunch of mini-Robo bots living inside your main bot. You can create as many module folders as you want, and name 'em whatever you fancy. Though, it's a smart move to name them after the feature or function that the files inside represent.
Check out this nifty Robo.js file structure with modules:
src/
βββ modules/
βββ moderation/
| βββ commands/
| βββ events/
βββ fun/
βββ commands/
βββ events/
The Big Picture πβ
Robo.js lets your modules
directory chill alongside top-level commands
and events
directories. This gives you the freedom to decide how granular you want your bot structure to be. You could have some general commands or events at the top-level, while specific ones are tucked away in their respective modules.
src/
βββ commands/
βββ events/
βββ modules/
βββ moderation/
| βββ commands/
| βββ events/
βββ fun/
βββ commands/
βββ events/
Heads up! While events can overlap, commands gotta be unique. You can't have multiple files with the same name chillin' in different command folders across different modules. Keep your command names unique to dodge any confusion.
Modules All The Way Down πͺβ
Now here's where it gets really interesting! These magical modules can be nested infinitely. Picture this: A module, living inside another module, with another module tucked away inside it, and another... and another... You get the ideaβit's modules within modules all the way to the edge of the universe!
Let's glance into the abyss:
src/