// code from goatstore // api: https://store.agi.bd const axios = require("axios"); module.exports = { config: { name: "edit2", aliases: ["e"], version: "0.0.7", author: "๐Œ๐™ดสœ๐„แด…๐ˆ", countDown: 25, // Updated to 25 seconds role: 0, shortDescription: "Edit image", longDescription: "Reply to any image", category: "image", guide: "{pn} [text]" }, onStart: async function ({ api, event, args, message, usersData }) { const { senderID, messageReply } = event; /* ===== VIP & PERMISSION CHECK ===== */ const ADMINS = global.GoatBot?.config?.adminBot || []; const isBotAdmin = ADMINS.includes(senderID); if (!isBotAdmin) { const userData = await usersData.get(senderID); const vip = userData?.data?.vip; if (!vip || !vip.expires || vip.expires < Date.now()) { return api.sendMessage("โŒ ๐•๐ˆ๐ ๐Ž๐๐‹๐˜ ๐‚๐Ž๐Œ๐Œ๐€๐๐ƒ\n" + "โ€ข ๐Ž๐ง๐ฅ๐ฒ ๐•๐ˆ๐ ๐ฎ๐ฌ๐ž๐ซ๐ฌ ๐œ๐š๐ง ๐ฎ๐ฌ๐ž ๐ž๐๐ข๐ญ\n" + "โ€ข ๐“๐ฒ๐ฉ๐ž: vip buy", event.threadID, event.messageID); } } const react = (emoji) => api.setMessageReaction(emoji, event.messageID, () => {}, true); try { const prompt = args.join(" "); if (!prompt) { react("โš ๏ธ"); return api.sendMessage("โš ๏ธ | Please provide text.", event.threadID); } const imageUrl = messageReply?.attachments[0]?.url; if (!imageUrl) { react("๐Ÿ–ผ๏ธ"); return api.sendMessage("๐Ÿ–ผ๏ธ | Please reply to an image.", event.threadID); } react("โณ"); const apiUrl = `https://azadx69x.is-a.dev/api/editor?url=${encodeURIComponent(imageUrl)}&prompt=${encodeURIComponent(prompt)}`; const response = await axios.get(apiUrl, { responseType: "stream" }); react("โœ…"); api.sendMessage({ body: `๐Ÿ–Œ ๐ˆ๐ฆ๐š๐ ๐ž ๐ž๐๐ข๐ญ๐ž๐ ๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐ฌ๐Ÿ๐ฎ๐ฅ๐ฅ๐ฒ.\n๐๐ซ๐จ๐ฆ๐ฉ๐ญ: ${prompt}`, attachment: response.data }, event.threadID, messageReply?.messageID); } catch (error) { console.error(error); react("โŒ"); api.sendMessage("โŒ | Failed to process image.", event.threadID); } } };