diff options
author | Brian Sherson <caretaker82@euclid.shersonb.net> | 2013-08-27 23:47:24 -0700 |
---|---|---|
committer | Brian Sherson <caretaker82@euclid.shersonb.net> | 2013-08-27 23:47:24 -0700 |
commit | 2011bf9bbd042bba4a649f9e52a52c1149ff09c8 (patch) | |
tree | 5e2a4b26105a13a7c4ee383870516bd03d489651 /figlet.py | |
parent | 7a015d666c81f5dd44507b69728e774c15c72f6d (diff) |
Diffstat (limited to 'figlet.py')
-rw-r--r-- | figlet.py | 39 |
1 files changed, 22 insertions, 17 deletions
@@ -1,20 +1,25 @@ #!/usr/bin/python -import re, os +import re +import os + class Figlet(object): - def onRecv(self, IRC, line, data): - if data==None: return - (origin, ident, host, cmd, target, params, extinfo)=data - if len(target) and target[0]=="#" and cmd=="PRIVMSG": - channel=IRC.channel(target) - matches=re.findall("^!figlet\\s+(.*)$",extinfo) - if matches: - gif,fig=os.popen2("figlet") - gif.write(matches[0]) - gif.close() - while True: - line=fig.readline() - if line=="": break - if re.match("^\\s+$", line.rstrip()): continue - channel.msg(line.rstrip()) - fig.close() + def onRecv(self, IRC, line, data): + if data is None: + return + (origin, ident, host, cmd, target, params, extinfo) = data + if len(target) and target[0] == "#" and cmd == "PRIVMSG": + channel = IRC.channel(target) + matches = re.findall("^!figlet\\s+(.*)$", extinfo) + if matches: + gif, fig = os.popen2("figlet") + gif.write(matches[0]) + gif.close() + while True: + line = fig.readline() + if line == "": + break + if re.match("^\\s+$", line.rstrip()): + continue + channel.msg(line.rstrip()) + fig.close() |