(m, { conn, text, usedPrefix, command })
| 2 | import uploadImage from '../lib/uploadImage.js' |
| 3 | |
| 4 | let handler = async (m, { conn, text, usedPrefix, command }) => { |
| 5 | if (!text) |
| 6 | throw `*This command generates images from text prompts*\n\n*𝙴xample usage*\n*◉ ${usedPrefix + command} Beautiful anime girl*\n*◉ ${usedPrefix + command} Elon Musk in pink output*` |
| 7 | |
| 8 | try { |
| 9 | m.reply('*Please wait, generating images...*') |
| 10 | |
| 11 | const endpoint = `https://api.gurusensei.workers.dev/dream?prompt=${encodeURIComponent(text)}` |
| 12 | const response = await fetch(endpoint) |
| 13 | |
| 14 | if (response.ok) { |
| 15 | const imageBuffer = await response.buffer() |
| 16 | let imgurl = await uploadImage(imageBuffer) |
| 17 | await conn.sendButton(m.chat,'Here is your Result', author, imgurl, [['Script', `.sc`]], null, [['Follow Me', `https://github.com/Guru322`]], m) |
| 18 | } else { |
| 19 | throw '*Image generation failed*' |
| 20 | } |
| 21 | } catch { |
| 22 | throw '*Oops! Something went wrong while generating images. Please try again later.*' |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | handler.help = ['dalle'] |
| 27 | handler.tags = ['AI'] |
nothing calls this directly
no outgoing calls
no test coverage detected