Skip to content

Instantly share code, notes, and snippets.

@dipto-008
Created March 6, 2024 08:30
Show Gist options
  • Save dipto-008/af9e6ed32ce23a8c57b0659aba39f072 to your computer and use it in GitHub Desktop.
Save dipto-008/af9e6ed32ce23a8c57b0659aba39f072 to your computer and use it in GitHub Desktop.
Hey noob πŸ‘‹πŸ‘‹
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