Add IRCServer.send_joins, a nicer interface than manually ",".join
ing
This commit is contained in:
parent
ddb69685d3
commit
deedab7248
2 changed files with 5 additions and 2 deletions
|
@ -20,8 +20,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
key = None if len(keys_sorted) <= i else keys_sorted[i]
|
key = None if len(keys_sorted) <= i else keys_sorted[i]
|
||||||
event["server"].attempted_join[channel] = key
|
event["server"].attempted_join[channel] = key
|
||||||
|
|
||||||
event["server"].send_join(
|
event["server"].send_joins(channels_sorted, keys_sorted)
|
||||||
",".join(channels_sorted), keys_sorted)
|
|
||||||
|
|
||||||
@utils.hook("self.join")
|
@utils.hook("self.join")
|
||||||
def on_join(self, event):
|
def on_join(self, event):
|
||||||
|
|
|
@ -309,6 +309,10 @@ class Server(IRCObject.Object):
|
||||||
def send_join(self, channel_name: str, keys: typing.List[str]=None
|
def send_join(self, channel_name: str, keys: typing.List[str]=None
|
||||||
) -> IRCLine.Line:
|
) -> IRCLine.Line:
|
||||||
return self.send(utils.irc.protocol.join(channel_name, keys))
|
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:
|
def send_part(self, channel_name: str, reason: str=None) -> IRCLine.Line:
|
||||||
return self.send(utils.irc.protocol.part(channel_name, reason))
|
return self.send(utils.irc.protocol.part(channel_name, reason))
|
||||||
def send_quit(self, reason: str="Leaving") -> IRCLine.Line:
|
def send_quit(self, reason: str="Leaving") -> IRCLine.Line:
|
||||||
|
|
Loading…
Reference in a new issue