Merge pull request #342 from jesopo/launchd/ducks-ignore-commands

ducks.py: do not accept `,bef` or `,trap` if ducks are disabled
This commit is contained in:
David Schultz 2022-03-01 10:02:22 -06:00 committed by GitHub
commit 6f6b40b87d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -98,6 +98,10 @@ class Module(ModuleManager.BaseModule):
@utils.kwarg("help", "Befriend a duck") @utils.kwarg("help", "Befriend a duck")
@utils.spec("!-channelonly") @utils.spec("!-channelonly")
def befriend(self, event): def befriend(self, event):
if not event["target"].get_setting("ducks-enabled", False):
return event["stderr"].write(
"Ducks are not enabled in this channel"
)
if event["target"].duck_active: if event["target"].duck_active:
action = self._duck_action(event["target"], event["user"], action = self._duck_action(event["target"], event["user"],
"befriended", "ducks-befriended") "befriended", "ducks-befriended")
@ -109,6 +113,10 @@ class Module(ModuleManager.BaseModule):
@utils.kwarg("help", "Trap a duck") @utils.kwarg("help", "Trap a duck")
@utils.spec("!-channelonly") @utils.spec("!-channelonly")
def trap(self, event): def trap(self, event):
if not event["target"].get_setting("ducks-enabled", False):
return event["stderr"].write(
"Ducks are not enabled in this channel"
)
if event["target"].duck_active: if event["target"].duck_active:
action = self._duck_action(event["target"], event["user"], action = self._duck_action(event["target"], event["user"],
"trapped", "ducks-shot") "trapped", "ducks-shot")