don't use full event names to check what command we're in

This commit is contained in:
jesopo 2019-09-10 12:59:52 +01:00
parent bad108d7ce
commit 7fbb5b2823
3 changed files with 5 additions and 5 deletions

View file

@ -125,7 +125,7 @@ class Module(ModuleManager.BaseModule):
@utils.kwarg("require_access", "op")
@utils.kwarg("usage", "[nickname]")
def op(self, event):
add = event.name == "received.command.op"
add = event["command"] == "op"
target = event["args_split"][0] if event["args"] else event[
"user"].nickname
event["target"].send_mode("+o" if add else "-o", target)
@ -137,7 +137,7 @@ class Module(ModuleManager.BaseModule):
@utils.kwarg("require_access", "voice")
@utils.kwarg("usage", "[nickname]")
def voice(self, event):
add = event.name == "received.command.voice"
add = event["command"] == "voice"
target = event["args_split"][0] if event["args"] else event[
"user"].nickname
event["target"].send_mode("+v" if add else "-v", target)
@ -184,7 +184,7 @@ class Module(ModuleManager.BaseModule):
@utils.kwarg("require_access", "mute")
@utils.kwarg("help", "Mute a given user")
def _mute(self, event):
add = event.name == "received.command.mute"
add = event["command"] == "mute"
time, args = self._parse_time(event["args_split"], 1)
target_name = args[0]

View file

@ -99,7 +99,7 @@ class Module(ModuleManager.BaseModule):
@utils.kwarg("require-mode", "o")
@utils.kwarg("require-access", "cignore")
def cignore(self, event):
remove = event.name == "received.command.cunignore"
remove = event["command"] == "cunignore"
target_user = event["server"].get_user(event["args_split"][0])
is_ignored = event["target"].get_user_setting(target_user.get_id(),

View file

@ -96,7 +96,7 @@ class Module(ModuleManager.BaseModule):
@utils.kwarg("min_args", 1)
@utils.kwarg("usage", "<target>")
def changepoint(self, event):
positive = event.name == "received.command.addpoint"
positive = event["command"] == "addpoint"
success, message = self._karma(event["server"], event["user"],
event["args"].strip(), positive)
event["stdout" if success else "stderr"].write(message)