Add !removealias (commands.py)

This commit is contained in:
jesopo 2018-12-22 01:05:47 +00:00
parent 3039119f4a
commit be1d06796b

View file

@ -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)