I see a lot of other python frameworks use decorators to define commands, routes, etc. I think it would be a good extension to include that in our framework as well, and may simplify some of the boilerplate for module developers.
Something like the following would be nice:
class TestModule(CommandModule):
@command("test")
def test_(self, msg=msg):
self.reply(msg, body="Test!")
Here, the pair ("test", self.test_) would be automatically added to the module's self.commands dict, without needing to declare it in self.init() first.
Ideally, this should work with chaining other decorators, like hasPermission and AsArgs, as the command dec should not touch the parameters at all.
I see a lot of other python frameworks use decorators to define commands, routes, etc. I think it would be a good extension to include that in our framework as well, and may simplify some of the boilerplate for module developers.
Something like the following would be nice:
Here, the pair ("test", self.test_) would be automatically added to the module's
self.commandsdict, without needing to declare it inself.init()first.Ideally, this should work with chaining other decorators, like
hasPermissionandAsArgs, as thecommanddec should not touch the parameters at all.