From d4e74f4d3b1d407b39b7ef80182dca0b1f98c525 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Wed, 8 Oct 2008 10:14:08 -0600 Subject: [PATCH] New way to do units --- firebot.py | 2 +- gallium.py | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/firebot.py b/firebot.py index 0e0aae0..374c56e 100755 --- a/firebot.py +++ b/firebot.py @@ -245,7 +245,7 @@ class FireBot(infobot.InfoBot, procbot.ProcBot): f = '1 ' + f[2:] Runner('/usr/bin/units -v %s %s' % (esc(f), esc(t)), lambda l,r: self.proc_cb(None, sender, forum, l, r)) - bindings.append((re.compile(r"^units +(?P.*) +in +(?P.*)$"), + bindings.append((re.compile(r"^(?P.*) +-> +(?P.*)$"), units)) bindings.append((re.compile(r"^how many (?P.*) in (?P[^?]*)[?.!]*$"), units)) diff --git a/gallium.py b/gallium.py index 0250f16..079d863 100755 --- a/gallium.py +++ b/gallium.py @@ -36,7 +36,10 @@ class Gallium(firebot.FireBot, ProcBot): def server_status(self, sender, forum, addl, match): loadavg = file('/proc/loadavg').read().strip() - io_status = file('/proc/io_status').read().strip() + try: + io_status = file('/proc/io_status').read().strip() + except IOError: + io_status = "xen is awesome" forum.msg('%s; load %s' % (io_status, loadavg)) bindings.append((re.compile(r"^\008[:, ]+server status"), server_status)) @@ -149,11 +152,13 @@ if __name__ == '__main__': gallium.debug = debug # fink - fink = Wiibot(('irc.oftc.net', 6667), - ['fink'], - "Do you like my hat?", - ["#fast-food"], - dbname='fink.cdb') - fink.debug = debug + if False: + fink = Gallium(('irc.oftc.net', 6667), + ['fink'], + "Do you like my hat?", + ["#fast-food"], + dbname='fink.cdb') + fink.debug = debug + fink.chatty = False irc.run_forever(0.5)