midjourney-api icon indicating copy to clipboard operation
midjourney-api copied to clipboard

The content was successfully drawn in discord, but did not return

Open xiaoqixiaoqi1113 opened this issue 1 year ago • 3 comments

246722869-c3bcf758-d825-4e67-b491-7249bc8dfb09 image

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

xiaoqixiaoqi1113 avatar Jun 19 '23 05:06 xiaoqixiaoqi1113

https://github.com/erictik/midjourney-client/blob/main/example/imagine-ws.ts u can run minimum test

zcpua avatar Jun 19 '23 06:06 zcpua

tring replace client.int to client.Connect().

rictt avatar Jun 19 '23 07:06 rictt

await client.init()

zcpua avatar Jun 19 '23 09:06 zcpua