API-XX commited on
Commit
22fe733
Β·
verified Β·
1 Parent(s): a95d8a0

Upload case.js

Browse files
Files changed (1) hide show
  1. case.js +9 -17
case.js CHANGED
@@ -1755,33 +1755,25 @@ case 'update': {
1755
  }
1756
  break;
1757
  }
1758
- case 'flux': {
1759
- if (!q) return reply("❌ Please enter a prompt.\n\nExample: .flux create a cyberpunk lizard image");
1760
 
1761
- await loading();
1762
- let apiUrl = `https://api.siputzx.my.id/api/ai/flux?prompt=${encodeURIComponent(q)}`;
1763
 
1764
  try {
1765
- let response = await fetch(apiUrl, { timeout: 60000 });
1766
- let json = await response.json();
1767
-
1768
- if (!json.status || !json.data) {
1769
- return reply("❌ No image generated. Try again later.");
1770
- }
1771
-
1772
- let imageUrl = json.data;
1773
 
1774
  await conn.sendMessage(m.chat, {
1775
  image: { url: imageUrl },
1776
- caption: fontx(`🎨 *Flux AI Generated Image*\n\nπŸ“ *Prompt:* ${q}\nπŸ“· *Result:* See the image above!\n> ${caption}`)
1777
- });
1778
 
1779
  } catch (error) {
1780
- console.error("Error fetching Flux AI response:", error);
1781
- reply("❌ Error while generating your image. Try again later.");
1782
  }
1783
  break;
1784
- }
1785
  case 'blackbox': {
1786
  if (!q) return reply("❌ Please enter a question or prompt.\n\nExample: .blackbox How do I code in JavaScript?");
1787
  await loading();
 
1755
  }
1756
  break;
1757
  }
1758
+ case 'flux': {
1759
+ if (!q) return reply(`❌ Please enter a prompt.\n\nExample: *${prefix + command} create a cyberpunk lizard image*`);
1760
 
1761
+ await loading(); // Display loading message
 
1762
 
1763
  try {
1764
+ let imageUrl = `https://api.siputzx.my.id/api/ai/flux?prompt=${encodeURIComponent(q)}`;
 
 
 
 
 
 
 
1765
 
1766
  await conn.sendMessage(m.chat, {
1767
  image: { url: imageUrl },
1768
+ caption: fontx(`🎨 *Flux AI Generated Image*\n\nπŸ“ *Prompt:* ${q}\n> ${caption}`),
1769
+ }, { quoted: m });
1770
 
1771
  } catch (error) {
1772
+ console.error("Error in flux case:", error);
1773
+ reply("❌ An error occurred while generating the image. Please try again later.");
1774
  }
1775
  break;
1776
+ }
1777
  case 'blackbox': {
1778
  if (!q) return reply("❌ Please enter a question or prompt.\n\nExample: .blackbox How do I code in JavaScript?");
1779
  await loading();