Merge pull request 'master' (#1) from ben/bitbot-modules:master into master
Reviewed-on: dokuja/bitbot-modules#1
This commit is contained in:
commit
03d68d9fe6
|
@ -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"
|
||||
|
@ -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!
|
||||
|
@ -300,7 +301,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 +312,10 @@ class Module(ModuleManager.BaseModule):
|
|||
@utils.spec("!<status>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)
|
||||
|
@ -331,3 +336,40 @@ 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("!<topic>string")
|
||||
def setdjtopic(self, event):
|
||||
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["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")
|
||||
@utils.spec("?<dj>user")
|
||||
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:
|
||||
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}")
|
||||
|
|
Loading…
Reference in New Issue