Lookup bot username (slack). #213

This commit is contained in:
Wim 2017-07-10 21:58:43 +02:00
parent e8acc49cbd
commit 8411f2aa32
1 changed files with 9 additions and 0 deletions

View File

@ -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++