Skip to content

Commit 5e9576c

Browse files
Replicate API Update
1 parent 1c783f5 commit 5e9576c

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"common-tags": "^1.8.2",
55
"discord.js": "^14.6.0",
66
"log": "^6.3.1",
7-
"node-replicate": "1.1.6"
7+
"replicate": "^0.11.1"
88
},
99
"name": "midjourney-bot",
1010
"version": "1.0.0",

src/slashCommands/information/imagine.js

+12-9
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ module.exports = {
1515
run: async (client, interaction, args) => {
1616
await interaction.deferReply()
1717
const prompt = interaction.options.getString("prompt")
18+
const Replicate = (await import("replicate")).default
1819

19-
const replicate = await import("node-replicate")
20+
const replicate = new Replicate({
21+
auth: "add your replicate token here",
22+
});
2023

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+
})
2730

2831
if (interaction.channel.nsfw === true) {
2932

@@ -32,7 +35,7 @@ module.exports = {
3235
new ButtonBuilder()
3336
.setLabel(`Download`)
3437
.setStyle(ButtonStyle.Link)
35-
.setURL(`${prediction.output[0]}`)
38+
.setURL(output)
3639
.setEmoji('1083007659457912852'),
3740
new ButtonBuilder()
3841
.setLabel(`Support Us`)
@@ -43,7 +46,7 @@ module.exports = {
4346
const embed = new EmbedBuilder()
4447
.setTitle("**Your Prompt:**")
4548
.setDescription(`**${prompt}**`)
46-
.setImage(prediction.output[0])
49+
.setImage(output)
4750
.setColor('#2f3136')
4851
.setFooter({ text: `Requested by: ${interaction.user.username} | ©️ Project Razer `,
4952
iconURL: interaction.user.displayAvatarURL({ dynamic: true }),

0 commit comments

Comments
 (0)