Skip to content

Commit d8157d6

Browse files
orientorshowell
authored andcommitted
bridge_with_irc: Initialize IRC bot after checking Zulip bot.
Confirm whether Zulip bot is subscribed to the required stream first and then Initialize IRC bot object.
1 parent de40005 commit d8157d6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

zulip/integrations/bridge_with_irc/irc_mirror_backend.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class IRCBot(irc.bot.SingleServerIRCBot):
1212
def __init__(self, zulip_client, stream, topic, channel,
1313
nickname, server, nickserv_password='', port=6667):
1414
# type: (Any, str, str, irc.bot.Channel, str, str, str, int) -> None
15-
irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
1615
self.channel = channel # type: irc.bot.Channel
1716
self.zulip_client = zulip_client
1817
self.stream = stream
@@ -21,6 +20,8 @@ def __init__(self, zulip_client, stream, topic, channel,
2120
self.nickserv_password = nickserv_password
2221
# Make sure the bot is subscribed to the stream
2322
self.check_subscription_or_die()
23+
# Initialize IRC bot after proper connection to Zulip server has been confirmed.
24+
irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
2425

2526
def zulip_sender(self, sender_string):
2627
# type: (str) -> str

0 commit comments

Comments
 (0)