summaryrefslogtreecommitdiff
path: root/figlet.py
diff options
context:
space:
mode:
authorBrian Sherson <caretaker82@euclid.shersonb.net>2013-08-27 20:41:00 -0700
committerBrian Sherson <caretaker82@euclid.shersonb.net>2013-08-27 20:41:00 -0700
commitf62fee63579ed5bdc1481a118720a1357dad9bee (patch)
tree962a5b57898f7d6a1bdedaaf4197f1e7236b9561 /figlet.py
parent25ed9b71564b73b07d664e2396c641ffe74f45b1 (diff)
Diffstat (limited to 'figlet.py')
-rw-r--r--[l---------]figlet.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/figlet.py b/figlet.py
index 7d63417..8f88416 120000..100644
--- a/figlet.py
+++ b/figlet.py
@@ -1 +1,20 @@
-../figlet.py \ No newline at end of file
+#!/usr/bin/python
+import re, 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()