h/plugins/bigassmessage.py

25 lines
717 B
Python
Raw Normal View History

from util import hook, http
@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
host = 'http://bigassmessage.com/'
path = 'BAM.php?'
params = {'action': 'SAVE', 'theStyle': 'basic', 'theMessage': inp}
2011-04-14 01:45:07 +00:00
if ' ' in inp:
style, message = inp.split(None, 1)
if style in ['basic', 'magic', 'heart', 'krugr']:
params['theStyle'] = style
params['theMessage'] = message
2011-04-14 01:45:07 +00:00
response = http.get_xml(host + path, params)
status = response.xpath('//status/text()')[0]
2011-04-14 01:45:07 +00:00
if status == 'ok':
return host + response.xpath('//msgid/text()')[0]
else:
return response.xpath('//message/text()')[0]