diff --git a/jarvis/cogs/botutil.py b/jarvis/cogs/botutil.py index ea3fdb2..a0b60e9 100644 --- a/jarvis/cogs/botutil.py +++ b/jarvis/cogs/botutil.py @@ -95,12 +95,18 @@ class BotutilCog(Scale): self.logger.debug("Finished sleeping, loading new commands") reloaded = [] + loaded = [] + unloaded = [] new_commands = get_all_commands() + for module in current_commands: + if module not in new_commands: + self.bot.unload_extension(module) + unloaded.append(module) for module, commands in new_commands.items(): self.logger.debug(f"Processing {module}") if module not in current_commands: self.bot.load_extension(module) - reloaded.append(module) + loaded.append(module) elif len(current_commands[module]) != len(commands): self.bot.reload_extension(module) reloaded.append(module) @@ -169,11 +175,16 @@ class BotutilCog(Scale): ) table.add_row("Total", str(i_total), str(d_total), str(l_total)) + new = "\n".join(loaded) + removed = "\n".join(unloaded) + changed = "\n".join(reloaded) fields = [ EmbedField(name="Old Commit", value=current_hash), EmbedField(name="New Commit", value=remote_hash), - EmbedField(name="Files Changes", value=f"```ansi\n{table}\n```"), + EmbedField(name="New Modules", value=f"```\n{new}\n```"), + EmbedField(name="Removed Modules", value=f"```\n{removed}\n```"), + EmbedField(name="Changed Modules", value=f"```\n{changed}\n```"), ] embed = build_embed( @@ -181,7 +192,7 @@ class BotutilCog(Scale): ) self.logger.info("Updates applied") - await ctx.reply(embed=embed) + await ctx.reply(f"File Changes: ```ansi\n{table}\n```", embed=embed) else: embed = build_embed(title="Update Status", description="No changes applied", fields=[])