@@ -15,15 +15,18 @@ module.exports = {
15
15
run : async ( client , interaction , args ) => {
16
16
await interaction . deferReply ( )
17
17
const prompt = interaction . options . getString ( "prompt" )
18
+ const Replicate = ( await import ( "replicate" ) ) . default
18
19
19
- const replicate = await import ( "node-replicate" )
20
+ const replicate = new Replicate ( {
21
+ auth : "add your replicate token here" ,
22
+ } ) ;
20
23
21
- const prediction = await replicate . default . model (
22
- "prompthero/openjourney:9936c2001faa2194a261c01381f90e65261879985476014a0a37a334593a05eb" ,
23
- )
24
- . predict ( {
25
- prompt : prompt ,
26
- } )
24
+ const output = await
25
+ replicate . run ( "prompthero/openjourney:9936c2001faa2194a261c01381f90e65261879985476014a0a37a334593a05eb" , {
26
+ input : {
27
+ prompt : prompt
28
+ }
29
+ } )
27
30
28
31
if ( interaction . channel . nsfw === true ) {
29
32
@@ -32,7 +35,7 @@ module.exports = {
32
35
new ButtonBuilder ( )
33
36
. setLabel ( `Download` )
34
37
. setStyle ( ButtonStyle . Link )
35
- . setURL ( ` ${ prediction . output [ 0 ] } ` )
38
+ . setURL ( output )
36
39
. setEmoji ( '1083007659457912852' ) ,
37
40
new ButtonBuilder ( )
38
41
. setLabel ( `Support Us` )
@@ -43,7 +46,7 @@ module.exports = {
43
46
const embed = new EmbedBuilder ( )
44
47
. setTitle ( "**Your Prompt:**" )
45
48
. setDescription ( `**${ prompt } **` )
46
- . setImage ( prediction . output [ 0 ] )
49
+ . setImage ( output )
47
50
. setColor ( '#2f3136' )
48
51
. setFooter ( { text : `Requested by: ${ interaction . user . username } | ©️ Project Razer ` ,
49
52
iconURL : interaction . user . displayAvatarURL ( { dynamic : true } ) ,
0 commit comments