summaryrefslogtreecommitdiffstats
path: root/bridge/slack
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-04-20 01:01:45 +0200
committerWim <wim@42.be>2018-04-20 01:01:45 +0200
commit99ce68e9ba8b6cef5cd8a2da2f57a79c9f286bfc (patch)
treedaa10e96b33be3700437ee9e6a83d1e45431c338 /bridge/slack
parent0cf73673a9b7ddfe30c2566f7a0684b189fccc57 (diff)
downloadmatterbridge-msglm-99ce68e9ba8b6cef5cd8a2da2f57a79c9f286bfc.tar.gz
matterbridge-msglm-99ce68e9ba8b6cef5cd8a2da2f57a79c9f286bfc.tar.bz2
matterbridge-msglm-99ce68e9ba8b6cef5cd8a2da2f57a79c9f286bfc.zip
Use username if bot name is Slack API Tester (slack)
Diffstat (limited to 'bridge/slack')
-rw-r--r--bridge/slack/slack.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go
index 7d413337..0abd83c3 100644
--- a/bridge/slack/slack.go
+++ b/bridge/slack/slack.go
@@ -521,6 +521,19 @@ func (b *Bslack) handleMessageEvent(ev *slack.MessageEvent) (*config.Message, er
}
rmsg.UserID = bot.ID
}
+
+ // fixes issues with matterircd users
+ if bot.Name == "Slack API Tester" {
+ user, err := b.rtm.GetUserInfo(ev.User)
+ if err != nil {
+ return nil, err
+ }
+ rmsg.UserID = user.ID
+ rmsg.Username = user.Name
+ if user.Profile.DisplayName != "" {
+ rmsg.Username = user.Profile.DisplayName
+ }
+ }
}
// file comments are set by the system (because there is no username given)