find_setting() returns a tuple

This commit is contained in:
jesopo 2019-11-20 11:53:26 +00:00
parent 03e4f780a0
commit d63294067b

View file

@ -26,12 +26,12 @@ class Module(ModuleManager.BaseModule):
def _get_alias(self, server, target, command): def _get_alias(self, server, target, command):
setting = "%s%s" % (SETTING_PREFIX, command) setting = "%s%s" % (SETTING_PREFIX, command)
alias = self.bot.get_setting(setting, command = self.bot.get_setting(setting,
server.get_setting(setting, server.get_setting(setting,
target.get_setting(setting, None))) target.get_setting(setting, None)))
if not alias == None: if not command == None:
alias, _, args = alias.partition(" ") command, _, args = command.partition(" ")
return alias, args return command, args
return None return None
def _get_aliases(self, targets): def _get_aliases(self, targets):
alias_list = [] alias_list = []
@ -39,10 +39,10 @@ class Module(ModuleManager.BaseModule):
alias_list += target.find_settings(prefix=SETTING_PREFIX) alias_list += target.find_settings(prefix=SETTING_PREFIX)
aliases = {} aliases = {}
for alias in alias_list: for alias, command in alias_list:
alias, _, args = alias.partition(" ") alias = alias.replace(SETTING_PREFIX, "", 1)
if not alias in aliases: if not alias in aliases:
aliases[alias] = args or None aliases[alias] = command
return aliases return aliases
@utils.hook("get.command") @utils.hook("get.command")