diff options
Diffstat (limited to 'matterclient')
-rw-r--r-- | matterclient/matterclient.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index e3633a5f..859c94bc 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -288,7 +288,7 @@ func (m *MMClient) parseActionPost(rmsg *Message) { if m.GetUser(data.UserId) == nil { m.UpdateUsers() } - rmsg.Username = m.GetUser(data.UserId).Username + rmsg.Username = m.GetUserName(data.UserId) rmsg.Channel = m.GetChannelName(data.ChannelId) rmsg.Type = data.Type teamid, _ := rmsg.Raw.Data["team_id"].(string) @@ -621,6 +621,14 @@ func (m *MMClient) GetUser(userId string) *model.User { return m.Users[userId] } +func (m *MMClient) GetUserName(userId string) string { + user := m.GetUser(userId) + if user != nil { + return user.Username + } + return "" +} + func (m *MMClient) GetStatus(userId string) string { res, err := m.Client.GetStatuses() if err != nil { |