Browse Source

Update references to CommandManager and TaskManager

tags/v0.1^2
Ben Kurtovic 12 years ago
parent
commit
535e4efab6
3 changed files with 7 additions and 9 deletions
  1. +2
    -3
      earwigbot/commands/afc_report.py
  2. +2
    -2
      earwigbot/commands/help.py
  3. +3
    -4
      earwigbot/commands/threads.py

+ 2
- 3
earwigbot/commands/afc_report.py View File

@@ -24,7 +24,6 @@ import re


from earwigbot import wiki from earwigbot import wiki
from earwigbot.commands import BaseCommand from earwigbot.commands import BaseCommand
from earwigbot.tasks import task_manager


class Command(BaseCommand): class Command(BaseCommand):
"""Get information about an AFC submission by name.""" """Get information about an AFC submission by name."""
@@ -36,9 +35,9 @@ class Command(BaseCommand):
self.data = data self.data = data


try: try:
self.statistics = task_manager.get("afc_statistics")
self.statistics = self.bot.tasks.get("afc_statistics")
except KeyError: 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) self.logger.error(e)
return return




+ 2
- 2
earwigbot/commands/help.py View File

@@ -22,7 +22,7 @@


import re import re


from earwigbot.commands import BaseCommand, command_manager
from earwigbot.commands import BaseCommand
from earwigbot.irc import Data from earwigbot.irc import Data


class Command(BaseCommand): class Command(BaseCommand):
@@ -30,7 +30,7 @@ class Command(BaseCommand):
name = "help" name = "help"


def process(self, data): def process(self, data):
self.cmnds = command_manager.get_all()
self.cmnds = self.bot.commands.get_all()
if not data.args: if not data.args:
self.do_main_help(data) self.do_main_help(data)
else: else:


+ 3
- 4
earwigbot/commands/threads.py View File

@@ -25,7 +25,6 @@ import re


from earwigbot.commands import BaseCommand from earwigbot.commands import BaseCommand
from earwigbot.irc import KwargParseException from earwigbot.irc import KwargParseException
from earwigbot.tasks import task_manager


class Command(BaseCommand): class Command(BaseCommand):
"""Manage wiki tasks from IRC, and check on thread status.""" """Manage wiki tasks from IRC, and check on thread status."""
@@ -104,7 +103,7 @@ class Command(BaseCommand):
def do_listall(self): def do_listall(self):
"""With !tasks listall or !tasks all, list all loaded tasks, and report """With !tasks listall or !tasks all, list all loaded tasks, and report
whether they are currently running or idle.""" 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() threads = threading.enumerate()
tasklist = [] tasklist = []


@@ -145,13 +144,13 @@ class Command(BaseCommand):
self.connection.reply(data, msg) self.connection.reply(data, msg)
return 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: # 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." 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)) self.connection.reply(data, msg.format(task_name))
return return


data.kwargs["fromIRC"] = True 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) msg = "task \x0302{0}\x0301 started.".format(task_name)
self.connection.reply(data, msg) self.connection.reply(data, msg)

Loading…
Cancel
Save