mirror of https://github.com/nealey/firebot
New way to do units
This commit is contained in:
parent
6ef32e3368
commit
d4e74f4d3b
|
@ -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<from>.*) +in +(?P<to>.*)$"),
|
||||
bindings.append((re.compile(r"^(?P<from>.*) +-> +(?P<to>.*)$"),
|
||||
units))
|
||||
bindings.append((re.compile(r"^how many (?P<to>.*) in (?P<from>[^?]*)[?.!]*$"),
|
||||
units))
|
||||
|
|
|
@ -36,7 +36,10 @@ class Gallium(firebot.FireBot, ProcBot):
|
|||
|
||||
def server_status(self, sender, forum, addl, match):
|
||||
loadavg = file('/proc/loadavg').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),
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue