From 90923ac4047b84cd61d882410ecdb78adbe0c1da Mon Sep 17 00:00:00 2001 From: epswing Date: Sun, 14 Mar 2010 03:21:42 -0400 Subject: [PATCH] first installment of the big ass message creator --- plugins/bigassmessage.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 plugins/bigassmessage.py diff --git a/plugins/bigassmessage.py b/plugins/bigassmessage.py new file mode 100644 index 0000000..8e324b7 --- /dev/null +++ b/plugins/bigassmessage.py @@ -0,0 +1,25 @@ +from util import hook +from lxml import etree +import urllib2 + +host = 'http://bigassmessage.com' + +@hook.command +def bam(inp): + + if not inp: + return 'you forgot something' + + inp = inp.strip().replace(' ', '+') + path = '/dsx_BAM/boe.php?action=saveMsg&theStyle=magic&theMessage=' + inp + url = host + path + + try: + response = etree.parse(urllib2.urlopen(url)) + status = response.xpath('//status/text()')[0] + if (status == 'ok'): + return host + '/' + response.xpath('//msgid/text()')[0] + else: + return response.xpath('//message/text()')[0] + except: + pass