From 36204229b979d8c2a83c41e87c99038ac3cb849a Mon Sep 17 00:00:00 2001 From: Julian Marcos Date: Sun, 24 Oct 2021 06:45:05 +0000 Subject: [PATCH] ~radio: Cleanup, but still needs more --- plugins/tilderadio.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/tilderadio.py b/plugins/tilderadio.py index 40ad27a..b7d1208 100644 --- a/plugins/tilderadio.py +++ b/plugins/tilderadio.py @@ -99,11 +99,11 @@ def on_load(): @p.command("&np", help_text="Show the current song on tilderadio") def nowplaying(event): save_nowplaying("") - event["stdout"].write(format_nowplaying()) + return p.message(format_nowplaying()); # &schedule [Show a link to the tilderadio schedule] def schedule(event): - event["stdout"].write(f"You can find the schedule here: {SCHEDULE_URL}") + return p.message(f"You can find the schedule here: {SCHEDULE_URL}") # &un [Show who's up next to stream (schedule)] @@ -113,14 +113,14 @@ def upnext(event): AZURACAST_API_BASE + "/station/1/schedule" ).json() if len(js) < 1: - event["stdout"].write("nothing scheduled") + return p.message("Nothing scheduled") else: data = js[0] - print(data["start"]); + #print(data["start"]); start = iso8601(data["start"]) now = utcnow() total_secs = (start - now).total_seconds() - event["stdout"].write( + return p.message( "{} is up next at {} UTC in {}!".format( data["name"], datetime_human(start), @@ -134,13 +134,13 @@ def upnextnext(event): AZURACAST_API_BASE + "/station/1/schedule" ).json() if len(js) < 1: - event["stdout"].write("nothing scheduled") + return p.message("Nothing scheduled") else: data = js[1] start = iso8601(data["start"]) now = utils.datetime.utcnow() total_secs = (start - now).total_seconds() - event["stdout"].write( + return p.message( "{} is up next next at {} UTC in {}!".format( data["name"], datetime_human(start), @@ -160,7 +160,7 @@ def showdj(event): message += " (for {})".format( to_pretty_time(total_seconds) ) - event["stdout"].write(message) + return p.message(message) # Funtions for this to work