From d8157d6b80203ab4e1cf31359b3ad939be4c8e5d Mon Sep 17 00:00:00 2001 From: orientor Date: Sun, 29 Mar 2020 17:40:25 +0530 Subject: [PATCH] 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. --- zulip/integrations/bridge_with_irc/irc_mirror_backend.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zulip/integrations/bridge_with_irc/irc_mirror_backend.py b/zulip/integrations/bridge_with_irc/irc_mirror_backend.py index 54c3d22..888f500 100644 --- a/zulip/integrations/bridge_with_irc/irc_mirror_backend.py +++ b/zulip/integrations/bridge_with_irc/irc_mirror_backend.py @@ -12,7 +12,6 @@ class IRCBot(irc.bot.SingleServerIRCBot): def __init__(self, zulip_client, stream, topic, channel, nickname, server, nickserv_password='', port=6667): # type: (Any, str, str, irc.bot.Channel, str, str, str, int) -> None - irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel # type: irc.bot.Channel self.zulip_client = zulip_client self.stream = stream @@ -21,6 +20,8 @@ class IRCBot(irc.bot.SingleServerIRCBot): self.nickserv_password = nickserv_password # Make sure the bot is subscribed to the stream self.check_subscription_or_die() + # Initialize IRC bot after proper connection to Zulip server has been confirmed. + irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) def zulip_sender(self, sender_string): # type: (str) -> str