From be1d06796b8cfc66db559d8ee6acebbac5fccc44 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 22 Dec 2018 01:05:47 +0000 Subject: Add !removealias (commands.py) --- modules/commands.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'modules') 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: + :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) -- cgit v1.3.1-10-gc9f91