From 874b24e08179b32d280fe7952d38a31dd5868ad6 Mon Sep 17 00:00:00 2001 From: gammafn Date: Tue, 30 Mar 2021 11:49:42 -0500 Subject: [PATCH] Mention aliasing modules in the README --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 2ad48c4..53dfa74 100644 --- a/README.md +++ b/README.md @@ -623,6 +623,21 @@ Set the bot_ignore parameter to True in sender functions to acheive this. If you write a module that installs a custom message handler, use bot.should_ignore_event(event) to check if event should be ignored. +### Aliasing modules + +A module can declare its own _aliases_ with the `add_module_aliases` command. +You probably want to call it during `matrix_start`: + +```python +class MatrixModule(BotModule): + + def matrix_start(self, bot): + super().matrix_start(bot) + self.add_module_aliases(bot, ['new_name', 'another_name']) +``` + +Then you can call this module with its original name, `!new_name`, or `!another_name` + ## Contributing If you write a new module, please make a PR if it's something useful for others.