diff options
author | Wim <wim@42.be> | 2017-11-02 17:11:42 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2017-11-02 17:11:42 +0100 |
commit | b530e92834885748597f244f5df047dc30d5b9e3 (patch) | |
tree | 81dfc7abe82f84665fa287d678f219005ae9a201 /bridge/slack/slack.go | |
parent | b2a6777995c55233a47212743c781a27dde8dce6 (diff) | |
download | matterbridge-msglm-b530e92834885748597f244f5df047dc30d5b9e3.tar.gz matterbridge-msglm-b530e92834885748597f244f5df047dc30d5b9e3.tar.bz2 matterbridge-msglm-b530e92834885748597f244f5df047dc30d5b9e3.zip |
Use DisplayName instead of deprecated username (slack). Closes #276
Diffstat (limited to 'bridge/slack/slack.go')
-rw-r--r-- | bridge/slack/slack.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index 2f708832..b0b11562 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -7,7 +7,7 @@ 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" @@ -323,6 +323,9 @@ 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 @@ -394,6 +397,9 @@ 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 } } |