Add list type check

This commit is contained in:
SBNovaScript
2023-04-15 16:39:26 -04:00
committed by Pi
parent f02b6832e2
commit 13602b4a63

View File

@@ -128,7 +128,13 @@ def execute_command(command_name: str, arguments):
return google_result
else:
google_result = google_search(arguments["input"])
safe_message = [google_result_single.encode('utf-8', 'ignore') for google_result_single in google_result]
# google_result can be a list or a string depending on the search results
if isinstance(google_result, list):
safe_message = [google_result_single.encode('utf-8', 'ignore') for google_result_single in google_result]
else:
safe_message = google_result.encode('utf-8', 'ignore')
return str(safe_message)
elif command_name == "memory_add":
return memory.add(arguments["string"])