Thumbnail

rani/matterbridge.git

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

commit 86961865cb7490e913e6461a346d25ceec67a962 Author: Wim <wim@42.be> Date: Fri Apr 20 01:01:45 2018 +0000 Use username if bot name is Slack API Tester (slack) diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index 7d41333..0abd83c 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -5216 +52119 @@ 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)