fixing hook, iambuttbot
This commit is contained in:
parent
5213276d6f
commit
4b749762cd
|
@ -1,3 +1,4 @@
|
||||||
syntax: glob
|
syntax: glob
|
||||||
.*.swp
|
.*.swp
|
||||||
*.pyc
|
*.pyc
|
||||||
|
iambuttbot_password
|
||||||
|
|
|
@ -18,7 +18,7 @@ def sieve(func):
|
||||||
_hook_add(func, ['sieve', (_make_sig(func), func)])
|
_hook_add(func, ['sieve', (_make_sig(func), func)])
|
||||||
return func
|
return func
|
||||||
|
|
||||||
def command(func, hook=None, **kwargs):
|
def command(func=None, hook=None, **kwargs):
|
||||||
args = {}
|
args = {}
|
||||||
def command_wrapper(func):
|
def command_wrapper(func):
|
||||||
if func.func_code.co_argcount not in (1, 2):
|
if func.func_code.co_argcount not in (1, 2):
|
||||||
|
|
|
@ -6,11 +6,13 @@ posts everything buttbot says to the iambuttbot twitter account
|
||||||
import urllib
|
import urllib
|
||||||
import hook
|
import hook
|
||||||
|
|
||||||
@hook.command(hook=r'(.*)')
|
@hook.command(hook=r'(.*)', prefix=False)
|
||||||
def iambuttbot(bot, input):
|
def iambuttbot(bot, input):
|
||||||
if input.nick.lower() != 'buttbot': return
|
if input.nick.lower() != 'buttbot':
|
||||||
|
return
|
||||||
|
|
||||||
buttbot_pass = open('iambuttbot_passwd').readlines()[0].strip()
|
password = open('iambuttbot_password').readlines()[0].strip()
|
||||||
status = input.inp if len(input.inp) <= 140 else input.inp[:137] + "..."
|
status = input.inp if len(input.inp) <= 140 else input.inp[:137] + "..."
|
||||||
data = urllib.urlencode({"status": status})
|
data = urllib.urlencode({"status": status})
|
||||||
response = urllib.urlopen("http://iambuttbot:%s@twitter.com/statuses/update.xml" % (buttbot_pass,), data)
|
url = 'http://iambuttbot:%s@twitter.com/statuses/update.xml' % password
|
||||||
|
response = urllib.urlopen(url, data)
|
||||||
|
|
Loading…
Reference in New Issue