midjourney-api
midjourney-api copied to clipboard
The content was successfully drawn in discord, but did not return
the code that reproduces this issue or a replay of the bug
const { Midjourney } = require("midjourney") const axios = require('axios') const express = require('express') const router = express.Router();
const client = new Midjourney({ ServerId: process.env.SERVER_ID, ChannelId: process.env.CHANNEL_ID, SalaiToken: process.env.SALAI_TOKEN, Debug: true, Ws: true, });
client.init()
router.post("/image", async ({ body: { prompt } }, rej) => {
console.log(prompt);
const Imagine = await client.Imagine(prompt);
const imgName = Imagine.uri.split("/").at(-1)
const { data } = await axios.get(Imagine.uri, { responseType: 'arraybuffer' })
rej.send({ Imagine: Imagine.uri, imgName })
})
module.exports = router
https://github.com/erictik/midjourney-client/blob/main/example/imagine-ws.ts u can run minimum test
tring replace client.int to client.Connect().
await client.init()