const axios = require("axios"); module.exports = { config: { name: "edit2", aliases: ["e"], version: "0.0.7", author: "Azadx69x", 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); } } };