Add !leave to modules/channel_op.py

This commit is contained in:
jesopo 2018-10-02 14:55:12 +01:00
parent 16474dacef
commit 150788c6c6
2 changed files with 10 additions and 0 deletions

View file

@ -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()

View file

@ -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())