From cae3db898174490e36c2b7ecb8adb25bcaad47d0 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Thu, 19 Nov 2020 11:34:30 -0500 Subject: [PATCH 1/6] only announce in #tilderadio --- tilderadio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tilderadio.py b/tilderadio.py index 6e01105..716ae58 100644 --- a/tilderadio.py +++ b/tilderadio.py @@ -9,7 +9,7 @@ from smtplib import SMTP from src import ModuleManager, utils CHANNEL = "#tilderadio" -NOTIFY_CHANNELS = [CHANNEL, "#meta", "#team", "#club"] +NOTIFY_CHANNELS = [CHANNEL] LISTEN_URL = "https://tilderadio.org/listen" SCHEDULE_URL = "https://tilderadio.org/schedule/" SOURCE_URL = "https://tildegit.org/ben/bitbot-modules" From 4e923fd55ebd5c54892813df865293e24945430e Mon Sep 17 00:00:00 2001 From: khuxkm fbexl Date: Wed, 25 Nov 2020 07:35:44 +0000 Subject: [PATCH 2/6] Add DJ topic system --- tilderadio.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tilderadio.py b/tilderadio.py index 6ffb088..5dba115 100644 --- a/tilderadio.py +++ b/tilderadio.py @@ -327,3 +327,31 @@ class Module(ModuleManager.BaseModule): event["stdout"].write( utils.datetime.format.datetime_human(utils.datetime.utcnow()) ) + + @utils.hook("received.command.setdjtopic") + @utils.kwarg("require_mode","v") + @utils.kwarg("help","set your personal DJ topic") + @utils.spec("!string") + def setdjtopic(self, event): + if event["target"].name!="#tilderadio": + event["stderr"].write("setdjtopic command can only be used in #tilderadio") + return + topic = event["spec"][0] + event["user"].set_setting("tilderadio-djtopic",topic) + + @utils.hook("received.command.djtopic") + @utils.kwarg("help","get the DJ topic for the active DJ or for any DJ") + @utils.spec("?user") + def setdjtopic(self, event): + dj = event["spec"][0] + if dj is None: + if event["server"].has_user_id(self.dj): + dj = event["server"].get_user(self.dj) + else: + event["stderr"].write(f"I can't find an account for {self.dj}. Try manually putting in their nickname?") + return + topic = dj.get_setting("tilderadio-djtopic",None) + if topic is None: + event["stderr"].write(f"{dj.nickname} doesn't have a DJ topic set.") + return + event["stdout"].write(f"DJ topic for {dj.nickname}: {topic}") From 429cac16d59990daa99cd935fcccea8b0ee3bf38 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 25 Nov 2020 10:22:56 -0500 Subject: [PATCH 3/6] prevent toot command outside of CHANNEL --- tilderadio.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tilderadio.py b/tilderadio.py index e887368..1b7caab 100644 --- a/tilderadio.py +++ b/tilderadio.py @@ -300,7 +300,7 @@ class Module(ModuleManager.BaseModule): @utils.kwarg("help", "get a random tilderadio slogan") def slogan(self, event): event["stdout"].write(random.choice(SLOGANS)) - + @utils.hook("received.command.paymybills") def paymybills(self, event): event["stdout"].write("whaddya mean?! i'm broker than you!") @@ -311,6 +311,10 @@ class Module(ModuleManager.BaseModule): @utils.spec("!string") def toot(self, event): status = event["spec"][0] + if event["target"].name != CHANNEL: + event["stderr"].write(f"tooting can only be used in {CHANNEL}") + return + if len(status) > 8: nick = event["user"].nickname status = emoji.emojize(status, use_aliases=True) @@ -333,18 +337,19 @@ class Module(ModuleManager.BaseModule): ) @utils.hook("received.command.setdjtopic") - @utils.kwarg("require_mode","v") - @utils.kwarg("help","set your personal DJ topic") + @utils.kwarg("require_mode", "v") + @utils.kwarg("help", "set your personal DJ topic") @utils.spec("!string") def setdjtopic(self, event): - if event["target"].name!="#tilderadio": - event["stderr"].write("setdjtopic command can only be used in #tilderadio") + if event["target"].name != CHANNEL: + event["stderr"].write(f"setdjtopic command can only be used in {CHANNEL}") return + topic = event["spec"][0] - event["user"].set_setting("tilderadio-djtopic",topic) + event["user"].set_setting("tilderadio-djtopic", topic) @utils.hook("received.command.djtopic") - @utils.kwarg("help","get the DJ topic for the active DJ or for any DJ") + @utils.kwarg("help", "get the DJ topic for the active DJ or for any DJ") @utils.spec("?user") def setdjtopic(self, event): dj = event["spec"][0] @@ -352,9 +357,11 @@ class Module(ModuleManager.BaseModule): if event["server"].has_user_id(self.dj): dj = event["server"].get_user(self.dj) else: - event["stderr"].write(f"I can't find an account for {self.dj}. Try manually putting in their nickname?") + event["stderr"].write( + f"I can't find an account for {self.dj}. Try manually putting in their nickname?" + ) return - topic = dj.get_setting("tilderadio-djtopic",None) + topic = dj.get_setting("tilderadio-djtopic", None) if topic is None: event["stderr"].write(f"{dj.nickname} doesn't have a DJ topic set.") return From 11c2b8e5b5f0f8ba59d1df37104eb4c80f8b284f Mon Sep 17 00:00:00 2001 From: khuxkm fbexl Date: Thu, 26 Nov 2020 06:45:49 +0000 Subject: [PATCH 4/6] I fucked up and this is entirely on me --- tilderadio.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tilderadio.py b/tilderadio.py index 1b7caab..9e6ea0c 100644 --- a/tilderadio.py +++ b/tilderadio.py @@ -351,9 +351,12 @@ class Module(ModuleManager.BaseModule): @utils.hook("received.command.djtopic") @utils.kwarg("help", "get the DJ topic for the active DJ or for any DJ") @utils.spec("?user") - def setdjtopic(self, event): + def djtopic(self, event): dj = event["spec"][0] if dj is None: + if self.dj is "": + event["stderr"].write(f"Nobody is streaming right now.") + return if event["server"].has_user_id(self.dj): dj = event["server"].get_user(self.dj) else: From b746a18758778486b23b13392d2fac20148403e8 Mon Sep 17 00:00:00 2001 From: khuxkm fbexl Date: Thu, 26 Nov 2020 07:46:53 +0000 Subject: [PATCH 5/6] setdjtopic should also have feedback when a topic is set --- tilderadio.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tilderadio.py b/tilderadio.py index 9e6ea0c..0f8da5c 100644 --- a/tilderadio.py +++ b/tilderadio.py @@ -347,6 +347,7 @@ class Module(ModuleManager.BaseModule): topic = event["spec"][0] event["user"].set_setting("tilderadio-djtopic", topic) + event["stdout"].write(f"Set {event['user'].nickname}'s DJ topic to \"{topic}\".") @utils.hook("received.command.djtopic") @utils.kwarg("help", "get the DJ topic for the active DJ or for any DJ") From 79b9478fafe3c22fb37e8520992522f944a96737 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Thu, 25 Feb 2021 15:53:59 -0500 Subject: [PATCH 6/6] add new slogan cf. https://tildegit.org/tilderadio/site/pulls/19 --- tilderadio.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tilderadio.py b/tilderadio.py index 0f8da5c..eb1d14d 100644 --- a/tilderadio.py +++ b/tilderadio.py @@ -49,6 +49,7 @@ SLOGANS = [ "that's not what she said!", "not product placement, we promise! (tildestore.com)", "no longer crashes on russian metadata", + "SYNTH TUBA JAZZ VOMIT", ] EMAIL_TEMPLATE = """ {dj} just came on the air on tilderadio.org! @@ -347,7 +348,9 @@ class Module(ModuleManager.BaseModule): topic = event["spec"][0] event["user"].set_setting("tilderadio-djtopic", topic) - event["stdout"].write(f"Set {event['user'].nickname}'s DJ topic to \"{topic}\".") + event["stdout"].write( + f"Set {event['user'].nickname}'s DJ topic to \"{topic}\"." + ) @utils.hook("received.command.djtopic") @utils.kwarg("help", "get the DJ topic for the active DJ or for any DJ")