Created
July 9, 2025 21:23
-
-
Save dipto-008/29e234f65a03616ae42a189a8e8d5b73 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 { getStreamFromURL } = global.utils; | |
module.exports = { | |
config: { | |
name: "flux2", | |
aliases: ["fluximg", "fluxv2"], | |
version: "3.0", | |
author: "nexo_here", | |
countDown: 10, | |
role: 0, | |
shortDescription: "Generate AI image using Flux v2 API", | |
longDescription: "Generate image from text prompt using BetaDash Flux v2", | |
category: "AI-IMAGE", | |
guide: { | |
en: "{pn} <prompt>" | |
} | |
}, | |
langs: { | |
en: { | |
loading: "β° Generating image with Flux v2...", | |
error: "β Failed to generate image. Please try again later." | |
} | |
}, | |
onStart: async function ({ message, args, getLang }) { | |
const prompt = args.join(" "); | |
if (!prompt) return message.reply("β οΈ Please provide a prompt!"); | |
message.reply(getLang("loading")); | |
try { | |
const apiUrl = `https://betadash-api-swordslush-production.up.railway.app/fluxv2?prompt=${encodeURIComponent(prompt)}`; | |
const res = await axios.get(apiUrl); | |
const imageUrl = res.data.imageUrl; | |
if (!imageUrl) throw new Error("No image URL found in API response"); | |
const imgStream = await getStreamFromURL(imageUrl); | |
return message.reply({ | |
body: `πΌοΈ Prompt: ${prompt}`, | |
attachment: imgStream | |
}); | |
} catch (err) { | |
console.error("Flux v2 API Error:", err.message || err); | |
return message.reply(getLang("error")); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment