Fix cog reloading
This commit is contained in:
parent
d89e3ea21a
commit
7968dd7780
1 changed files with 5 additions and 5 deletions
|
@ -157,10 +157,10 @@ async def update(bot: "Client") -> Optional[UpdateResult]:
|
||||||
for module, commands in new_commands.items():
|
for module, commands in new_commands.items():
|
||||||
logger.debug("Processing %s", module)
|
logger.debug("Processing %s", module)
|
||||||
if module not in current_commands:
|
if module not in current_commands:
|
||||||
bot.grow_cog(module)
|
bot.load_cog(module)
|
||||||
loaded.append(module)
|
loaded.append(module)
|
||||||
elif len(current_commands[module]) != len(commands):
|
elif len(current_commands[module]) != len(commands):
|
||||||
bot.regrow_cog(module)
|
bot.reload_cog(module)
|
||||||
reloaded.append(module)
|
reloaded.append(module)
|
||||||
else:
|
else:
|
||||||
for command in commands:
|
for command in commands:
|
||||||
|
@ -182,15 +182,15 @@ async def update(bot: "Client") -> Optional[UpdateResult]:
|
||||||
|
|
||||||
# Check if number arguments have changed
|
# Check if number arguments have changed
|
||||||
if len(old_args) != len(new_args):
|
if len(old_args) != len(new_args):
|
||||||
bot.regrow_cog(module)
|
bot.reload_cog(module)
|
||||||
reloaded.append(module)
|
reloaded.append(module)
|
||||||
elif any(x not in old_arg_names for x in new_arg_names) or any(
|
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
|
x not in new_arg_names for x in old_arg_names
|
||||||
):
|
):
|
||||||
bot.regrow_cog(module)
|
bot.reload_cog(module)
|
||||||
reloaded.append(module)
|
reloaded.append(module)
|
||||||
elif any(new_args[idx].type != x.type for idx, x in enumerate(old_args)):
|
elif any(new_args[idx].type != x.type for idx, x in enumerate(old_args)):
|
||||||
bot.regrow_cog(module)
|
bot.reload_cog(module)
|
||||||
reloaded.append(module)
|
reloaded.append(module)
|
||||||
|
|
||||||
return UpdateResult(
|
return UpdateResult(
|
||||||
|
|
Loading…
Add table
Reference in a new issue