Skip to content

Instantly share code, notes, and snippets.

@phaticusthiccy
Created January 18, 2021 00:44
Show Gist options
  • Save phaticusthiccy/22b40360eed644d0fe26493555dabe13 to your computer and use it in GitHub Desktop.
Save phaticusthiccy/22b40360eed644d0fe26493555dabe13 to your computer and use it in GitHub Desktop.
/* Codded by @phaticusthiccy
Telegram: t.me/phaticusthiccy
Instagram: www.instagram.com/kyrie.baran
*/
const Asena = require('../events');
const {MessageType,Mimetype} = require('@adiwajshing/baileys');
const fs = require('fs');
const ffmpeg = require('fluent-ffmpeg');
const {execFile} = require('child_process');
const cwebp = require('cwebp-bin');
Asena.addCommand({pattern: 'gif', fromMe: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('Videoya Yanıt Vermelisin!');
var downloading = await message.client.sendMessage(message.jid,'```Gif’e Çevriliyor..```',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)
.noAudio()
.fps(13)
.videoBitrate(500)
.save('output_gif.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output_gif.mp4'), MessageType.video, {mimetype: Mimetype.gif});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Asena.addCommand({pattern: 'agif', fromMe: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('Videoya Yanıt Vermelisin!');
var downloading = await message.client.sendMessage(message.jid,'```Sesli Gif’e Çevriliyor..```',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)
.fps(13)
.videoBitrate(500)
.save('output_gif.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output_gif.mp4'), MessageType.video, {mimetype: Mimetype.gif});
});
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