From 248b220d9b2cc6cfb5090268b86a5398096673a6 Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Thu, 31 Oct 2013 10:44:27 -0700 Subject: [PATCH] somethingawful: use api_key hook instead of bot.config --- plugins/somethingawful.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/somethingawful.py b/plugins/somethingawful.py index 7857f05..4d638d9 100644 --- a/plugins/somethingawful.py +++ b/plugins/somethingawful.py @@ -19,13 +19,13 @@ def login(user, password): post_data="action=login&username=%s&password=%s" % (user, password)) +@hook.api_key('somethingawful') @hook.regex(thread_re) -def forum_link(inp, bot=None): - if 'sa_user' not in bot.config or \ - 'sa_password' not in bot.config: +def forum_link(inp, api_key=None): + if api_key is None or 'user' not in api_key or 'password' not in api_key: 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', cookies=True)