async def reload_all_extension(self, _ctx: commands.Context): """Command handler for the `bot cog reload` subcommand `all`. Reloads all the extension (Cogs) from the bot. If changes to the code inside a Cog have been made, this is going to apply them without taking the bot offline. Args: _ctx (discord.ext.commands.Context): The context from which this command is invoked. """ for cog_name, path in constants.INITIAL_EXTNS.items(): self.bot.reload_extension(path) log.warning("%s has been reloaded.", cog_name) await self.ch_bot.send( ":arrows_counterclockwise: All cogs have been successfully reloaded." )
async def unload_extension(self, _ctx: commands.Context, extn_name: str): """Command handler for the `bot cog` subcommand `unload`. Removes an extension (Cog) with the specified name from the bot. Args: _ctx (discord.ext.commands.Context): The context from which this command is invoked. extn_name (str): The name of the extension (Cog). """ extn_name = _get_cog_name(extn_name) self.bot.unload_extension(constants.INITIAL_EXTNS[extn_name]) log.warning("%s has been unloaded.", extn_name) await self.ch_bot.send( f":arrow_heading_up: `{extn_name}` has been successfully unloaded." )
async def reload_extension(self, _ctx: commands.Context, extn_name: str): """Command handler for the `bot cog` subcommand `reload`. Reloads an extension (Cog) with the specified name from the bot. If changes to the code inside a Cog have been made, this is going to apply them without taking the bot offline. Args: _ctx (discord.ext.commands.Context): The context from which this command is invoked. extn_name (str): The name of the extension (Cog). """ extn_name = _get_cog_name(extn_name) self.bot.reload_extension(constants.INITIAL_EXTNS[extn_name]) log.warning("%s has been reloaded.", extn_name) await self.ch_bot.send( f":arrows_counterclockwise: `{extn_name}` has been successfully reloaded." )