Skip to content

Commit 6cd85fe

Browse files
committed
added on_start hook for retrieving api_key value
1 parent 9896ef7 commit 6cd85fe

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

plugins/brew.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55
api_url = "http://api.brewerydb.com/v2/search?format=json"
66

77

8+
@hook.on_start()
9+
def load_key(bot):
10+
global api_key
11+
api_key = bot.config.get("api_keys", {}).get("brewerydb", None)
12+
13+
814
@hook.command('brew')
915
def brew(text, bot):
1016
"""<query> - returns the first brewerydb search result for <query>"""
1117

12-
api_key = bot.config.get("api_keys", {}).get("brewerydb")
1318
if not api_key:
1419
return "No brewerydb API key set."
1520

0 commit comments

Comments
 (0)