figured out image upload to matrix but now jpeg is hard coded

master
Bel LaPointe 2022-01-13 01:12:12 -05:00
parent 2b6acc51fb
commit d3fff1519b
1 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package message
import (
"bytes"
"fmt"
"io/ioutil"
"local/truckstop/config"
@ -129,14 +130,15 @@ func (m Matrix) SendImage(uri string) error {
if err != nil {
return err
}
publicURI, err := UploadImage(b)
if err != nil {
return err
}
c, err := m.getclient()
if err != nil {
return err
}
mediaUpload, err := c.UploadToContentRepo(bytes.NewReader(b), "image/jpeg", int64(len(b)))
if err != nil {
return err
}
publicURI := mediaUpload.ContentURI
resp, err := c.SendImage(m.room, "img", publicURI)
log.Printf("sent image %s => %s: %+v", uri, publicURI, resp)
return err