From 0c637d071c17b1e1ac8026615481d81a9f8d6644 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Thu, 16 Aug 2012 17:15:27 -0400 Subject: [PATCH] Remove "irc:quit" from command/task-to-notify list; nicer watcher. --- earwigbot/bot.py | 5 +++-- earwigbot/irc/watcher.py | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/earwigbot/bot.py b/earwigbot/bot.py index 56042a3..4807187 100644 --- a/earwigbot/bot.py +++ b/earwigbot/bot.py @@ -150,9 +150,10 @@ class Bot(object): advance warning of their forced shutdown. """ tasks = [] - non_tasks = self.config.components.keys() + ["MainThread", "reminder"] + component_names = self.config.components.keys() + skips = component_names + ["MainThread", "reminder", "irc:quit"] for thread in enumerate_threads(): - if thread.name not in non_tasks and thread.is_alive(): + if thread.name not in skips and thread.is_alive(): tasks.append(thread.name) if tasks: log = "The following commands or tasks will be killed: {0}" diff --git a/earwigbot/irc/watcher.py b/earwigbot/irc/watcher.py index f000781..22d15eb 100644 --- a/earwigbot/irc/watcher.py +++ b/earwigbot/irc/watcher.py @@ -121,5 +121,9 @@ class Watcher(IRCConnection): frontend = self.bot.frontend if chans and frontend and not frontend.is_stopped(): pretty = rc.prettify() + if len(pretty) > 400: + msg = pretty[:397] + "..." + else: + msg = pretty[:400] for chan in chans: - frontend.say(chan, pretty[:400]) + frontend.say(chan, msg)