Created
July 8, 2025 16:38
-
-
Save dipto-008/4a9433ccb6b3a590791f71d591212d8a 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 axios = require("axios"); | |
const fs = require("fs-extra"); | |
const path = require("path"); | |
const { GoatWrapper } = require("fca-liane-utils"); | |
module.exports = { | |
config: { | |
name: "flux1proultra", // Command name | |
aliases: [], | |
version: "1.0", | |
author: "Ew'r Saim", | |
countDown: 5, | |
role: 0, | |
description: { | |
vi: "Tạo ảnh AI bằng mô hình Flux 1.1 Pro Ultra", | |
en: "Generate an AI image using the Flux 1.1 Pro Ultra model", | |
}, | |
category: "image generator", | |
guide: { | |
en: "<prompt> to generate AI image\n🧪 Example: flux1proultra Naruto Uzumaki", | |
vi: "<prompt> để tạo ảnh AI\n🧪 Example: flux1proultra Naruto Uzumaki", | |
}, | |
}, | |
onStart: async function ({ message, event, args, api }) { | |
const prompt = args.join(" "); | |
const commandName = this.config.name; | |
if (!prompt) | |
return message.reply("⚠️ Please enter a prompt.\nExample: flux1proultra Naruto Uzumaki"); | |
// React to the message | |
api.setMessageReaction("⚡", event.messageID, () => {}, true); | |
message.reply("⚡ Generating your Flux1proultra image, please wait...", async (info) => { | |
const encodedPrompt = encodeURIComponent(prompt); | |
const url = `https://api.oculux.xyz/api/flux-1.1-pro-ultra?prompt=${encodedPrompt}`; | |
const imgPath = path.join(__dirname, "cache", `${commandName}_${event.senderID}.png`); | |
try { | |
// Fetch image from API | |
const res = await axios.get(url, { responseType: "arraybuffer" }); | |
// Save image to local cache | |
fs.writeFileSync(imgPath, res.data); | |
// Send image as a message | |
message.reply({ | |
body: `✅ | Here's your generated ${commandName} image`, | |
attachment: fs.createReadStream(imgPath), | |
}, () => { | |
// Delete the image file after sending | |
fs.unlinkSync(imgPath); | |
api.unsendMessage(info.messageID); | |
}); | |
} catch (err) { | |
console.error("Image generation failed:", err); | |
message.reply("❌ Failed to generate the image. Please try again later."); | |
} | |
}); | |
}, | |
}; | |
const wrapper = new GoatWrapper(module.exports); | |
wrapper.applyNoPrefix({ allowPrefix: true }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment