ferranfg / midjourney-discord-api-php

Generate images using Midjourney Bot through the Discord API.
https://ferranfigueredo.com
MIT License
135 stars 35 forks source link

Current suffix not included when searching the imagine message #14

Closed Visioweb closed 1 year ago

Visioweb commented 1 year ago

I already wrote previously, but the ticket was closed saying that the problem had been solved by updating the entire repository. Now I downloaded everything again, even remotely, and it gives me the exact same problem (the image on discord is generated, but the php script keeps running indefinitely even if I launch demo.php, obviously inserting the id and token. If I put a var_dump($raw_message); die() I get NULL in line 126 of the src/Midjourney.php file the same as it happened before. Why? Could it be that to use the script I have to have a pro subscription? I have the basic one, could it be due to this?

ferranfg commented 1 year ago

Try to var_dump($response) here: https://github.com/ferranfg/midjourney-discord-api-php/blob/main/src/Midjourney.php#L124

This should return a list of all the recent messages on your discord channel. Then, if your prompt is "A cyberpunk cat --v 4", you should see a message with content similar to:

"content": "**A cyberpunk cat --v 4** - <@8892XXX7391744> (fast)"

The number should be your user id.

Could you share your original prompt and what those "content" properties look like?

Visioweb commented 1 year ago

a prompt is "A cat riding a horse --v 5" and the output of var_dump($response) is here https://pastebin.com/3CeVSYga

ferranfg commented 1 year ago

Got it.

The content on your pastebin looks like **A cat riding a horse --v 5 --v 5.1** - <@798961412427743292> (fast) so there is an extra --v 5.1. I undersan if you run the /settings MJ command, you will see: "Current suffix: --v 5.1".

To get this library running, try to change your settings so your current suffix is empty and add the "--v 5.1" to your prompt instead.

Visioweb commented 1 year ago

I did as you say and, on the browser it tells me: The page doesn't work, while on the plesk logs it tells me AH01071: Got error 'PHP message: PHP Warning: Undefined array key 0 in /var/www/vhosts/sitomio.it/httpdocs/midbot/src/Midjourney.php on line 154; PHP message: PHP Warning: Attempt to read property "components" on null in /var/www/vhosts/sitomio.it/httpdocs/midbot/src/Midjourney.php on line 154;

ferranfg commented 1 year ago

Could you var_dump this $message variable?

https://github.com/ferranfg/midjourney-discord-api-php/blob/main/src/Midjourney.php#L137

Visioweb commented 1 year ago

done https://pastebin.com/q1EwMABz

Visioweb commented 1 year ago

How i resolve It?

ferranfg commented 1 year ago

Try with 2.0.1 version and let me know

Visioweb commented 1 year ago

YEAH, now working finally.. Thanks

ferranfg commented 1 year ago

Great!