4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 16:39:24 +00:00

Add comment to file upload from telegram. Show comments on all bridges. Closes #358

This commit is contained in:
Wim
2018-02-01 00:41:09 +01:00
parent 64a20ee61b
commit 7764493298
6 changed files with 27 additions and 9 deletions

View File

@ -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 {