File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ def load_key(bot):
1717def books (text ):
1818 """books <query> -- Searches Google Books for <query>."""
1919 if not dev_key :
20- return "No Google API key."
20+ return "This command requires a Google API key."
2121
2222 json = requests .get (book_search_api , params = {"q" : text , "key" : dev_key }).json ()
2323
Original file line number Diff line number Diff line change @@ -78,6 +78,9 @@ def youtube_url(match, bot):
7878@hook .command ("youtube" , "you" , "yt" , "y" )
7979def youtube (text ):
8080 """youtube <query> -- Returns the first YouTube search result for <query>."""
81+ if not dev_key :
82+ return "This command requires a Google API key."
83+
8184 json = requests .get (search_api_url , params = {"q" : text , "key" : dev_key }).json ()
8285
8386 if 'error' in json :
@@ -94,6 +97,9 @@ def youtube(text):
9497@hook .command ("youtime" , "ytime" )
9598def youtime (text ):
9699 """youtime <query> -- Gets the total run time of the first YouTube search result for <query>."""
100+ if not dev_key :
101+ return "This command requires a Google API key."
102+
97103 json = requests .get (search_api_url , params = {"q" : text , "key" : dev_key }).json ()
98104
99105 if 'error' in json :
You can’t perform that action at this time.
0 commit comments