浏览代码

Send a message when an IRC-initiated task completes.

tags/v0.3
Ben Kurtovic 9 年前
父节点
当前提交
f8bb72f9f2
共有 2 个文件被更改,包括 5 次插入0 次删除
  1. +3
    -0
      earwigbot/commands/threads.py
  2. +2
    -0
      earwigbot/managers.py

+ 3
- 0
earwigbot/commands/threads.py 查看文件

@@ -142,6 +142,9 @@ class Threads(Command):
return

data.kwargs["fromIRC"] = True
data.kwargs["_IRCCallback"] = lambda: self.reply(
data, "Task \x0302{0}\x0F finished.".format(task_name))

self.bot.tasks.start(task_name, **data.kwargs)
msg = "Task \x0302{0}\x0F started.".format(task_name)
self.reply(data, msg)

+ 2
- 0
earwigbot/managers.py 查看文件

@@ -247,6 +247,8 @@ class TaskManager(_ResourceManager):
else:
msg = "Task '{0}' finished successfully"
self.logger.info(msg.format(task.name))
if kwargs.get("fromIRC"):
kwargs.get("_IRCCallback")()

def start(self, task_name, **kwargs):
"""Start a given task in a new daemon thread, and return the thread.


正在加载...
取消
保存