Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit b0bc67357b4151ca5de47380947743a9dba29a50 Author: Wim <wim@42.be> Date: Thu Nov 02 17:11:42 2017 +0000 Use DisplayName instead of deprecated username (slack). Closes #276 diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index 2f70883..b0b1156 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -77 +77 @@ import (   "github.com/42wim/matterbridge/bridge/config"   "github.com/42wim/matterbridge/matterhook"   log "github.com/Sirupsen/logrus" - "github.com/nlopes/slack" + "github.com/matterbridge/slack"   "html"   "io"   "net/http" @@ -3236 +3239 @@ func (b *Bslack) handleSlackClient(mchan chan *MMMessage) {   }   m.UserID = user.ID   m.Username = user.Name + if user.Profile.DisplayName != "" { + m.Username = user.Profile.DisplayName + }   }   m.Channel = channel.Name   m.Text = ev.Text @@ -3946 +3979 @@ func (b *Bslack) handleMatterHook(mchan chan *MMMessage) {  func (b *Bslack) userName(id string) string {   for _, u := range b.Users {   if u.ID == id { + if u.Profile.DisplayName != "" { + return u.Profile.DisplayName + }   return u.Name   }   }