Created
March 6, 2024 08:06
-
-
Save dipto-008/309a9d22144b001cf4c82b82b8613195 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'); | |
module.exports.config = { | |
name: "dalle", | |
version: "1.0", | |
credits: "dipto", | |
hasPermssion: 0, | |
usePrefix: true, | |
premium: true, | |
description: "Generate images by Dalle-3 AI", | |
commandCategory: "download", | |
usages: "[text] \nJamon [A 17/18/19 years old boy/girl watching football match on tv and written Dipto and 69 on the back of his Dress , 4k]", | |
cooldowns: 5 | |
}; | |
module.exports.run = async function ({ api, event, args }) { | |
const prompt = event.messageReply?.body.split("dalle")[1] || args.join(" "); | |
if (!prompt) { | |
return api.sendMessage("β| Wrong Formet .β | Use 17/18 years old boy/girl watching football match on tv and written Dipto and 69 on the back of his Dress , 4k",event.threadID,event.messageID); | |
} | |
try { | |
const w = await api.sendMessage("Wait koro baby < π½", event.threadID); | |
const response = await axios.get(`https://all-image-genator-d1p.onrender.com/dipto/dalle?prompt=${prompt}&key=dipto008`) | |
const data = response.data.imgUrls; | |
if (!data || data.length === 0) { | |
api.sendMessage("Empty response or no images generated.",event.threadID,event.messageID); | |
} | |
const diptoo = []; | |
for (let i = 0; i < data.length; i++) { | |
const imgUrl = data[i]; | |
const imgResponse = await axios.get(imgUrl, { responseType: 'arraybuffer' }); | |
const imgPath = path.join(__dirname, 'dalle', `${i + 1}.jpg`); | |
await fs.outputFile(imgPath, imgResponse.data); | |
diptoo.push(fs.createReadStream(imgPath)); | |
} | |
await api.unsendMessage(w.messageID); | |
await api.sendMessage({ | |
body: `β |Naw Baby Tumar Generated Pic<π`, | |
attachment: diptoo | |
},event.threadID, event.messageID); | |
} catch (error) { | |
console.error(error); | |
await api.sendMessage(`Generation failed!\nError: ${error.message}`,event.threadID, event.messageID); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment