Encrypto27 commited on
Commit
119b546
·
1 Parent(s): 40a8dad

flux fix att 1

Browse files
Files changed (1) hide show
  1. plugins/ai-flux.js +44 -45
plugins/ai-flux.js CHANGED
@@ -1,51 +1,50 @@
1
- const config = require('../config');
2
- const { cmd, commands } = require('../command');
3
- const { fetchJson } = require('../lib/functions');
4
-
5
  cmd({
6
- pattern: "stablediffussion",
7
- alias: ["sd", "imagine"],
8
- react: "”„",
9
- desc: "Generate an image using AI.",
10
- category: "main",
11
- filename: __filename
12
  }, async (conn, mek, m, {
13
- from,
14
- quoted,
15
- body,
16
- isCmd,
17
- command,
18
- args,
19
- q,
20
- isGroup,
21
- sender,
22
- senderNumber,
23
- botNumber2,
24
- botNumber,
25
- pushname,
26
- isMe,
27
- isOwner,
28
- groupMetadata,
29
- groupName,
30
- participants,
31
- groupAdmins,
32
- isBotAdmins,
33
- isAdmins,
34
- reply
35
  }) => {
36
- try {
37
- if (!q) return reply("Please provide a prompt for the image.");
 
 
 
 
 
 
38
 
39
- // Indicate processing of user request
40
- await reply("> *Subzero Diffussing Your image...*");
41
 
42
- // Generate and send requested image
43
- let data = await fetchJson(`https://api.davidcyriltech.my.id/diffusion?prompt=${q}`);
44
- const imageUrl = data.result;
45
- await conn.sendMessage(m.chat, { image: { url: imageUrl } });
46
 
47
- } catch (error) {
48
- console.error(error);
49
- reply(`An error occurred: ${error.message}`);
50
- }
51
- });
 
 
 
 
 
1
  cmd({
2
+ pattern: "stablediffussion",
3
+ alias: ["sd", "imagine"],
4
+ react: "”„",
5
+ desc: "Generate an image using AI.",
6
+ category: "main",
7
+ filename: __filename
8
  }, async (conn, mek, m, {
9
+ from,
10
+ quoted,
11
+ body,
12
+ isCmd,
13
+ command,
14
+ args,
15
+ q,
16
+ isGroup,
17
+ sender,
18
+ senderNumber,
19
+ botNumber2,
20
+ botNumber,
21
+ pushname,
22
+ isMe,
23
+ isOwner,
24
+ groupMetadata,
25
+ groupName,
26
+ participants,
27
+ groupAdmins,
28
+ isBotAdmins,
29
+ isAdmins,
30
+ reply
31
  }) => {
32
+ try {
33
+ if (!q) return reply("Please provide a prompt for the image.");
34
+
35
+ // Indicate processing of user request
36
+ await reply("> *Subzero Diffussing Your image...*");
37
+
38
+ // Generate and send requested image
39
+ let data = await fetchJson(`https://api.davidcyriltech.my.id/diffusion?prompt=${q}`);
40
 
41
+ // Assuming the API response is like { result: { imageUrl: '...' } }
42
+ const imageUrl = data.result.imageUrl; // Extract the image URL
43
 
44
+ await conn.sendMessage(m.chat, { image: { url: imageUrl } });
 
 
 
45
 
46
+ } catch (error) {
47
+ console.error(error);
48
+ reply(`An error occurred: ${error.message}`);
49
+ }
50
+ });