Skip to content

Instantly share code, notes, and snippets.

@phaticusthiccy
Created March 1, 2021 00:00
Show Gist options
  • Save phaticusthiccy/a7cb56a61d8bb6cde6e2b3a9a0434505 to your computer and use it in GitHub Desktop.
Save phaticusthiccy/a7cb56a61d8bb6cde6e2b3a9a0434505 to your computer and use it in GitHub Desktop.
const Asena = require('../events');
const {MessageType,Mimetype} = require('@adiwajshing/baileys');
const fs = require('fs');
const ffmpeg = require('fluent-ffmpeg');
Asena.addCommand({pattern: 'test', fromMe: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('Herhangi Bir Medyayı Yanıtlaman Gerekiyor!');
var downloading = await message.client.sendMessage(message.jid,'Efekt Uygulanıyor!',MessageType.text);
var location = await message.client.downloadAndSaveMediaMessage({
key: {
remoteJid: message.reply_message.jid,
id: message.reply_message.id
},
message: message.reply_message.data.quotedMessage
});
ffmpeg(location)
.outputOptions(["-y", "-af", "afade=t=in:ss=0:d=15"])
.save('output.mp3')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp3'), MessageType.audio, {mimetype: Mimetype.mp4Audio});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment