passivebot / midjourney-automation-bot

This repository hosts the Midjourney Automation Bot, a free script leveraging OpenAI's GPT-3 for automated image generation via Discord. It offers a simple web interface, customizable settings, and is MIT licensed for ease of use and adaptation.
https://harminder.dev/projects/midjourney-automation-bot/wiki/midjourney-automation-bot-overview/
MIT License
181 stars 37 forks source link

Bot managed to login but had an error in sending command. Can you please help? #6

Closed daaa1m closed 10 months ago

daaa1m commented 10 months ago

ERROR] [/Users/da1m/Code/PythonProj/mj-bot/midjourney_automation_bot/midjourney_automation_script.py:341] - An error occurred while sending the bot command: Timeout 30000ms exceeded. =========================== logs =========================== waiting for get_by_role("textbox", name="Message #general") ============================================================ - [28235:140704443096704] Traceback (most recent call last): File "/Users/da1m/Code/PythonProj/mj-bot/midjourney_automation_bot/midjourney_automation_script.py", line 328, in send_bot_command await chat_bar.fill(command) File "/Users/da1m/Code/PythonProj/mj-bot/venv_py311/lib/python3.11/site-packages/playwright/async_api/_generated.py", line 15963, in fill await self._impl_obj.fill( File "/Users/da1m/Code/PythonProj/mj-bot/venv_py311/lib/python3.11/site-packages/playwright/_impl/_locator.py", line 212, in fill return await self._frame.fill(self._selector, strict=True, **params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/da1m/Code/PythonProj/mj-bot/venv_py311/lib/python3.11/site-packages/playwright/_impl/_frame.py", line 528, in fill await self._channel.send("fill", locals_to_params(locals())) File "/Users/da1m/Code/PythonProj/mj-bot/venv_py311/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 61, in send return await self._connection.wrap_api_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/da1m/Code/PythonProj/mj-bot/venv_py311/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 482, in wrap_api_call return await cb() ^^^^^^^^^^ File "/Users/da1m/Code/PythonProj/mj-bot/venv_py311/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 97, in inner_send result = next(iter(done)).result() ^^^^^^^^^^^^^^^^^^^^^^^^^ playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded. =========================== logs =========================== waiting for get_by_role("textbox", name="Message #general")

[ERROR] [/Users/da1m/Code/PythonProj/mj-bot/midjourney_automation_bot/midjourney_automation_script.py:281] - An error occurred while opening the channel and entering the bot command: Timeout 30000ms exceeded. =========================== logs =========================== waiting for get_by_role("textbox", name="Message #general") ============================================================ - [28235:140704443096704] [ERROR] [/Users/da1m/Code/PythonProj/mj-bot/midjourney_automation_bot/midjourney_automation_script.py:251] - Error occurred: Timeout 30000ms exceeded. =========================== logs =========================== waiting for get_by_role("textbox", name="Message #general") ============================================================ while executing the main function. - [28235:140704443096704] [ERROR] [/Users/da1m/Code/PythonProj/mj-bot/midjourney_automation_bot/midjourney_automation_script.py:366] - An error occurred while starting the bot: Connection closed - [28235:140704443096704]

tawagotokado commented 5 months ago

Hi Daniel @daaa1m, I've encountered the same issue as you did here. Do you remember how you solved it back then?

daaa1m commented 5 months ago

yeah @tawagotokado its been a while but if memory serves me right the error comes from the fact that when the bot opens the discord website it can't find the element below likely because the website is calling it something different. i would open up devtools and check the element type and the name then replace it here. hope this helps!

waiting for get_by_role("textbox", name="Message #general")

tawagotokado commented 5 months ago

Ok, thank you very much for your reply! I guess I just need to wait for your update now ^^

tawagotokado commented 5 months ago

yeah @tawagotokado its been a while but if memory serves me right the error comes from the fact that when the bot opens the discord website it can't find the element below likely because the website is calling it something different. i would open up devtools and check the element type and the name then replace it here. hope this helps!

waiting for get_by_role("textbox", name="Message #general")

Oh, I think I know where the problem lies. Do we need to continuously adjust these codes based on the webpage source code?

daaa1m commented 5 months ago

Not continuously but yeah you need to inspect the web page to make sure the referred element is actually called "textbox" and the name="Message #general", if not then you'd have to change it