From 26e9b5bfac840c95744bbdd0ab356842e9efa72f Mon Sep 17 00:00:00 2001 From: Rapptz Date: Tue, 19 Mar 2019 06:21:39 -0400 Subject: [commands] Add Bot.reload_extension for atomic loading. Also do atomic loading in Bot.load_extension --- docs/ext/commands/extensions.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'docs/ext/commands') diff --git a/docs/ext/commands/extensions.rst b/docs/ext/commands/extensions.rst index 91fbb24a..10e33e45 100644 --- a/docs/ext/commands/extensions.rst +++ b/docs/ext/commands/extensions.rst @@ -41,14 +41,13 @@ In this example we define a simple command, and when the extension is loaded thi Reloading ----------- -The act of reloading an extension is actually quite simple -- it is as simple as unloading it and then reloading it. +When you make a change to the extension and want to reload the references, the library comes with a function to do this for you, :meth:`Bot.reload_extension`. .. code-block:: python3 - >>> bot.unload_extension('hello') - >>> bot.load_extension('hello') + >>> bot.reload_extension('hello') -Once we remove and load the extension, any changes that we did will be applied upon load. This is useful if we want to add or remove functionality without restarting our bot. +Once the extension reloads, any changes that we did will be applied. This is useful if we want to add or remove functionality without restarting our bot. If an error occurred during the reloading process, the bot will pretend as if the reload never happened. Cleaning Up ------------- -- cgit v1.2.3