commit f868d58f44f57be5e52518de1f02438ac3012ae8
Author: Wim <wim@42.be>
Date: Thu Sep 21 21:27:44 2017 +0000
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go
index 9dcf96c..37d7bc5 100644
--- a/matterclient/matterclient.go
+++ b/matterclient/matterclient.go
@@ -4676 +46715 @@ func (m *MMClient) PostMessage(channelId string, text string) (string, error) {
return res.Id, nil
}
+func (m *MMClient) PostMessageWithFiles(channelId string, text string, fileIds []string) (string, error) {
+ post := &model.Post{ChannelId: channelId, Message: text, FileIds: fileIds}
+ 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)
@@ -7806 +78914 @@ func (m *MMClient) GetTeamId() string {
return m.Team.Id
}
+func (m *MMClient) UploadFile(data []byte, channelId string, filename string) (string, error) {
+ f, resp := m.Client.UploadFile(data, channelId, filename)
+ if resp.Error != nil {
+ return "", resp.Error
+ }
+ return f.FileInfos[0].Id, nil
+}
+
func (m *MMClient) StatusLoop() {
retries := 0
backoff := time.Second * 60