From 535e4efab61c02f5e03464563968eed351f76c0d Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 6 Apr 2012 15:55:39 -0400 Subject: [PATCH] Update references to CommandManager and TaskManager --- earwigbot/commands/afc_report.py | 5 ++--- earwigbot/commands/help.py | 4 ++-- earwigbot/commands/threads.py | 7 +++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/earwigbot/commands/afc_report.py b/earwigbot/commands/afc_report.py index c6a5840..75c2f64 100644 --- a/earwigbot/commands/afc_report.py +++ b/earwigbot/commands/afc_report.py @@ -24,7 +24,6 @@ import re from earwigbot import wiki from earwigbot.commands import BaseCommand -from earwigbot.tasks import task_manager class Command(BaseCommand): """Get information about an AFC submission by name.""" @@ -36,9 +35,9 @@ class Command(BaseCommand): self.data = data try: - self.statistics = task_manager.get("afc_statistics") + self.statistics = self.bot.tasks.get("afc_statistics") except KeyError: - e = "Cannot run command: requires afc_statistics task." + e = "Cannot run command: requires afc_statistics task (from earwigbot_plugins)." self.logger.error(e) return diff --git a/earwigbot/commands/help.py b/earwigbot/commands/help.py index 5a6f9dd..bca6ee2 100644 --- a/earwigbot/commands/help.py +++ b/earwigbot/commands/help.py @@ -22,7 +22,7 @@ import re -from earwigbot.commands import BaseCommand, command_manager +from earwigbot.commands import BaseCommand from earwigbot.irc import Data class Command(BaseCommand): @@ -30,7 +30,7 @@ class Command(BaseCommand): name = "help" def process(self, data): - self.cmnds = command_manager.get_all() + self.cmnds = self.bot.commands.get_all() if not data.args: self.do_main_help(data) else: diff --git a/earwigbot/commands/threads.py b/earwigbot/commands/threads.py index 976eb71..13d0a70 100644 --- a/earwigbot/commands/threads.py +++ b/earwigbot/commands/threads.py @@ -25,7 +25,6 @@ import re from earwigbot.commands import BaseCommand from earwigbot.irc import KwargParseException -from earwigbot.tasks import task_manager class Command(BaseCommand): """Manage wiki tasks from IRC, and check on thread status.""" @@ -104,7 +103,7 @@ class Command(BaseCommand): def do_listall(self): """With !tasks listall or !tasks all, list all loaded tasks, and report whether they are currently running or idle.""" - all_tasks = task_manager.get_all().keys() + all_tasks = self.bot.tasks.get_all().keys() threads = threading.enumerate() tasklist = [] @@ -145,13 +144,13 @@ class Command(BaseCommand): self.connection.reply(data, msg) return - if task_name not in task_manager.get_all().keys(): + if task_name not in self.bot.tasks.get_all().keys(): # This task does not exist or hasn't been loaded: msg = "task could not be found; either tasks/{0}.py doesn't exist, or it wasn't loaded correctly." self.connection.reply(data, msg.format(task_name)) return data.kwargs["fromIRC"] = True - task_manager.start(task_name, **data.kwargs) + self.bot.tasks.start(task_name, **data.kwargs) msg = "task \x0302{0}\x0301 started.".format(task_name) self.connection.reply(data, msg)