summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-07-10 21:58:43 +0200
committerWim <wim@42.be>2017-07-10 21:58:43 +0200
commit8411f2aa32cc8fa31e1b84baa0f4e4fbbafeb9d5 (patch)
tree1384b73e8c670cfb643e4b3969674c5f3483c826
parente8acc49cbd6285de3cf3d9bf943c3d1eaa99775d (diff)
downloadmatterbridge-msglm-8411f2aa32cc8fa31e1b84baa0f4e4fbbafeb9d5.tar.gz
matterbridge-msglm-8411f2aa32cc8fa31e1b84baa0f4e4fbbafeb9d5.tar.bz2
matterbridge-msglm-8411f2aa32cc8fa31e1b84baa0f4e4fbbafeb9d5.zip
Lookup bot username (slack). #213
-rw-r--r--bridge/slack/slack.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go
index 361af025..c1e324a9 100644
--- a/bridge/slack/slack.go
+++ b/bridge/slack/slack.go
@@ -229,6 +229,15 @@ func (b *Bslack) handleSlackClient(mchan chan *MMMessage) {
m.Text = ev.Text
m.Raw = ev
m.Text = b.replaceMention(m.Text)
+ if ev.BotID != "" && user.Name == "" {
+ bot, err := b.rtm.GetBotInfo(ev.BotID)
+ if err != nil {
+ continue
+ }
+ if bot.Name != "" {
+ m.Username = bot.Name
+ }
+ }
mchan <- m
}
count++