From 0177c99db14fac5ddaf36d2beee196327dad018f Mon Sep 17 00:00:00 2001 From: Iiro Laiho Date: Sat, 19 Nov 2022 01:53:01 +0200 Subject: [PATCH] Allow captions for document attachments, too --- bridge/whatsappmulti/whatsapp.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bridge/whatsappmulti/whatsapp.go b/bridge/whatsappmulti/whatsapp.go index 02eadf15..76e923bb 100644 --- a/bridge/whatsappmulti/whatsapp.go +++ b/bridge/whatsappmulti/whatsapp.go @@ -213,6 +213,8 @@ func (b *Bwhatsapp) PostDocumentMessage(msg config.Message, filetype string) (st fi := msg.Extra["file"][0].(config.FileInfo) + caption := msg.Username + fi.Comment + resp, err := b.wc.Upload(context.Background(), *fi.Data, whatsmeow.MediaDocument) if err != nil { return "", err @@ -225,6 +227,7 @@ func (b *Bwhatsapp) PostDocumentMessage(msg config.Message, filetype string) (st Title: &fi.Name, FileName: &fi.Name, Mimetype: &filetype, + Caption: &caption, MediaKey: resp.MediaKey, FileEncSha256: resp.FileEncSHA256, FileSha256: resp.FileSHA256,