Преглед на файлове

Update references to CommandManager and TaskManager

tags/v0.1^2
Ben Kurtovic преди 12 години
родител
ревизия
535e4efab6
променени са 3 файла, в които са добавени 7 реда и са изтрити 9 реда
  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 Целия файл

@@ -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



+ 2
- 2
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:


+ 3
- 4
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)

Зареждане…
Отказ
Запис