Skip to content

Commit 43974ce

Browse files
committed
slowly refactoring to allow for clean testing
1 parent 50a1dfd commit 43974ce

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spotify_bot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ def search(query, query_type, auth_token):
8282
else :
8383
return content_data[query_type + 's']['items'][0]['external_urls']['spotify']
8484

85+
def is_empty_query(query):
86+
return True if query == '' else False
87+
8588
# main function to handle all inline queries
8689
def inlinequery(bot, update):
8790

@@ -93,7 +96,7 @@ def inlinequery(bot, update):
9396
auth_token = get_auth_token()
9497

9598
# if empty query, return blank results to prevent unnecessary Spotify API calls
96-
if query == '':
99+
if is_empty_query(query):
97100
return results
98101
else:
99102
# each new value will show up in the response to the user

0 commit comments

Comments
 (0)