Add IRCServer.send_joins, a nicer interface than manually ",".joining

This commit is contained in:
jesopo 2019-02-20 17:08:30 +00:00
parent ddb69685d3
commit deedab7248
2 changed files with 5 additions and 2 deletions

View file

@ -20,8 +20,7 @@ class Module(ModuleManager.BaseModule):
key = None if len(keys_sorted) <= i else keys_sorted[i]
event["server"].attempted_join[channel] = key
event["server"].send_join(
",".join(channels_sorted), keys_sorted)
event["server"].send_joins(channels_sorted, keys_sorted)
@utils.hook("self.join")
def on_join(self, event):

View file

@ -309,6 +309,10 @@ class Server(IRCObject.Object):
def send_join(self, channel_name: str, keys: typing.List[str]=None
) -> IRCLine.Line:
return self.send(utils.irc.protocol.join(channel_name, keys))
def send_joins(self, channel_names: typing.List[str],
keys: typing.List[str]=None):
return self.send(utils.irc.protocol.join(",".join(channel_names),
keys))
def send_part(self, channel_name: str, reason: str=None) -> IRCLine.Line:
return self.send(utils.irc.protocol.part(channel_name, reason))
def send_quit(self, reason: str="Leaving") -> IRCLine.Line: