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:
commit
6f6b40b87d
1 changed files with 8 additions and 0 deletions
|
@ -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")
|
||||||
|
|
Loading…
Reference in a new issue