giphy: Make config_info an instance variable.
There was no reason to use a `global` here.
This commit is contained in:
		
							parent
							
								
									50b5ec0f49
								
							
						
					
					
						commit
						ef30261858
					
				
					 1 changed files with 7 additions and 4 deletions
				
			
		|  | @ -28,11 +28,14 @@ class GiphyHandler(object): | |||
|             ''' | ||||
| 
 | ||||
|     def initialize(self, bot_handler): | ||||
|         global config_info | ||||
|         config_info = bot_handler.get_config_info('giphy') | ||||
|         self.config_info = bot_handler.get_config_info('giphy') | ||||
| 
 | ||||
|     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) | ||||
| 
 | ||||
| 
 | ||||
|  | @ -64,7 +67,7 @@ def get_url_gif_giphy(keyword, api_key): | |||
|     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. | ||||
|     # The bot will post the appropriate message for the error. | ||||
|     keyword = message['content'] | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Steve Howell
						Steve Howell