A powerful and extendable Discord bot, with it's own module system :3 thevoid.cafe/projects/voidy

๐Ÿ“ Add registry- and module-level documentation

+38
+14
docs/architecture/module-level.md
··· 1 + # Module level architectural overview 2 + Modules are groups of commands, events and more. 3 + They export those, and provide a combined title, description and the discord name of the user who created them, using the author field. 4 + 5 + ## Modules 6 + Each module *can* contain a set of commands, events or subscribers. 7 + 8 + Subsribers are similar to events, but are related to the internal Lifecycle management of the bot, not Discord. 9 + 10 + These are the properties a module is required to provide: 11 + - name (a small and concise name for the module, e.g. "statistics") 12 + - description (a small text, which describes the use-cases of the module) 13 + - author (discord username of the module's author) 14 + - exports (an array of ModuleExportItem's, each containing a `source` and uninstantiated `loader` property)
+24
docs/architecture/registry-level.md
··· 1 + # Registry level architectural overview 2 + The Registry level of our architecture mainly focuses on Registries, exported Module data structure, Lifecycle events, and first database interactions, to track Registry/Module states. 3 + 4 + ## Registries 5 + All Registries will follow a common Registry structure. 6 + 7 + The following properties are required: 8 + - store (Where the raw structure of imported Modules is stored) 9 + 10 + The following methods are required: 11 + - collect (uses the ModuleLoader to collect the raw JSON output of all registry modules) [registry::preCollect, registry::postCollect] 12 + - load (uses various loaders to prepare Module contents, based on the Module's exports property, which exports an array of ModuleExportItem's.) [registry::preLoad, registry::postLoad] 13 + - activate (activates the registry and all contained features) [registry::preActivate, registry::postActivate] 14 + - unload (deactivates all modules stored in the registry and the registry itself) [registry::preUnload, registry::postUnload] 15 + 16 + 17 + ### ModuleExportItem 18 + Each Module provides a public `exports` property, which is an array of ModuleExportItem's, each ModuleFetchItem provides a `source` and a `loader` property. 19 + 20 + The `source` property is a simple path, pointing to a directory or file. 21 + The `loader` property takes an uninitialized loader class, which is then instantiated by the Registry, while loading the Module. 22 + 23 + 24 + @Todo: document registry error-notify feature, which uses a Module's author field, to notify the user of an error, directly within Discord.