diff --git a/modules/channel_op.py b/modules/channel_op.py index 49d9682c..93c8101a 100644 --- a/modules/channel_op.py +++ b/modules/channel_op.py @@ -237,3 +237,11 @@ class Module(ModuleManager.BaseModule): event["user"].username, event["user"].hostname)) event["channel"].send_kick(event["user"].nickname, "highlight spam detected") + + @Utils.hook("received.command.leave", channel_only=True) + def leave(self, event): + """ + :help: Part me from the current channel + :require_mode: o + """ + event["target"].send_part() diff --git a/src/IRCChannel.py b/src/IRCChannel.py index 6569450f..ed7064d7 100644 --- a/src/IRCChannel.py +++ b/src/IRCChannel.py @@ -117,6 +117,8 @@ class Channel(IRCObject.Object): self.server.send_mode(self.name, "-b", hostmask) def send_topic(self, topic): self.server.send_topic(self.name, topic) + def send_part(reason=None): + self.server.send_part(self.name, reason) def mode_or_above(self, user, mode): mode_orders = list(self.server.mode_prefixes.values())