feat: send audio with waveform (#2309)

* added generateWaveform

* docs updated

* added usage example

* ESLint fix

* fixed: undefined returned on waveform generation failure

* fix: ESLint
This commit is contained in:
alechkos 2023-08-10 14:37:45 +03:00 • committed by GitHub
commit df1b070d54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 2 deletions

View file

@ -140,6 +140,10 @@ client.on('message', async msg => {
const attachmentData = await quotedMsg.downloadMedia();
client.sendMessage(msg.from, attachmentData, { caption: 'Here\'s your requested media.' });
}
if (quotedMsg.hasMedia && quotedMsg.type === 'audio') {
const audio = await quotedMsg.downloadMedia();
await client.sendMessage(msg.from, audio, { sendAudioAsVoice: true });
}
} else if (msg.body === '!isviewonce' && msg.hasQuotedMsg) {
const quotedMsg = await msg.getQuotedMessage();
if (quotedMsg.hasMedia) {