diff --git a/heroku/loader.py b/heroku/loader.py index 85f2a48..d400196 100644 --- a/heroku/loader.py +++ b/heroku/loader.py @@ -923,13 +923,13 @@ class Modules: return next( ( - (cmd, self.commands[cmd.lower()]) + (cmd, self.commands[cmd.split()[0].lower()]) for cmd in [ _command, self.aliases.get(_command.lower()), self.find_alias(_command), ] - if cmd and cmd.lower() in self.commands + if cmd and cmd.split()[0].lower() in self.commands ), (_command, None), ) @@ -1165,12 +1165,12 @@ class Modules: handler.id, ) - def add_alias(self, alias: str, cmd: str) -> bool: + def add_alias(self, alias: str, cmd: str, args: str = None) -> bool: """Make an alias""" if cmd not in self.commands: return False - self.aliases[alias.lower().strip()] = cmd + self.aliases[alias.lower().strip()] = f"{cmd} {args}" if args else cmd return True def remove_alias(self, alias: str) -> bool: diff --git a/heroku/modules/settings.py b/heroku/modules/settings.py index ecbf0bc..ad56333 100644 --- a/heroku/modules/settings.py +++ b/heroku/modules/settings.py @@ -240,17 +240,18 @@ class CoreMod(loader.Module): @loader.command() async def addalias(self, message: Message): - if len(args := utils.get_args(message)) != 2: + if len(args := utils.get_args(message)) < 2: await utils.answer(message, self.strings("alias_args")) return - alias, cmd = args - if self.allmodules.add_alias(alias, cmd): + alias, cmd, *rest = args + rest = " ".join(rest) if rest else None + if self.allmodules.add_alias(alias, cmd, rest): self.set( "aliases", { **self.get("aliases", {}), - alias: cmd, + alias: f"{cmd} {rest}" if rest else cmd, }, ) await utils.answer(