From e38b1e9a6744d0b5e74f5bfe2f0958cc68c2e97a Mon Sep 17 00:00:00 2001 From: insomniac Date: Tue, 5 May 2020 18:28:04 +0100 Subject: [PATCH] Revert #115 (#121) Signed-off-by: Andrea Barberio --- event_handler.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/event_handler.go b/event_handler.go index 47cc294..ba3addc 100644 --- a/event_handler.go +++ b/event_handler.go @@ -320,18 +320,9 @@ func eventHandler(ctx *IrcContext, rtm *slack.RTM) { ctx.SlackConnected = true case *slack.DisconnectedEvent: de := msg.Data.(*slack.DisconnectedEvent) - log.Warningf("Disconnected from Slack (intentional: %v, cause: %s)", de.Intentional, de.Cause) + log.Warningf("Disconnected from Slack (intentional: %v, cause: %v)", de.Intentional, de.Cause) ctx.SlackConnected = false - // only close the IRC client connection if the disconnection from - // Slack was intentional. Otherwise RTM.ManageConnection will retry - // automatically to connect. If reconnection fails, it will surface - // in a subsequent event, so it's safe here not to wait for a - // reconnection. - if de.Intentional { - if err := ctx.Conn.Close(); err != nil { - log.Warningf("Failed to close connection to IRC client: %v", err) - } - } + ctx.Conn.Close() return case *slack.MemberJoinedChannelEvent, *slack.MemberLeftChannelEvent: // refresh the users list