From de40005f5ea5076c77c7e6793e636c9a45026e53 Mon Sep 17 00:00:00 2001 From: orientor Date: Fri, 27 Mar 2020 19:39:39 +0530 Subject: [PATCH] bridge_with_irc: Improve user-friendliness. Edit error and success messages of zulip-irc bridge to be more user friendly. --- zulip/integrations/bridge_with_irc/irc_mirror_backend.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zulip/integrations/bridge_with_irc/irc_mirror_backend.py b/zulip/integrations/bridge_with_irc/irc_mirror_backend.py index ef0acf7..54c3d22 100644 --- a/zulip/integrations/bridge_with_irc/irc_mirror_backend.py +++ b/zulip/integrations/bridge_with_irc/irc_mirror_backend.py @@ -35,15 +35,18 @@ class IRCBot(irc.bot.SingleServerIRCBot): self.reactor.loop.run_until_complete( self.connection.connect(*args, **kwargs) ) - print("Connected to IRC server.") + print("Listening now. Please send an IRC message to verify operation") def check_subscription_or_die(self): # type: () -> None resp = self.zulip_client.list_subscriptions() - assert resp["result"] == "success" + if resp["result"] != "success": + print("ERROR: %s" % (resp["msg"],)) + exit(1) subs = [s["name"] for s in resp["subscriptions"]] if self.stream not in subs: - raise Exception("The bot is not yet subscribed to the specified stream") + print("The bot is not yet subscribed to stream '%s'. Please subscribe the bot to the stream first." % (self.stream,)) + exit(1) def on_nicknameinuse(self, c, e): # type: (ServerConnection, Event) -> None