diff options
author | Wim <wim@42.be> | 2017-08-28 00:32:56 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2017-08-28 00:32:56 +0200 |
commit | e84417430d02663eb83e1ef8757c3b1bf7609bae (patch) | |
tree | 42508802af9f6340e715669a0ec920936058a823 /matterclient | |
parent | 5a8d7b5f6d30bf4d3ee93fe9593e0b3504ad684a (diff) | |
download | matterbridge-msglm-e84417430d02663eb83e1ef8757c3b1bf7609bae.tar.gz matterbridge-msglm-e84417430d02663eb83e1ef8757c3b1bf7609bae.tar.bz2 matterbridge-msglm-e84417430d02663eb83e1ef8757c3b1bf7609bae.zip |
Update PostMessage to also return and error. Add EditMessage function
Diffstat (limited to 'matterclient')
-rw-r--r-- | matterclient/matterclient.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index 53c7809c..f6b942aa 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -451,9 +451,22 @@ func (m *MMClient) GetChannelHeader(channelId string) string { return "" } -func (m *MMClient) PostMessage(channelId string, text string) { +func (m *MMClient) PostMessage(channelId string, text string) (string, error) { post := &model.Post{ChannelId: channelId, Message: text} - m.Client.CreatePost(post) + res, resp := m.Client.CreatePost(post) + if resp.Error != nil { + return "", resp.Error + } + return res.Id, nil +} + +func (m *MMClient) EditMessage(postId string, text string) (string, error) { + post := &model.Post{Message: text} + res, resp := m.Client.UpdatePost(postId, post) + if resp.Error != nil { + return "", resp.Error + } + return res.Id, nil } func (m *MMClient) JoinChannel(channelId string) error { |