xwa-api
Version:
GARFIELD 6.0 BY NOIZE.
811 lines (715 loc) • 128 kB
JavaScript
/*COPYRIGHT (C) 2022 CODED BY NOIZE */
const Garfield = 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');
const Config = require('../config');
const exec = require('child_process').exec;
const Language = require('../language');
const Lang = Language.getString('conventer');
if (Config.WORKTYPE == 'private') {
Garfield.addXnodes({pattern: 'media$', fromMe: true, desc: Lang.XMEDİA_DESC}, (async (message, match) => {
if (Config.LANG == 'TR' || Config.LANG == 'AZ') {
await message.sendMessage('💬Usage: *.mp4enhance*\n🐼Desc: 🇹🇷 Videnun kalitesini artırır.\n\n💬Usage: *.interp*\n🐼Desc: 🇹🇷 Videonun FPS değerini arttırır.\n\n💬Usage: *.mp4slowmo*\n🐼Desc: 🇹🇷 Ağır çekim olmayan videolara true-slowmo uygular.\n\n💬Usage: *.x4mp4*\n🐼Desc: 🇹🇷 Video Kalitesini 4 kat düşürür.\n\n💬Usage: *.x2mp4*\n🐼Desc: 🇹🇷 Video Kalitesini 2 kat düşürür.\n\n💬Usage: *.gif*\n🐼Desc: 🇹🇷 Videoyu gif’e çevirir.\n\n💬Usage: *.agif*\n🐼Desc: 🇹🇷 Videoyu sesli gif’e çevirir.\n\n💬Usage: *.mp4blur*\n🐼Desc: 🇹🇷 Video arka planını bulanıklaştırır.\n\n💬Usage: *.mp4stab*\n🐼Desc: 🇹🇷 Videonun titreşimini azaltır.\n\n💬Usage: *.mp4rainbow*\n🐼Desc: 🇹🇷 Videoya gökkuşağı efekti uygular.\n\n💬Usage: *.mp4color*\n🐼Desc: 🇹🇷 Videonun renklerini daha canlı ve çekici yapar.\n\n💬Usage: *.mp4art*\n🐼Desc: 🇹🇷 Videoya çizim efekti uygular.\n\n💬Usage: *.mp4negative*\n🐼Desc: 🇹🇷 Videoya negatif renk filtresi uygular.\n\n💬Usage: *.mp4vintage*\n🐼Desc: 🇹🇷 Videoya nostaji efekti uygular.\n\n💬Usage: *.mp4bw*\n🐼Desc: 🇹🇷 Videoya monochrome efekti uygular.\n\n💬Usage: *.mp4reverse*\n🐼Desc: 🇹🇷 Videoyu tersten oynatır.\n\n💬Usage: *.mp4edge*\n🐼Desc: 🇹🇷 Videoya edge efekti uygular.\n\n💬Usage: *.mp4image*\n🐼Desc: 🇹🇷 Fotoğrafı 5 saniyelik videoya çevirir.\n\n💬Usage: *.spectrum*\n🐼Desc: 🇹🇷 Sesin spektrum görüntüsünü video yapar.\n\n💬Usage: *.waves*\n🐼Desc: 🇹🇷 Sesin dalga aralığını videoya çevirir.\n\n💬Usage: *.frequency*\n🐼Desc: 🇹🇷 Sesin frekans aralığını videoya çevirir.\n\n💬Usage: *.avec*\n🐼Desc: 🇹🇷 Sesin farklı bir histogramını videoya çevirir.\n\n💬Usage: *.volumeaudio*\n🐼Desc: 🇹🇷 Sesin Desibel Değerini Videoya Dönüştürür.\n\n💬Usage: *.cqtaudio*\n🐼Desc: 🇹🇷 Ses CQT değerini videoya çevirir.\n\n💬Usage: *.mp3eq*\n🐼Desc: 🇹🇷 Sesi kristal berraklık düzeyinde ayarlar.\n\n💬Usage: *.mp3crusher*\n🐼Desc: 🇹🇷 Sesi bozar ve gülünç hale getirir.\n\n💬Usage: *.mp3reverse*\n🐼Desc: 🇹🇷 Sesi Tersen Oynatır.\n\n💬Usage: *.mp3bass* \n🐼Desc: 🇹🇷 Müziğin bass düzeyini, sesi bozmadan arttırır.\n\n💬Usage: *.mp3pitch*\n🐼Desc: 🇹🇷 Sesi inceltir ve hızlandırır.\n\n💬Usage *.mp3low*\n🐼Desc: 🇹🇷 Sesi kalınlaştırır ve yavaşlatır.\n\n💬Usage: *.x2mp3*\n🐼Desc: 🇹🇷 Sesi 2 kat hızlandırır.\n\n💬Usage: *.mp3volume*\n🐼Desc: 🇹🇷 Ses seviyesini fazalca arttırır.\n\n💬Usage: *.bwimage*\n🐼Desc: 🇹🇷 Fotoğrafa monochrome efekti uygular.\n\n💬Usage: *.vintageimage*\n🐼Desc: 🇹🇷 Fotoğrafa vintage efekti uygular.\n\n💬Usage: *.edgeimage*\n🐼Desc: 🇹🇷 Fotoğrafa edge efekti uygular.\n\n💬Usage: *.enhanceimage*\n🐼Desc: 🇹🇷 Fotoğrafı daha net hale getirir.\n\n💬Usage: *.blurimage*\n🐼Desc: 🇹🇷 Fotoğrafın arka planını bulanıklaştırır.\n\n💬Usage: *.grenimage*\n🐼Desc: 🇹🇷 Fotoğrafa gren efekti uygular.\n\n💬Usage: *.negativeimage*\n🐼Desc: 🇹🇷 Fotoğrafa negatif renk filtresi uygular.\n\n💬Usage: *.rainbowimage*\n🐼Desc: 🇹🇷 Fotoğrafa gökkuşağı efekti uygular.\n\n💬Usage: *.colorimage*\n🐼Desc: 🇹🇷 Fotoğrafın renklerini daha canlı ve çekici yapar.\n\n💬Usage: *.artimage*\n🐼Desc: 🇹🇷 Fotoğrafa çizim efekti uygular.');
} else {
await message.sendMessage('💬Usage: *.mp4enhance*\n🐼Desc: 🇱🇰 Enhance video’s quality.\n\n💬Usage: *.interp*\n🐼Desc: 🇱🇰 Increases the FPS of the video.\n\n💬Usage: *.mp4slowmo*\n🐼Desc: 🇱🇰 Applies true-slowmo to non-slow motion videos.\n\n💬Usage: *.x4mp4*\n🐼Desc: 🇱🇰 Reduce video’s quality by 75%.\n\n💬Usage: *.x2mp4*\n🐼Desc: 🇱🇰 Reduce video’s quality by 50%.\n\n💬Usage: *.gif*\n🐼Desc: 🇱🇰 Converts video to gif.\n\n💬Usage: *.agif*\n🐼Desc: 🇱🇰 Converts video to voiced gif.\n\n💬Usage: *.mp4blur*\n🐼Desc: 🇱🇰 Blurs the background of the video.\n\n💬Usage: *.mp4stab*\n🐼Desc: 🇱🇰 Decreases the vibration of the video.\n\n💬Usage: *.mp4rainbow*\n🐼Desc: 🇱🇰 Applies a rainbow effect to video.\n\n💬Usage: *.mp4color*\n🐼Desc: 🇱🇰 Makes the colors of the video more vivid and beautiful.\n\n💬Usage: *.mp4art*\n🐼Desc: 🇱🇰 Applies a art effect to the video.\n\n💬Usage: *.mp4negative*\n🐼Desc: 🇱🇰 Applies a negative color filter to the video.\n\n💬Usage: *.mp4vintage*\n🐼Desc: 🇱🇰 Applies a nostalgic effect to video.\n\n💬Usage: *.mp4bw*\n🐼Desc: 🇱🇰 Applies a monochrome effect to video.\n\n💬Usage: *.mp4reverse*\n🐼Desc: 🇱🇰 Plays the video in reverse.\n\n💬Usage: *.mp4edge*\n🐼Desc: 🇱🇰 Applies a edge effect to the video.\n\n💬Usage: *.mp4image*\n🐼Desc: 🇱🇰 Converts photo to 5 sec video.\n\n💬Usage: *.spectrum*\n🐼Desc: 🇱🇰 Converts the spectrum of sound into video.\n\n💬Usage: *.waves*\n🐼Desc: 🇱🇰 Converts the wave range of sound to video.\n\n💬Usage: *.frequency*\n🐼Desc: 🇱🇰 Converts the frequency range of sound to video.\n\n💬Usage: *.avec*\n🐼Desc: 🇱🇰 Converts the histogram of sound to video.\n\n💬Usage: *.volumeaudio*\n🐼Desc: 🇱🇰 Converts the decibel value of the sound into video.\n\n💬Usage: *.cqtaudio*\n🐼Desc: 🇱🇰 Converts the CQT value of audio to video.\n\n💬Usage: *.mp3eq*\n🐼Desc: 🇱🇰 Adjusts the sound to a crystal clear level.\n\n💬Usage: *.mp3bass* \n🐼Desc: 🇱🇰 Adds crystal bass without distorting the sound.\n\n💬Usage: *.mp3crusher*\n🐼Desc: 🇱🇰 Distorts the sound, makes ridiculous.\n\n💬Usage: *.mp3reverse*\n🐼Desc: 🇱🇰 Plays the sound in reverse.\n\n💬Usage: *.mp3pitch*\n🐼Desc: 🇱🇰 Makes the sound thinner and faster.\n\n💬Usage *.mp3low*\n🐼Desc: 🇱🇰 Makes the sound deep and slower.\n\n💬Usage: *.x2mp3*\n🐼Desc: 🇱🇰 Makes the sound twice as fast.\n\n💬Usage: *.mp3volume*\n🐼Desc: 🇱🇰 Increase sound level so much.\n\n💬Usage: *.bwimage*\n🐼Desc: 🇱🇰 Applies a monochrome effect to image.\n\n💬Usage: *.vintageimage*\n🐼Desc: 🇱🇰 Applies a vinatge effect to photo.\n\n💬Usage: *.edgeimage*\n🐼Desc: 🇹🇷 Fotoğrafa edge efekti uygular.\n🇱🇰 Applies a edge effect to the photo.\n\n💬Usage: *.enhanceimage*\n🐼Desc: 🇹🇷 Fotoğrafı daha net hale getirir.\n🇱🇰 Makes the photo clearer.\n\n💬Usage: *.blurimage*\n🐼Desc: 🇹🇷 Fotoğrafın arka planını bulanıklaştırır.\n🇱🇰 Blurs the background of the photo.\n\n💬Usage: *.grenimage*\n🐼Desc: 🇹🇷 Fotoğrafa gren efekti uygular.\n🇱🇰 Applies grain effect to the photo.\n\n💬Usage: *.negativeimage*\n🐼Desc: 🇱🇰 Applies a negative color filter to the photo.\n\n💬Usage: *.rainbowimage*\n🐼Desc: 🇱🇰 Applies rainbow effect to the photo.\n\n💬Usage: *.colorimage*\n🐼Desc: 🇱🇰 It makes the colors of the photo more vivid and attractive.\n\n💬Usage: *.artimage*\n🐼Desc: 🇱🇰 Applies a art effect to the photo.');
}
}));
Garfield.addXnodes({pattern: 'x4mp4', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (!message.reply_message.video) return await message.sendMessage('*Need Video!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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('25%')
.format('mp4')
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'mp3bass$', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "-filter:a", "bass=g=9:f=110:w=0.6"])
.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})
}));
Garfield.addXnodes({pattern: 'x2mp4', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (!message.reply_message.video) return await message.sendMessage('*Need Video!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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('50%')
.format('mp4')
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'mp4image', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (!message.reply_message.image) return await message.sendMessage('*Need Photo!*');
var downloading = await message.client.sendMessage(message.jid,'```Converting..```',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)
.loop(6)
.fps(19)
.videoBitrate(400)
.format('mp4')
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'spectrum', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (!message.reply_message) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Converting..```',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", "-filter_complex", "[0:a]showspectrum=s=720x1280,format=yuv420p[v]", "-map", "[v]", "-map 0:a"])
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'waves', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (!message.reply_message) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Converting..```',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", "-filter_complex", "[0:a]showwaves=s=720x1280:mode=cline:rate=25,format=yuv420p[v]", "-map", "[v]", "-map 0:a"])
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'frequency', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (!message.reply_message) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Converting..```',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", "-filter_complex", "[0:a]showfreqs=s=720x1280:mode=cline:fscale=log,format=yuv420p[v]", "-map", "[v]", "-map 0:a"])
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'avec', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (!message.reply_message) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Converting..```',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", "-filter_complex", "[0:a]avectorscope=s=720x1280:rf=5:gf=25:bf=5:draw=line,format=yuv420p[v]", "-map", "[v]", "-map 0:a"])
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'volumeaudio', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (!message.reply_message) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Converting..```',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", "-filter_complex", "[0:a]showvolume=f=1:b=4:w=720:h=68,format=yuv420p[vid]", "-map", "[vid]", "-map 0:a"])
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'cqtaudio', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (!message.reply_message) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Converting..```',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", "-filter_complex", "[0:a]showcqt=s=1280x720,format=yuv420p[v]", "-map", "[v]", "-map 0:a"])
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'mp3eq', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "superequalizer=1b=10:2b=10:3b=1:4b=5:5b=7:6b=5:7b=2:8b=3:9b=4:10b=5:11b=6:12b=7:13b=8:14b=8:15b=9:16b=9:17b=10:18b=10[a];[a]loudnorm=I=-16:TP=-1.5:LRA=14", "-ar 48k"])
.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})
}));
Garfield.addXnodes({pattern: 'mp3crusher', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "-filter_complex", "acrusher=level_in=8:level_out=18:bits=8:mode=log:aa=1"])
.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})
}));
Garfield.addXnodes({pattern: 'mp3reverse', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Converting..```',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", "-filter_complex", "areverse"])
.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})
}));
Garfield.addXnodes({pattern: 'mp4vintage', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Video!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "-vf", "curves=vintage,format=yuv420p"])
.fps(22)
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'mp4reverse', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Video!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "-vf", "reverse", "-af", "areverse"])
.format('mp4')
.fps(22)
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'mp4bw', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Video!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "-vf", "hue=s=0"])
.format('mp4')
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'bwimage', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Photo!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "-vf", "hue=s=0"])
.save('output.png')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.png'), MessageType.image, {mimetype: Mimetype.png, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'vintageimage', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Photo!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "-vf", "curves=vintage"])
.save('output.png')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.png'), MessageType.image, {mimetype: Mimetype.png, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'mp4enhance', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Video!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "-vf", "unsharp=3:3:1.5"])
.format('mp4')
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'blurimage', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Photo!*');
var downloading = await message.client.sendMessage(message.jid,'```Converting..```',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", "-vf", "split[original][copy];[copy]scale=ih*16/9:-1,crop=h=iw*9/16,gblur=sigma=20[blurred];[blurred][original]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2"])
.save('output.png')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.png'), MessageType.image, {mimetype: Mimetype.png, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'mp4blur', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "-vf", "split[original][copy];[copy]scale=ih*16/9:-1,crop=h=iw*9/16,gblur=sigma=20[blurred];[blurred][original]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2"])
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'mp3pitch', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "asetrate=44100*1.3"])
.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})
}));
Garfield.addXnodes({pattern: 'mp4edge', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Video!*');
var downloading = await message.client.sendMessage(message.jid,'```Edging Video..```',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", "-codec:v", "mpeg4", "-filter:v", "edgedetect=low=0.9:high=0.3"])
.format('mp4')
.save('output.mp4')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.mp4'), MessageType.video, {mimetype: Mimetype.mpeg, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'mp3low', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "asetrate=44100*0.9"])
.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})
}));
Garfield.addXnodes({pattern: 'x2mp3', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "-filter:a", "atempo=2.0", "-vn"])
.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})
}));
Garfield.addXnodes({pattern: 'edgeimage', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Photo*');
var downloading = await message.client.sendMessage(message.jid,'```Edging Image..```',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", "-filter:v", "edgedetect=low=0.9:high=0.2"])
.save('output.png')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.png'), MessageType.image, {mimetype: Mimetype.png, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'enhanceimage', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Photo!*');
var downloading = await message.client.sendMessage(message.jid,'```Converting..```',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", "-vf", "unsharp=3:3:1.5"])
.save('output.png')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.png'), MessageType.image, {mimetype: Mimetype.png, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'mp3volume', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('*Need Audio!*');
var downloading = await message.client.sendMessage(message.jid,'```Garfield Editing..```',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", "-filter:a", "volume=5.3"])
.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})
}));
Garfield.addXnodes({pattern: 'gif', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('Need Video!');
var downloading = await message.client.sendMessage(message.jid,'```Converting to Gif..```',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, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'agif', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('Need Video!');
var downloading = await message.client.sendMessage(message.jid,'```Converting to Gif..```',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, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'grenimage', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false) return await message.sendMessage('Need Photo!');
var downloading = await message.client.sendMessage(message.jid,'```Adding Gren..```',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)
.videoFilters('noise=alls=100:allf=t+u')
.save('output.png')
.on('end', async () => {
await message.sendMessage(fs.readFileSync('output.png'), MessageType.image, {mimetype: Mimetype.png, caption: ' ```Follow Us Facebook - https://www.facebook.com/garfieldbots/``` '});
});
return await message.client.deleteMessage(message.jid, {id: downloading.key.id, remoteJid: message.jid, fromMe: true})
}));
Garfield.addXnodes({pattern: 'interp ?(.*)', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (message.reply_message === false && match[1] === '') return await message.sendMessage('*Need Video and FPS Value!*\nEx: ```.interp 100```');
if (match[1] <= 10) return await message.sendMessage('*Low FPS Value ⚠️*\n*Please, type over 10*');
if (match[1] >= 500) return await message.sendMessage('*High FPS Value ⚠️*\n*Please, type under 500*');
await message.client.sendMessage(message.jid,'```Interpolating..```',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
});
exec('ffprobe -hide_banner -loglevel fatal -show_error -show_format -show_streams -show_programs -show_chapters -show_private_data -print_format json ' + location, async (err, st, stderr) => {
var stdout = JSON.parse(st)
var value = { value: 100 }
var time_c = { time: 1 }
if (stdout.format.size / 1000000 > 0 && stdout.format.size / 1000000 < 6) {
value.value = value.value - 2
time_c.time = time_c.time + 1
}
if (stdout.format.size / 1000000 > 5 && stdout.format.size / 1000000 < 11) {
value.value = value.value - 5
time_c.time = time_c.time + 1.4
}
if (stdout.format.size / 1000000 > 10 && stdout.format.size / 1000000 < 21) {
value.value = value.value - 9
time_c.time = time_c.time + 2
}
if (stdout.format.size / 1000000 > 20 && stdout.format.size / 1000000 < 31) {
value.value = value.value - 25
time_c.time = time_c.time + 2.3
}
if (stdout.format.size / 1000000 > 30) {
value.value = value.value - 39
time_c.time = time_c.time + 9
}
if (stdout.streams[0].duration > 0 && stdout.streams[0].duration < 21) {
value.value = value.value - 4
time_c.time = time_c.time + 1
}
if (stdout.streams[0].duration > 20 && stdout.streams[0].duration < 41) {
value.value = value.value - 9
time_c.time = time_c.time + 1.4
}
if (stdout.streams[0].duration > 40 && stdout.streams[0].duration < 61) {
value.value = value.value - 11
time_c.time = time_c.time + 2
}
if (stdout.streams[0].duration > 60 && stdout.streams[0].duration < 81) {
value.value = value.value - 15
time_c.time = time_c.time + 2.7
}
if (stdout.streams[0].duration > 80 && stdout.streams[0].duration < 101) {
value.value = value.value - 21
time_c.time = time_c.time + 3.4
}
if (stdout.streams[0].duration > 100 && stdout.streams[0].duration < 121) {
value.value = value.value - 27
time_c.time = time_c.time + 4
}
if (stdout.streams[0].duration > 120) {
value.value = value.value - 39
time_c.time = time_c.time + 9
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 0 && stdout.streams[0].r_frame_rate.split('/')[0] < 11) {
value.value = value.value + 1
time_c.time = time_c.time - 0.6
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 10 && stdout.streams[0].r_frame_rate.split('/')[0] < 21) {
value.value = value.value - 3
time_c.time = time_c.time + 1
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 20 && stdout.streams[0].r_frame_rate.split('/')[0] < 31) {
value.value = value.value - 19
time_c.time = time_c.time + 2.3
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 30 && stdout.streams[0].r_frame_rate.split('/')[0] < 41) {
value.value = value.value - 31
time_c.time = time_c.time + 4.3
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 40) {
value.value = value.value - 40
time_c.time = time_c.time + 9
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 9 && stdout.streams[0].r_frame_rate.split('/')[0] < 31 && match[1] > 39) {
time_c.time = time_c.time + 3.3
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 30 && stdout.streams[0].r_frame_rate.split('/')[0] < 41 && match[1] > 39) {
time_c.time = time_c.time + 5
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 30 && stdout.streams[0].r_frame_rate.split('/')[0] < 41 && match[1] > 49) {
time_c.time = time_c.time + 5.4
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 30 && stdout.streams[0].r_frame_rate.split('/')[0] < 41 && match[1] > 59) {
time_c.time = time_c.time + 6
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 30 && stdout.streams[0].r_frame_rate.split('/')[0] < 41 && match[1] > 69) {
time_c.time = time_c.time + 7.5
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 40 && stdout.streams[0].r_frame_rate.split('/')[0] < 61 && match[1] > 59) {
time_c.time = time_c.time + 9
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 40 && stdout.streams[0].r_frame_rate.split('/')[0] < 61 && match[1] > 64) {
time_c.time = time_c.time + 9.2
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 40 && stdout.streams[0].r_frame_rate.split('/')[0] < 61 && match[1] > 69) {
time_c.time = time_c.time + 9.5
}
if (stdout.streams[0].r_frame_rate.split('/')[0] > 40 && stdout.streams[0].r_frame_rate.split('/')[0] < 61 && match[1] > 75) {
time_c.time = time_c.time + 10
}
let prcs = Config.LANG == 'TR' || Config.LANG == 'AZ' ? '_Bu işlem biraz uzun sürebilir._\n_Öngörülen Süre:_ *' + time_c.time + ' Dakika*\n_Başarı Oranı:_ *' + value.value + '%*' : '_This process may take a while._\n_Envisaged Time:_ *' + time_c.time + ' Minute*\n_Success Rate:_ *' + value.value + '%*'
await message.client.sendMessage(message.jid,prcs, MessageType.text);
var dam = 10
ffmpeg(location)
.videoFilters(`minterpolate=fps=${match[1]}:mi_mode=mci:me_mode=bidir`)
.format('mp4')
.save('output.mp4')
.on('progress', async (progress) => {
var l = progress.percent
while (l > 10 && dam == 10) {
dam = 1
let yon = Config.LANG == 'TR' || Config.LANG == 'AZ' ? '*%10 Tamamlandı!*' : '*Completed %10!*'
await message.client.sendMessage(message.jid,yon, MessageType.text)