Handle !soundcloud returning no results (soundcloud.py)

This commit is contained in:
jesopo 2019-01-08 10:14:03 +00:00
parent 38b7a1dadf
commit 93336efd38

View file

@ -48,6 +48,7 @@ class Module(ModuleManager.BaseModule):
get_params=get_params, json=True) get_params=get_params, json=True)
if page: if page:
if len(page.data):
page = page.data[0] if has_query else page page = page.data[0] if has_query else page
title = page["title"] title = page["title"]
user = page["user"]["username"] user = page["user"]["username"]
@ -58,5 +59,7 @@ class Module(ModuleManager.BaseModule):
link = page["permalink_url"] link = page["permalink_url"]
event["stdout"].write("%s [%s] (posted by %s) %s" % (title, event["stdout"].write("%s [%s] (posted by %s) %s" % (title,
duration, user, link)) duration, user, link))
else:
event["stderr"].write("No results found")
else: else:
raise utils.EventsResultsError() raise utils.EventsResultsError()