5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-25 23:41:35 +00:00

Use UserID to look for avatar instead of username (slack). Closes #472

This commit is contained in:
Wim 2018-08-06 16:44:15 +02:00
parent 2597c9bfac
commit d71850cef6

View File

@ -223,11 +223,11 @@ func (b *Bslack) Reload(cfg *bridge.Config) (string, error) {
return "", nil return "", nil
} }
func (b *Bslack) getAvatar(user string) string { func (b *Bslack) getAvatar(userid string) string {
var avatar string var avatar string
if b.Users != nil { if b.Users != nil {
for _, u := range b.Users { for _, u := range b.Users {
if user == u.Name { if userid == u.ID {
return u.Profile.Image48 return u.Profile.Image48
} }
} }
@ -283,7 +283,7 @@ func (b *Bslack) handleSlack() {
message.Text = html.UnescapeString(message.Text) message.Text = html.UnescapeString(message.Text)
// Add the avatar // Add the avatar
message.Avatar = b.getAvatar(strings.ToLower(message.Username)) message.Avatar = b.getAvatar(message.UserID)
b.Log.Debugf("<= Message is %#v", message) b.Log.Debugf("<= Message is %#v", message)
b.Remote <- *message b.Remote <- *message