Open GeekyDeaks opened 7 years ago
Just pushed my initial attempt at modularisation on a branch called modular
. Only thing working are the destiny commands.
commit: 9c13cc3
Current scheme for the modules looking like this:
bot/modules/[module name]/index.js
bot/modules/[module name]/commands/*
I am wondering if the commands subdirectory under each module is a little overkill...
I am doing something a little bit underhand to pass the app state around. Basically I am using require.main
to reference the destinybot.js, which then allows referencing module.exports
to share state.
I like it and think it is a good starting point. And I really don't think the /commands
directory is too much. The way I think about is -
I am adding a module to my bot, called Destiny. Inside that module, I have core files that are used to execute the cmds made available by the module as first class citizens within the package. The cmds that are made available are keep neatly within a folder called "commands".
To me, this structure makes it very simple for someone new to the project or implementing it themselves, so see what it going on. Again, as a start, it makes sense to me. As the project matures and grows, it actually seems to offer a bit more flexibility for us to refine it more and more.
[EDIT] Remember, for this to be truly modular, we would need to each of the modules into their own stand alone package that users could add to their project themselves. We are not there yet, by a long shot. This is a good first step.[\EDIT
Hey everyone. Going to ditch this idea and make the bot purely destiny related (or at least Bungie related). It's a nightmare to test with the current suite of modules and it's causing me to avoid making changes as I neglected to implement a test harness.
It would be useful to take each piece of functionality and modularise it so that it's self contained and can provide features and/or commands. This would remove the need for #7 and provide a solution to #1. It may also be beneficial to be able to override the command prefix on a per module basis.