From 7764493298760ec8d33f5387ea2fb6c4705a407e Mon Sep 17 00:00:00 2001 From: Wim Date: Thu, 1 Feb 2018 00:41:09 +0100 Subject: Add comment to file upload from telegram. Show comments on all bridges. Closes #358 --- bridge/matrix/matrix.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bridge/matrix') diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go index d659aaa2..06c52148 100644 --- a/bridge/matrix/matrix.go +++ b/bridge/matrix/matrix.go @@ -107,6 +107,12 @@ func (b *Bmatrix) Send(msg config.Message) (string, error) { mtype := mime.TypeByExtension("." + sp[len(sp)-1]) if strings.Contains(mtype, "image") || strings.Contains(mtype, "video") { + if fi.Comment != "" { + resp, err := b.mc.SendText(channel, msg.Username+fi.Comment) + if err != nil { + flog.Errorf("file comment failed: %#v", err) + } + } flog.Debugf("uploading file: %s %s", fi.Name, mtype) res, err := b.mc.UploadToContentRepo(content, mtype, int64(len(*fi.Data))) if err != nil { -- cgit v1.2.3