From 079b424eca6be7bf7c4eb2eb286f1907ce783b2c Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 6 Apr 2012 14:46:11 -0400 Subject: [PATCH] Fixing up !restart and !reload a bit --- earwigbot/commands/__init__.py | 2 +- earwigbot/commands/restart.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/earwigbot/commands/__init__.py b/earwigbot/commands/__init__.py index da152cb..e97d2b9 100644 --- a/earwigbot/commands/__init__.py +++ b/earwigbot/commands/__init__.py @@ -126,8 +126,8 @@ class CommandManager(object): def load(self): """Load (or reload) all valid commands into self._commands.""" - self._commands = {} with self._command_access_lock: + self._commands.clear() dirs = [path.join(path.dirname(__file__), "commands"), path.join(bot.config.root_dir, "commands")] for dir in dirs: diff --git a/earwigbot/commands/restart.py b/earwigbot/commands/restart.py index 4902551..7456e4b 100644 --- a/earwigbot/commands/restart.py +++ b/earwigbot/commands/restart.py @@ -38,9 +38,10 @@ class Command(BaseCommand): return if data.command == "restart": - self.connection.logger.info("Restarting bot per owner request") - self.connection.bot.restart() + self.logger.info("Restarting bot per owner request") + self.bot.restart() elif data.command == "reload": - self.connection.bot.commands.load() - self.connection.logger.info("IRC commands reloaded") + self.logger.info("Reloading IRC commands") + self.bot.commands.load() + self.connection.reply("IRC commands reloaded.")