mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-26 05:31:34 +00:00
Add SendDirectMessageProps to send a DM with extra props (mattermost)
This commit is contained in:
parent
7e62bc4819
commit
b81ff9c008
@ -691,6 +691,10 @@ func (m *MMClient) createCookieJar(token string) *cookiejar.Jar {
|
|||||||
|
|
||||||
// SendDirectMessage sends a direct message to specified user
|
// SendDirectMessage sends a direct message to specified user
|
||||||
func (m *MMClient) SendDirectMessage(toUserId string, msg string) {
|
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)
|
m.log.Debugf("SendDirectMessage to %s, msg %s", toUserId, msg)
|
||||||
// create DM channel (only happens on first message)
|
// create DM channel (only happens on first message)
|
||||||
_, resp := m.Client.CreateDirectChannel(m.User.Id, toUserId)
|
_, resp := m.Client.CreateDirectChannel(m.User.Id, toUserId)
|
||||||
@ -705,7 +709,7 @@ func (m *MMClient) SendDirectMessage(toUserId string, msg string) {
|
|||||||
|
|
||||||
// build & send the message
|
// build & send the message
|
||||||
msg = strings.Replace(msg, "\r", "", -1)
|
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)
|
m.Client.CreatePost(post)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user