erictik / midjourney-api

MidJourney client. Unofficial Node.js client
Apache License 2.0
1.64k stars 269 forks source link

variable shadowing, incorrect delete #276

Open DmitryGolovin-azur opened 6 days ago

DmitryGolovin-azur commented 6 days ago

Hi. I noticed a problem, when I run sequence V1 -> U1 (on new picture) with websocket. I don't see results.

I found the problem here: messageCreate -> done -> filterMessages -> getEventByContent. getEventByContent works wrong because waitMjEvents contains old values. I also found the cause of this inconsistence (variable shadowing):

https://github.com/erictik/midjourney-api/blob/1346be21baa852938e5eaed4329bf72f2c45e8aa/src/discord.ws.ts#L655

https://github.com/erictik/midjourney-api/blob/1346be21baa852938e5eaed4329bf72f2c45e8aa/src/discord.ws.ts#L635 https://github.com/erictik/midjourney-api/blob/1346be21baa852938e5eaed4329bf72f2c45e8aa/src/discord.ws.ts#L640

DmitryGolovin-azur commented 6 days ago

you can remove word var, or add nonce to the params of handleImageMessage