ProtOS Discord Bot (Codename: Ram) DISCLAIMER: This repository is a mirror of my local network source control. Information may or may not be inaccurate. Updates only whenever I can be bothered.
Currently we are importing subcommands using dynamic code execution. Not only is this unsafe, hard to read, and prone to errors, it also means that subcommands need to follow a very strict structure and naming convention to be recognized by the application.
To fix this, we can use importlib to load the commands, then look for subclasses of cmdsys.Command. I've already used a similar system in LUSWCA with great success.
Done. The new importer enables users to break free of the old naming conventions. Further, it even allows multiple commands within the same source file, which enables them to share common resources.
Currently we are importing subcommands using dynamic code execution. Not only is this unsafe, hard to read, and prone to errors, it also means that subcommands need to follow a very strict structure and naming convention to be recognized by the application. To fix this, we can use importlib to load the commands, then look for subclasses of cmdsys.Command. I've already used a similar system in LUSWCA with great success.