Handle !soundcloud returning no results (soundcloud.py)
This commit is contained in:
parent
38b7a1dadf
commit
93336efd38
1 changed files with 13 additions and 10 deletions
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue