mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-18 03:29:15 +00:00
Merge pull request #585 from Jhonarias13/fix/caption-sendImage
corrige caption 'soy una imagen' en el método sendImage() con whatsapp web provider @Jhonarias13 gracias buen trabajo
This commit is contained in:
@@ -163,13 +163,11 @@ class WebWhatsappProvider extends ProviderClass {
|
||||
* @param {*} text
|
||||
* @returns
|
||||
*/
|
||||
sendImage = async (number, filePath) => {
|
||||
sendImage = async (number, filePath, caption) => {
|
||||
const base64 = readFileSync(filePath, { encoding: 'base64' })
|
||||
const mimeType = mime.lookup(filePath)
|
||||
const media = new MessageMedia(mimeType, base64)
|
||||
return this.vendor.sendMessage(number, media, {
|
||||
caption: 'soy una imagen',
|
||||
})
|
||||
return this.vendor.sendMessage(number, media, { caption })
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,13 +178,11 @@ class WebWhatsappProvider extends ProviderClass {
|
||||
* @returns
|
||||
*/
|
||||
|
||||
sendAudio = async (number, filePath) => {
|
||||
sendAudio = async (number, filePath, caption) => {
|
||||
const base64 = readFileSync(filePath, { encoding: 'base64' })
|
||||
const mimeType = mime.lookup(filePath)
|
||||
const media = new MessageMedia(mimeType, base64)
|
||||
return this.vendor.sendMessage(number, media, {
|
||||
caption: 'soy un audio',
|
||||
})
|
||||
return this.vendor.sendMessage(number, media, { caption })
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,7 +231,7 @@ class WebWhatsappProvider extends ProviderClass {
|
||||
if (mimeType.includes('video'))
|
||||
return this.sendVideo(number, fileDownloaded)
|
||||
if (mimeType.includes('audio'))
|
||||
return this.sendAudio(number, fileDownloaded)
|
||||
return this.sendAudio(number, fileDownloaded, text)
|
||||
|
||||
return this.sendFile(number, fileDownloaded)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user