Thumbnail

rani/matterbridge.git

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

commit 7f2c758bcce9edbae3d7f8f1e14df84edcc90179 Author: Wim <wim@42.be> Date: Mon Aug 28 00:32:56 2017 +0000 Update PostMessage to also return and error. Add EditMessage function diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index 53c7809..f6b942a 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -4519 +45122 @@ 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 {