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,15 +48,18 @@ class Module(ModuleManager.BaseModule):
|
||||||
get_params=get_params, json=True)
|
get_params=get_params, json=True)
|
||||||
|
|
||||||
if page:
|
if page:
|
||||||
page = page.data[0] if has_query else page
|
if len(page.data):
|
||||||
title = page["title"]
|
page = page.data[0] if has_query else page
|
||||||
user = page["user"]["username"]
|
title = page["title"]
|
||||||
duration = time.strftime("%H:%M:%S", time.gmtime(page[
|
user = page["user"]["username"]
|
||||||
"duration"]/1000))
|
duration = time.strftime("%H:%M:%S", time.gmtime(page[
|
||||||
if duration.startswith("00:"):
|
"duration"]/1000))
|
||||||
duration = duration[3:]
|
if duration.startswith("00:"):
|
||||||
link = page["permalink_url"]
|
duration = duration[3:]
|
||||||
event["stdout"].write("%s [%s] (posted by %s) %s" % (title,
|
link = page["permalink_url"]
|
||||||
duration, user, link))
|
event["stdout"].write("%s [%s] (posted by %s) %s" % (title,
|
||||||
|
duration, user, link))
|
||||||
|
else:
|
||||||
|
event["stderr"].write("No results found")
|
||||||
else:
|
else:
|
||||||
raise utils.EventsResultsError()
|
raise utils.EventsResultsError()
|
||||||
|
|
Loading…
Reference in a new issue