Skip to content

Commit

Permalink
[Downloader] Unload extensions on uninstall (#2243)
Browse files Browse the repository at this point in the history
Resolves #2216.

Signed-off-by: Toby Harradine <[email protected]>
  • Loading branch information
Tobotimus authored Oct 15, 2018
1 parent b5fd28e commit aff62a8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions redbot/cogs/downloader/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit aff62a8

Please sign in to comment.