summaryrefslogtreecommitdiff
path: root/figlet.py
diff options
context:
space:
mode:
authorBrian Sherson <caretaker82@euclid.shersonb.net>2013-04-30 19:16:41 -0700
committerBrian Sherson <caretaker82@euclid.shersonb.net>2013-04-30 19:16:41 -0700
commitad52f837364cbe239ee55c5f5d69b8adb048d551 (patch)
tree40226974d78c847f8e2ab5dd8eb2fee307a616fd /figlet.py
First Commit\!
Diffstat (limited to 'figlet.py')
-rw-r--r--figlet.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/figlet.py b/figlet.py
new file mode 100644
index 0000000..8f88416
--- /dev/null
+++ b/figlet.py
@@ -0,0 +1,20 @@
+#!/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()