Thumbnail

rani/matterbridge.git

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

commit 1d519b29d37312ad65806a9b11d4bd443c097bfe Author: Wim <wim@42.be> Date: Sat Nov 03 21:51:04 2018 +0000 Add SendDirectMessageProps to send a DM with extra props (mattermost) diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index 5a173fe..f476be0 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -6916 +69110 @@ func (m *MMClient) createCookieJar(token string) *cookiejar.Jar {    // SendDirectMessage sends a direct message to specified user  func (m *MMClient) SendDirectMessage(toUserId string, msg string) { + m.SendDirectMessageProps(toUserId, msg, nil) +} + +func (m *MMClient) SendDirectMessageProps(toUserId string, msg string, props map[string]interface{}) {   m.log.Debugf("SendDirectMessage to %s, msg %s", toUserId, msg)   // create DM channel (only happens on first message)   _, resp := m.Client.CreateDirectChannel(m.User.Id, toUserId) @@ -7057 +7097 @@ func (m *MMClient) SendDirectMessage(toUserId string, msg string) {     // build & send the message   msg = strings.Replace(msg, "\r", "", -1) - post := &model.Post{ChannelId: m.GetChannelId(channelName, m.Team.Id), Message: msg} + post := &model.Post{ChannelId: m.GetChannelId(channelName, m.Team.Id), Message: msg, Props: props}   m.Client.CreatePost(post)  }