changed channel_op.py to not need an argument for (de)op/(de)voice.

This commit is contained in:
jesopo 2016-07-05 12:17:22 +01:00
parent c02470ddbf
commit afc8a72f05
No known key found for this signature in database
GPG key ID: 0BBDEB2AEFCFFCB3

View file

@ -14,17 +14,13 @@ class Module(object):
).hook(self.kickban, channel_only=True, require_mode="o", ).hook(self.kickban, channel_only=True, require_mode="o",
min_args=1) min_args=1)
bot.events.on("received").on("command").on("op" bot.events.on("received").on("command").on("op"
).hook(self.op, channel_only=True, require_mode="o", ).hook(self.op, channel_only=True, require_mode="o")
min_args=1)
bot.events.on("received").on("command").on("deop" bot.events.on("received").on("command").on("deop"
).hook(self.deop, channel_only=True, require_mode="o", ).hook(self.deop, channel_only=True, require_mode="o")
min_args=1)
bot.events.on("received").on("command").on("voice" bot.events.on("received").on("command").on("voice"
).hook(self.voice, channel_only=True, require_mode="o", ).hook(self.voice, channel_only=True, require_mode="o")
min_args=1)
bot.events.on("received").on("command").on("devoice" bot.events.on("received").on("command").on("devoice"
).hook(self.devoice, channel_only=True, require_mode="o", ).hook(self.devoice, channel_only=True, require_mode="o")
min_args=1)
def kick(self, event): def kick(self, event):
target = event["args_split"][0] target = event["args_split"][0]
@ -58,10 +54,18 @@ class Module(object):
event["stderr"].write("That user is not in this channel") event["stderr"].write("That user is not in this channel")
def op(self, event): def op(self, event):
event["target"].send_mode("+o", event["args_split"][0]) target = event["user"].nickname if not event["args_split"] else event[
"args_split"][0]
event["target"].send_mode("+o", target)
def deop(self, event): def deop(self, event):
event["target"].send_mode("-o", event["args_split"][0]) target = event["user"].nickname if not event["args_split"] else event[
"args_split"][0]
event["target"].send_mode("-o", target)
def voice(self, event): def voice(self, event):
event["target"].send_mode("+v", event["args_split"][0]) target = event["user"].nickname if not event["args_split"] else event[
"args_split"][0]
event["target"].send_mode("+v", target)
def devoice(self, event): def devoice(self, event):
event["target"].send_mode("-v", event["args_split"][0]) target = event["user"].nickname if not event["args_split"] else event[
"args_split"][0]
event["target"].send_mode("-v", target)