[commands] Properly load the original module when reloading fails.
Fix #2291
This commit is contained in:
parent
8e594ac1ad
commit
dd12fbf73d
@ -286,7 +286,7 @@ class BotBase(GroupMixin):
|
|||||||
|
|
||||||
async def is_owner(self, user):
|
async def is_owner(self, user):
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
Checks if a :class:`~discord.User` or :class:`~discord.Member` is the owner of
|
Checks if a :class:`~discord.User` or :class:`~discord.Member` is the owner of
|
||||||
this bot.
|
this bot.
|
||||||
|
|
||||||
@ -729,7 +729,8 @@ class BotBase(GroupMixin):
|
|||||||
# if the load failed, the remnants should have been
|
# if the load failed, the remnants should have been
|
||||||
# cleaned from the load_extension function call
|
# cleaned from the load_extension function call
|
||||||
# so let's load it from our old compiled library.
|
# so let's load it from our old compiled library.
|
||||||
self._load_from_module_spec(lib, name)
|
lib.setup(self)
|
||||||
|
self.__extensions[name] = lib
|
||||||
|
|
||||||
# revert sys.modules back to normal and raise back to caller
|
# revert sys.modules back to normal and raise back to caller
|
||||||
sys.modules.update(modules)
|
sys.modules.update(modules)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user