Skip to content

Instantly share code, notes, and snippets.

@phaticusthiccy
Created January 1, 2021 09:44
Show Gist options
  • Select an option

  • Save phaticusthiccy/8613b07650e1ecfaa7709aedfc59aae1 to your computer and use it in GitHub Desktop.

Select an option

Save phaticusthiccy/8613b07650e1ecfaa7709aedfc59aae1 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');
/*
WHATSAPP GIF OLARAK VİDEO PAYLAŞMAYA API İLE İZİN VERMİYOR SANIRIM
GIF OLARAK PAYLAŞMA YOKSA KALDIRABİLİRSİN BUNU %100 ÇALIŞIYOR
Asena.addCommand({pattern: 'gif', fromMe: true, desc: 'Videoyu GIF’e çevirir.'}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Bir Videoya Yanıt Vermelisin!*');
var downloading = await message.client.sendMessage(message.jid,'```Video GIF’e Dönüştürülü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)
.withSize('38%')
.withFps(12)
.withNoAudio()
.format('mp4')
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video);
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
*/
Asena.addCommand({pattern: 'mp4audio', fromMe: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Bir Videoya Yanıt Vermelisin!*');
var downloading = await message.client.sendMessage(message.jid,'```Video Ses Kaydına Dönüştürülü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)
.withNoVideo()
.save('output.mp3')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp3'), MessageType.audio, {mimetype: Mimetype.mp4Audio, ptt: false});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
/*
DÜZENLENECEK <<<
Asena.addCommand({pattern: 'mp4sticker', fromMe: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Bir Stickere Yanıt Vermelisin!*');
var downloading = await message.client.sendMessage(message.jid,'```Sticker Videoya Dönüştürülü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)
.fromFormat('webp_pipe')
.toFormat('mp4')
.videoBitrate(1000)
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video);
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
*/
Asena.addCommand({pattern: 'imagesticker', fromMe: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Bir Stickere Yanıt Vermelisin!*');
var downloading = await message.client.sendMessage(message.jid,'```Sticker Fotoğrafa Dönüştürülü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)
.fromFormat('webp_pipe')
.toFormat('gif')
.videoBitrate(1000)
.save('output.gif')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.gif'), MessageType.image);
});
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