giphy: Make config_info an instance variable.

There was no reason to use a `global` here.
This commit is contained in:
Steve Howell 2017-11-27 12:08:23 -08:00 committed by showell
parent 50b5ec0f49
commit ef30261858

View file

@ -28,11 +28,14 @@ class GiphyHandler(object):
''' '''
def initialize(self, bot_handler): def initialize(self, bot_handler):
global config_info self.config_info = bot_handler.get_config_info('giphy')
config_info = bot_handler.get_config_info('giphy')
def handle_message(self, message, bot_handler): def handle_message(self, message, bot_handler):
bot_response = get_bot_giphy_response(message, bot_handler) bot_response = get_bot_giphy_response(
message,
bot_handler,
self.config_info
)
bot_handler.send_reply(message, bot_response) bot_handler.send_reply(message, bot_response)
@ -64,7 +67,7 @@ def get_url_gif_giphy(keyword, api_key):
return gif_url return gif_url
def get_bot_giphy_response(message, bot_handler): def get_bot_giphy_response(message, bot_handler, config_info):
# Each exception has a specific reply should "gif_url" return a number. # Each exception has a specific reply should "gif_url" return a number.
# The bot will post the appropriate message for the error. # The bot will post the appropriate message for the error.
keyword = message['content'] keyword = message['content']