From 415089224536d4c4488c7c97a2f1375bd4e90394 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 1 May 2022 23:00:28 -0600 Subject: [PATCH] Use proper functions to re-sync commands on update --- jarvis/utils/updates.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jarvis/utils/updates.py b/jarvis/utils/updates.py index b9d61c9..d2cf331 100644 --- a/jarvis/utils/updates.py +++ b/jarvis/utils/updates.py @@ -143,17 +143,17 @@ async def update(bot: "Snake") -> Optional[UpdateResult]: for module in current_commands.keys(): if module not in new_commands: logger.debug(f"Module {module} removed after update") - bot.unload_extension(module) + bot.shed_scale(module) unloaded.append(module) logger.debug("Checking for new/modified commands") for module, commands in new_commands.items(): logger.debug(f"Processing {module}") if module not in current_commands: - bot.load_extension(module) + bot.grow_scale(module) loaded.append(module) elif len(current_commands[module]) != len(commands): - bot.reload_extension(module) + bot.regrow_scale(module) reloaded.append(module) else: for command in commands: @@ -175,15 +175,15 @@ async def update(bot: "Snake") -> Optional[UpdateResult]: # Check if number arguments have changed if len(old_args) != len(new_args): - bot.reload_extension(module) + bot.regrow_scale(module) reloaded.append(module) elif any(x not in old_arg_names for x in new_arg_names) or any( x not in new_arg_names for x in old_arg_names ): - bot.reload_extension(module) + bot.regrow_scale(module) reloaded.append(module) elif any(new_args[idx].type != x.type for idx, x in enumerate(old_args)): - bot.reload_extension(module) + bot.regrow_scale(module) reloaded.append(module) return UpdateResult(