aboutsummaryrefslogtreecommitdiff
path: root/modules/commands.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-12-22 01:05:47 +0000
committerGravatar jesopo2018-12-22 01:05:47 +0000
commitbe1d06796b8cfc66db559d8ee6acebbac5fccc44 (patch)
tree59ed8fe3c238f74c099db5bae23b975cdab3e5e8 /modules/commands.py
parentActually set new args_split (commands.py) (diff)
signature
Add !removealias (commands.py)
Diffstat (limited to 'modules/commands.py')
-rw-r--r--modules/commands.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/commands.py b/modules/commands.py
index 20c8b497..a66769ea 100644
--- a/modules/commands.py
+++ b/modules/commands.py
@@ -390,3 +390,20 @@ class Module(ModuleManager.BaseModule):
aliases[alias] = command
self._set_aliases(event["server"], aliases)
event["stdout"].write("Added '%s' alias" % alias)
+
+ @utils.hook("received.command.removealias", min_args=1)
+ def remove_alias(self, event):
+ """
+ :help: Remove a command alias
+ :usage: <alias>
+ :permission: command-alias
+ """
+ alias = event["args_split"][0].lower()
+ aliases = self._get_aliases(event["server"])
+
+ if not alias in aliases:
+ raise utils.EventError("No '%s' alias" % alias)
+
+ del aliases[alias]
+ self._set_aliases(event["server"], aliase)
+ event["stdout"].write("Removed '%s' alias" % alias)