mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
[commands] Return removed cog in Bot.remove_cog
The method now returns the removed cog, if it exists.
This commit is contained in:
parent
529fad6fec
commit
c4ee9dcafa
@ -548,7 +548,7 @@ class BotBase(GroupMixin):
|
||||
return self.__cogs.get(name)
|
||||
|
||||
def remove_cog(self, name):
|
||||
"""Removes a cog from the bot.
|
||||
"""Removes a cog from the bot and returns it.
|
||||
|
||||
All registered commands and event listeners that the
|
||||
cog has registered will be removed as well.
|
||||
@ -559,6 +559,11 @@ class BotBase(GroupMixin):
|
||||
-----------
|
||||
name: :class:`str`
|
||||
The name of the cog to remove.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Optional[:class:`.Cog`]
|
||||
The cog that was removed. ``None`` if not found.
|
||||
"""
|
||||
|
||||
cog = self.__cogs.pop(name, None)
|
||||
@ -570,6 +575,8 @@ class BotBase(GroupMixin):
|
||||
help_command.cog = None
|
||||
cog._eject(self)
|
||||
|
||||
return cog
|
||||
|
||||
@property
|
||||
def cogs(self):
|
||||
"""Mapping[:class:`str`, :class:`Cog`]: A read-only mapping of cog name to cog."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user