somethingawful: use api_key hook instead of bot.config

This commit is contained in:
Ryan Hitchman 2013-10-31 10:44:27 -07:00
parent 0796167813
commit 248b220d9b
1 changed files with 4 additions and 4 deletions

View File

@ -19,13 +19,13 @@ def login(user, password):
post_data="action=login&username=%s&password=%s" % (user, password)) post_data="action=login&username=%s&password=%s" % (user, password))
@hook.api_key('somethingawful')
@hook.regex(thread_re) @hook.regex(thread_re)
def forum_link(inp, bot=None): def forum_link(inp, api_key=None):
if 'sa_user' not in bot.config or \ if api_key is None or 'user' not in api_key or 'password' not in api_key:
'sa_password' not in bot.config:
return return
login(bot.config['sa_user'], bot.config['sa_password']) login(api_key['user'], api_key['password'])
thread = http.get_html(showthread, threadid=inp.group(1), perpage='1', thread = http.get_html(showthread, threadid=inp.group(1), perpage='1',
cookies=True) cookies=True)