Mekolaos / Aternos-On-Discord

A Discord Bot to manage a minecraft server on Aternos.
GNU General Public License v3.0
101 stars 91 forks source link

It gives error, I'm noob about python so a help and I would be appreciated #36

Open CriticalRange opened 3 years ago

CriticalRange commented 3 years ago

Note: I tried mostly "everything" but can't write any command on discord other than "--help" I have the latest version of chrome, python from microsoft store, probably in the latest version of windows, using powershell on administrator

PS C:\Users\muham\Aternos-On-Discord-master> python bot.py

DevTools listening on ws://127.0.0.1:55400/devtools/browser/1ff3ee6c-86f8-4f4a-8bda-1c094ca92aa7 [WARNING] 2021-03-29 22:48:38,106 - PyNaCl is not installed, voice will NOT be supported [INFO] 2021-03-29 22:48:38,107 - logging in using static token [INFO] 2021-03-29 22:48:38,962 - Shard ID None has sent the IDENTIFY payload. [INFO] 2021-03-29 22:48:39,299 - Shard ID None has connected to Gateway: ["gateway-prd-main-dj3z",{"micros":125169,"calls":["discord-sessions-prd-2-126",{"micros":122798,"calls":["start_session",{"micros":94693,"calls":["api-prd-main-nqlr",{"micros":91793,"calls":["get_user",{"micros":3193},"add_authorized_ip",{"micros":1745},"get_guilds",{"micros":21488},"coros_wait",{"micros":2}]}]},"guilds_connect",{"micros":2,"calls":[]},"presence_connect",{"micros":14858,"calls":[]}]}]}] (Session ID: 117541f2d203010e91064177ebd6fc8b). Ignoring exception in on_ready Traceback (most recent call last): File "C:\Users\muham\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 343, in _run_event await coro(*args, **kwargs) File "C:\Users\muham\Aternos-On-Discord-master\bot.py", line 51, in on_ready connect_account() # logs into aternos File "C:\Users\muham\Aternos-On-Discord-master\connect_and_launch.py", line 124, in connect_account element = driver.find_element_by_css_selector('body > div > main > section' File "C:\Users\muham\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\remote\webdriver.py", line 598, in find_element_by_css_selector return self.find_element(by=By.CSS_SELECTOR, value=css_selector) File "C:\Users\muham\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\remote\webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { File "C:\Users\muham\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\Users\muham\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"body > div > main > section> div > div.servers.single > div > div.server-body"} (Session info: headless chrome=89.0.4389.90)

Thebestandgreatest commented 3 years ago

Open the connect_and_launch.py file and change the line headless = True to headless = False. Run the bot again, and see what screen the bot gets stuck on.

CriticalRange commented 3 years ago

Yes, after i changed it, now it redirects me to aternos login on chrome, i enter my login credentials and it says "click the login with google icon in order to login", when i try to use my google account, google doesn't find my browser secure

ilyassos1 commented 3 years ago

Open the connect_and_launch.py file and change the line headless = True to headless = False. Run the bot again, and see what screen the bot gets stuck on.

i did do that but now a new error pops up: --help works fine --players always prints 0 players online the other commands don't work at all

[WARNING] 2021-04-14 21:33:43,238 - PyNaCl is not installed, voice will NOT be supported [INFO] 2021-04-14 21:33:43,242 - logging in using static token [INFO] 2021-04-14 21:33:43,828 - Shard ID None has sent the IDENTIFY payload. [INFO] 2021-04-14 21:33:44,055 - Shard ID None has connected to Gateway: ["gateway-prd-main-88hb",{"micros":76346,"calls":["discord-sessions-prd-2-101",{"micros":73324,"calls":["start_session",{"micros":48987,"calls":["api-prd-main-0g7q",{"micros":42966,"calls":["get_user",{"micros":5366},"add_authorized_ip",{"micros":7127},"get_guilds",{"micros":3811},"coros_wait",{"micros":0}]}]},"guilds_connect",{"micros":2,"calls":[]},"presence_connect",{"micros":14836,"calls":[]}]}]}] (Session ID: 66883b95d85d917205670c8a30a2814d). [INFO] 2021-04-14 21:34:13,216 - Aternos Tab Loaded [INFO] 2021-04-14 21:34:13,216 - The bot is logged in as: Lhuncho Bot#4493 Unhandled exception in internal background task 'serverStatus'. Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/discord/ext/tasks/init.py", line 101, in _loop await self.coro(*args, *kwargs) File "/home/ilyassos/Desktop/Aternos-On-Discord/Bot.py", line 153, in serverStatus server_status = get_status() File "/home/ilyassos/Desktop/Aternos-On-Discord/connect_and_launch.py", line 55, in get_status return driver.find_element_by_xpath('//[@id="read-out-tos"]/main/section/div[' File "/usr/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "/usr/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { File "/usr/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="read-out-tos"]/main/section/div[3]/div[3]/div[1]/div/span[2]/span"} (Session info: chrome=89.0.4389.114) [INFO] 2021-04-14 21:34:15,970 - Refreshed browser

i only increased the time.sleep in connect_and_launch.py to 10 seconds because i have bad wifi

Thebestandgreatest commented 3 years ago

When you ran the bot with headless = false it should have opened a chrome tab, what does the chrome tab show?

SalsaDeliveryMan commented 3 years ago

Running the bot with headless = False just gives me a chrome tab with the Aternos login page. The fields have the information from the .env file, but the login bar just loads for a while then shows an Aternos error massage with:

ID: 64fd50c43d4f0d5c-LAX Error: 403 Path: account/login

pritam20ps05 commented 2 years ago

please once check my project on this https://github.com/pritam20ps05/mcscraper it works pretty well and works 98% of the time my server personally uses it.