Merge pull request #62 from AntonMcClure/master

Replaced command ,bang with ,trap
This commit is contained in:
jesopo 2019-06-05 16:12:45 +01:00 committed by GitHub
commit 7e5f6af344
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,7 +68,7 @@ class Module(ModuleManager.BaseModule):
return "%s %s a duck! You've %s %d ducks in %s!" % ( return "%s %s a duck! You've %s %d ducks in %s!" % (
user.nickname, action, action, action_count, channel.name) user.nickname, action, action, action_count, channel.name)
def _no_duck(self, channel, user, stderr, action): def _no_duck(self, channel, user, stderr):
if channel.get_setting("ducks-kick"): if channel.get_setting("ducks-kick"):
channel.send_kick(user.nickname, NO_DUCK) channel.send_kick(user.nickname, NO_DUCK)
else: else:
@ -82,18 +82,16 @@ class Module(ModuleManager.BaseModule):
"ducks-befriended") "ducks-befriended")
event["stdout"].write(action) event["stdout"].write(action)
else: else:
self._no_duck(event["target"], event["user"], event["stderr"], self._no_duck(event["target"], event["user"], event["stderr"])
"befriend")
@utils.hook("received.command.bang", channel_only=True) @utils.hook("received.command.trap", channel_only=True)
def bang(self, event): def trap(self, event):
if event["target"].duck_active: if event["target"].duck_active:
action = self._duck_action(event["target"], event["user"], "shot", action = self._duck_action(event["target"], event["user"], "trapped",
"ducks-shot") "ducks-shot")
event["stdout"].write(action) event["stdout"].write(action)
else: else:
self._no_duck(event["target"], event["user"], event["stderr"], self._no_duck(event["target"], event["user"], event["stderr"])
"shoot")
@utils.hook("received.command.friends") @utils.hook("received.command.friends")
def friends(self, event): def friends(self, event):