From aff62a8006eed24db2874482e50f22e2b521912d Mon Sep 17 00:00:00 2001 From: Toby Harradine Date: Tue, 16 Oct 2018 09:19:32 +1100 Subject: [PATCH] [Downloader] Unload extensions on uninstall (#2243) Resolves #2216. Signed-off-by: Toby Harradine --- redbot/cogs/downloader/downloader.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/redbot/cogs/downloader/downloader.py b/redbot/cogs/downloader/downloader.py index 416daad78e5..ce3df16aedb 100644 --- a/redbot/cogs/downloader/downloader.py +++ b/redbot/cogs/downloader/downloader.py @@ -325,13 +325,12 @@ async def _cog_uninstall(self, ctx, cog: InstalledCog): You may only uninstall cogs which were previously installed by Downloader. """ - # noinspection PyUnresolvedReferences,PyProtectedMember real_name = cog.name poss_installed_path = (await self.cog_install_path()) / real_name if poss_installed_path.exists(): + ctx.bot.unload_extension(real_name) await self._delete_cog(poss_installed_path) - # noinspection PyTypeChecker await self._remove_from_installed(cog) await ctx.send( _("Cog `{cog_name}` was successfully uninstalled.").format(cog_name=real_name)