ducks.py: do not accept ,bef or ,trap if ducks are disabled

This commit is contained in:
David Schultz 2022-02-13 17:22:14 -06:00
parent 81a3dec210
commit a4f41cdfd7
No known key found for this signature in database
GPG key ID: F6DED672FFFD5E5E

View file

@ -98,6 +98,10 @@ class Module(ModuleManager.BaseModule):
@utils.kwarg("help", "Befriend a duck")
@utils.spec("!-channelonly")
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:
action = self._duck_action(event["target"], event["user"],
"befriended", "ducks-befriended")
@ -109,6 +113,10 @@ class Module(ModuleManager.BaseModule):
@utils.kwarg("help", "Trap a duck")
@utils.spec("!-channelonly")
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:
action = self._duck_action(event["target"], event["user"],
"trapped", "ducks-shot")