mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 20:49: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
|
* @param {*} text
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
sendImage = async (number, filePath) => {
|
sendImage = async (number, filePath, caption) => {
|
||||||
const base64 = readFileSync(filePath, { encoding: 'base64' })
|
const base64 = readFileSync(filePath, { encoding: 'base64' })
|
||||||
const mimeType = mime.lookup(filePath)
|
const mimeType = mime.lookup(filePath)
|
||||||
const media = new MessageMedia(mimeType, base64)
|
const media = new MessageMedia(mimeType, base64)
|
||||||
return this.vendor.sendMessage(number, media, {
|
return this.vendor.sendMessage(number, media, { caption })
|
||||||
caption: 'soy una imagen',
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,13 +178,11 @@ class WebWhatsappProvider extends ProviderClass {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sendAudio = async (number, filePath) => {
|
sendAudio = async (number, filePath, caption) => {
|
||||||
const base64 = readFileSync(filePath, { encoding: 'base64' })
|
const base64 = readFileSync(filePath, { encoding: 'base64' })
|
||||||
const mimeType = mime.lookup(filePath)
|
const mimeType = mime.lookup(filePath)
|
||||||
const media = new MessageMedia(mimeType, base64)
|
const media = new MessageMedia(mimeType, base64)
|
||||||
return this.vendor.sendMessage(number, media, {
|
return this.vendor.sendMessage(number, media, { caption })
|
||||||
caption: 'soy un audio',
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -235,7 +231,7 @@ class WebWhatsappProvider extends ProviderClass {
|
|||||||
if (mimeType.includes('video'))
|
if (mimeType.includes('video'))
|
||||||
return this.sendVideo(number, fileDownloaded)
|
return this.sendVideo(number, fileDownloaded)
|
||||||
if (mimeType.includes('audio'))
|
if (mimeType.includes('audio'))
|
||||||
return this.sendAudio(number, fileDownloaded)
|
return this.sendAudio(number, fileDownloaded, text)
|
||||||
|
|
||||||
return this.sendFile(number, fileDownloaded)
|
return this.sendFile(number, fileDownloaded)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user