Created
March 6, 2024 08:30
-
-
Save dipto-008/af9e6ed32ce23a8c57b0659aba39f072 to your computer and use it in GitHub Desktop.
Hey noob ππ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { get } = require('axios'); | |
const { writeFileSync, unlinkSync, createReadStream } = require('fs-extra'); | |
module.exports.config = { | |
name: 'v2g', | |
version: "1.6.9", | |
credits: "ππππ π±ππ", | |
usePrefix: true, | |
hasPermssion: 0, | |
cooldowns: 1, | |
commandCategory: "utilities", | |
description: "Video to gif converter", | |
usage: "[link] or [reply to a video]", | |
}; | |
exports.run = async function ({ api, event, args }) { | |
try{ | |
const d = event.messageReply?.attachments[0]?.url || args.join(' '); | |
if (!d) { | |
return api.sendMessage('β| Please provide a link or reply to a video.', event.threadID); | |
} | |
{ api.setMessageReaction("π", event.messageID, (err) => {}, true); | |
} | |
const { data } = await get(`https://all-image-genator-d1p.onrender.com/dipto/gif?url=${encodeURIComponent(d)}`); | |
const path = __dirname + '/cache/v2g.gif'; | |
const img = (await get(data.data, { responseType: "arraybuffer" })).data; | |
writeFileSync(path, Buffer.from(img), "binary"); | |
api.sendMessage({ | |
body: `β | GIF LINK: ${data.data}\nπ° | Author: ${data.author}`,attachment: createReadStream(path)} ,event.threadID, () => unlinkSync(path), event.messageID); | |
} catch (err){ | |
console.log(err); | |
api.sendMessage(err, event.threadID); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment