Allow captions for document attachments, too
This commit is contained in:
@@ -213,6 +213,8 @@ func (b *Bwhatsapp) PostDocumentMessage(msg config.Message, filetype string) (st
|
|||||||
|
|
||||||
fi := msg.Extra["file"][0].(config.FileInfo)
|
fi := msg.Extra["file"][0].(config.FileInfo)
|
||||||
|
|
||||||
|
caption := msg.Username + fi.Comment
|
||||||
|
|
||||||
resp, err := b.wc.Upload(context.Background(), *fi.Data, whatsmeow.MediaDocument)
|
resp, err := b.wc.Upload(context.Background(), *fi.Data, whatsmeow.MediaDocument)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@@ -225,6 +227,7 @@ func (b *Bwhatsapp) PostDocumentMessage(msg config.Message, filetype string) (st
|
|||||||
Title: &fi.Name,
|
Title: &fi.Name,
|
||||||
FileName: &fi.Name,
|
FileName: &fi.Name,
|
||||||
Mimetype: &filetype,
|
Mimetype: &filetype,
|
||||||
|
Caption: &caption,
|
||||||
MediaKey: resp.MediaKey,
|
MediaKey: resp.MediaKey,
|
||||||
FileEncSha256: resp.FileEncSHA256,
|
FileEncSha256: resp.FileEncSHA256,
|
||||||
FileSha256: resp.FileSHA256,
|
FileSha256: resp.FileSHA256,
|
||||||
|
|||||||
Reference in New Issue
Block a user