Example #1
0
 def reload(self, path):
     """
     Loads or reloads a module, given its file path. Thread safe.
     """
     path = Path(path).resolve()
     if path.exists():
         async_util.run_coroutine_threadsafe(self._reload(path),
                                             self.bot.loop)
Example #2
0
    def exit_gracefully(signum, frame):
        nonlocal stopped_while_restarting
        if not _bot:
            # we are currently in the process of restarting
            stopped_while_restarting = True
        else:
            async_util.run_coroutine_threadsafe(_bot.stop("Killed (Received SIGINT {})".format(signum)), _bot.loop)

        logger.warning("Bot received Signal Interrupt ({})".format(signum))

        # restore the original handler so if they do it again it triggers
        signal.signal(signal.SIGINT, original_sigint)
Example #3
0
 def unload(self, path):
     """
     Unloads a module, given its file path. Thread safe.
     """
     path = Path(path).resolve()
     async_util.run_coroutine_threadsafe(self._unload(path), self.bot.loop)