From 915ca8f817e0a9000d546766515e1ec4221d9d43 Mon Sep 17 00:00:00 2001 From: Wim Date: Wed, 1 Jan 2020 22:08:11 +0100 Subject: Make linter happy and cleanup (msteams) --- bridge/msteams/handler.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'bridge/msteams/handler.go') diff --git a/bridge/msteams/handler.go b/bridge/msteams/handler.go index 3283588a..8cccfe0c 100644 --- a/bridge/msteams/handler.go +++ b/bridge/msteams/handler.go @@ -5,6 +5,7 @@ import ( "github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/helper" + msgraph "github.com/yaegashi/msgraph.go/beta" ) func (b *Bmsteams) findFile(weburl string) (string, error) { @@ -44,3 +45,15 @@ func (b *Bmsteams) handleDownloadFile(rmsg *config.Message, filename, weburl str helper.HandleDownloadData(b.Log, rmsg, filename, comment, weburl, data, b.General) return nil } + +func (b *Bmsteams) handleAttachments(rmsg *config.Message, msg msgraph.ChatMessage) { + for _, a := range msg.Attachments { + //remove the attachment tags from the text + rmsg.Text = attachRE.ReplaceAllString(rmsg.Text, "") + //handle the download + err := b.handleDownloadFile(rmsg, *a.Name, *a.ContentURL) + if err != nil { + b.Log.Errorf("download of %s failed: %s", *a.Name, err) + } + } +} -- cgit v1.2.3