2010-04-23 03:47:41 +00:00
|
|
|
from util import hook, http
|
2010-03-15 08:31:19 +00:00
|
|
|
|
2010-03-14 08:01:34 +00:00
|
|
|
|
2010-03-14 07:21:42 +00:00
|
|
|
@hook.command
|
|
|
|
def bam(inp):
|
2011-02-28 16:24:57 +00:00
|
|
|
".bam [basic|magic|heart|krugr] <message> -- creates a big ass message"
|
2011-04-14 01:45:07 +00:00
|
|
|
|
2010-03-15 08:31:19 +00:00
|
|
|
host = 'http://bigassmessage.com/'
|
2011-02-22 19:23:13 +00:00
|
|
|
path = 'BAM.php?'
|
|
|
|
params = {'action': 'SAVE', 'theStyle': 'basic', 'theMessage': inp}
|
2011-04-14 01:45:07 +00:00
|
|
|
|
2010-03-15 08:31:19 +00:00
|
|
|
if ' ' in inp:
|
|
|
|
style, message = inp.split(None, 1)
|
2011-02-22 19:23:13 +00:00
|
|
|
if style in ['basic', 'magic', 'heart', 'krugr']:
|
2010-03-14 08:55:48 +00:00
|
|
|
params['theStyle'] = style
|
2010-03-15 08:31:19 +00:00
|
|
|
params['theMessage'] = message
|
2011-04-14 01:45:07 +00:00
|
|
|
|
2010-04-23 03:47:41 +00:00
|
|
|
response = http.get_xml(host + path, params)
|
2010-03-15 08:31:19 +00:00
|
|
|
status = response.xpath('//status/text()')[0]
|
2011-04-14 01:45:07 +00:00
|
|
|
|
2010-03-15 08:31:19 +00:00
|
|
|
if status == 'ok':
|
|
|
|
return host + response.xpath('//msgid/text()')[0]
|
|
|
|
else:
|
|
|
|
return response.xpath('//message/text()')[0]
|