diff options
Diffstat (limited to 'bridge/slack')
-rw-r--r-- | bridge/slack/helpers.go | 7 | ||||
-rw-r--r-- | bridge/slack/slack.go | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/bridge/slack/helpers.go b/bridge/slack/helpers.go index 19ac5d09..fdcef2e7 100644 --- a/bridge/slack/helpers.go +++ b/bridge/slack/helpers.go @@ -205,11 +205,12 @@ func (b *Bslack) populateMessageWithUserInfo(ev *slack.MessageEvent, rmsg *confi // Second, deal with "real" users if we have the necessary information. var userID string - if ev.User != "" { + switch { + case ev.User != "": userID = ev.User - } else if ev.SubMessage != nil && ev.SubMessage.User != "" { + case ev.SubMessage != nil && ev.SubMessage.User != "": userID = ev.SubMessage.User - } else { + default: return nil } diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index 701f4769..814aeeac 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -98,13 +98,14 @@ func (b *Bslack) Connect() error { b.RLock() defer b.RUnlock() if b.GetString(incomingWebhookConfig) != "" { - if b.GetString(outgoingWebhookConfig) != "" { + switch { + case b.GetString(outgoingWebhookConfig) != "": b.Log.Info("Connecting using webhookurl (sending) and webhookbindaddress (receiving)") b.mh = matterhook.New(b.GetString(outgoingWebhookConfig), matterhook.Config{ InsecureSkipVerify: b.GetBool(skipTLSConfig), BindAddress: b.GetString(incomingWebhookConfig), }) - } else if b.GetString(tokenConfig) != "" { + case b.GetString(tokenConfig) != "": b.Log.Info("Connecting using token (sending)") b.sc = slack.New(b.GetString(tokenConfig)) b.rtm = b.sc.NewRTM() @@ -114,7 +115,7 @@ func (b *Bslack) Connect() error { InsecureSkipVerify: b.GetBool(skipTLSConfig), BindAddress: b.GetString(incomingWebhookConfig), }) - } else { + default: b.Log.Info("Connecting using webhookbindaddress (receiving)") b.mh = matterhook.New(b.GetString(outgoingWebhookConfig), matterhook.Config{ InsecureSkipVerify: b.GetBool(skipTLSConfig), |