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:]
|
f = '1 ' + f[2:]
|
||||||
Runner('/usr/bin/units -v %s %s' % (esc(f), esc(t)),
|
Runner('/usr/bin/units -v %s %s' % (esc(f), esc(t)),
|
||||||
lambda l,r: self.proc_cb(None, sender, forum, l, r))
|
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))
|
units))
|
||||||
bindings.append((re.compile(r"^how many (?P<to>.*) in (?P<from>[^?]*)[?.!]*$"),
|
bindings.append((re.compile(r"^how many (?P<to>.*) in (?P<from>[^?]*)[?.!]*$"),
|
||||||
units))
|
units))
|
||||||
|
|
|
@ -36,7 +36,10 @@ class Gallium(firebot.FireBot, ProcBot):
|
||||||
|
|
||||||
def server_status(self, sender, forum, addl, match):
|
def server_status(self, sender, forum, addl, match):
|
||||||
loadavg = file('/proc/loadavg').read().strip()
|
loadavg = file('/proc/loadavg').read().strip()
|
||||||
|
try:
|
||||||
io_status = file('/proc/io_status').read().strip()
|
io_status = file('/proc/io_status').read().strip()
|
||||||
|
except IOError:
|
||||||
|
io_status = "xen is awesome"
|
||||||
forum.msg('%s; load %s' % (io_status, loadavg))
|
forum.msg('%s; load %s' % (io_status, loadavg))
|
||||||
bindings.append((re.compile(r"^\008[:, ]+server status"),
|
bindings.append((re.compile(r"^\008[:, ]+server status"),
|
||||||
server_status))
|
server_status))
|
||||||
|
@ -149,11 +152,13 @@ if __name__ == '__main__':
|
||||||
gallium.debug = debug
|
gallium.debug = debug
|
||||||
|
|
||||||
# fink
|
# fink
|
||||||
fink = Wiibot(('irc.oftc.net', 6667),
|
if False:
|
||||||
|
fink = Gallium(('irc.oftc.net', 6667),
|
||||||
['fink'],
|
['fink'],
|
||||||
"Do you like my hat?",
|
"Do you like my hat?",
|
||||||
["#fast-food"],
|
["#fast-food"],
|
||||||
dbname='fink.cdb')
|
dbname='fink.cdb')
|
||||||
fink.debug = debug
|
fink.debug = debug
|
||||||
|
fink.chatty = False
|
||||||
|
|
||||||
irc.run_forever(0.5)
|
irc.run_forever(0.5)
|
||||||
|
|
Loading…
Reference in New Issue