summaryrefslogtreecommitdiffstats
path: root/matterclient/matterclient.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-11-03 21:51:04 +0100
committerWim <wim@42.be>2018-11-03 21:51:04 +0100
commitb81ff9c008ed3084c6bf2d6fe6bfbc077546d6ac (patch)
treed76590de701d39cb72b818ebf41e4dc4b711f230 /matterclient/matterclient.go
parent7e62bc4819f23c57726225916f97c45ed04c60f9 (diff)
downloadmatterbridge-msglm-b81ff9c008ed3084c6bf2d6fe6bfbc077546d6ac.tar.gz
matterbridge-msglm-b81ff9c008ed3084c6bf2d6fe6bfbc077546d6ac.tar.bz2
matterbridge-msglm-b81ff9c008ed3084c6bf2d6fe6bfbc077546d6ac.zip
Add SendDirectMessageProps to send a DM with extra props (mattermost)
Diffstat (limited to 'matterclient/matterclient.go')
-rw-r--r--matterclient/matterclient.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go
index 5a173fe9..f476be06 100644
--- a/matterclient/matterclient.go
+++ b/matterclient/matterclient.go
@@ -691,6 +691,10 @@ 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)
@@ -705,7 +709,7 @@ 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)
}