2009-03-16 18:33:59 +00:00
|
|
|
"""
|
|
|
|
iambuttbot.py: avidal 2009
|
|
|
|
posts everything buttbot says to the iambuttbot twitter account
|
|
|
|
"""
|
|
|
|
|
|
|
|
import urllib
|
|
|
|
import hook
|
|
|
|
|
|
|
|
@hook.command(hook=r'(.*)')
|
2009-03-16 18:42:00 +00:00
|
|
|
def iambuttbot(bot, input):
|
2009-03-16 18:33:59 +00:00
|
|
|
if input.nick.lower() != 'buttbot': return
|
|
|
|
|
2009-03-16 18:42:00 +00:00
|
|
|
buttbot_pass = open('iambuttbot_passwd').readlines()[0].strip()
|
2009-03-16 18:33:59 +00:00
|
|
|
status = input.inp if len(input.inp) <= 140 else input.inp[:137] + "..."
|
|
|
|
data = urllib.urlencode({"status": status})
|
2009-03-16 18:42:00 +00:00
|
|
|
response = urllib.urlopen("http://iambuttbot:%s@twitter.com/statuses/update.xml" % (buttbot_pass,), data)
|