Closed dreir2 closed 2 years ago
The error explains itself... You should put thé URL not the id of the channel
https://discord.com/channels/1324283712345854709/123456789012345678 Isn't this the URL? I tried with this and still having similar error
Try thé URL without the commas 🤔
It works! Thanks! May I know how to add random delays to simulate a real human before typing enter to send the message? I tried looking into another closed issue at
https://github.com/vic1707/AutoPlay-PokeMeow-Discord/issues/12
which the method seems to be outdated
it shouldn't be outdated 🤔 what's not working?
I am trying to have some delay between when using ;p and pb/gb/etc as well as after using pb/gb/etc before using ;p again. But it doesnt seem to have a delay even after doing this as shown below, I added sleep(uniform(3, 4))
def SendMessage(self, keys: str):
if self.BACKWARDS : keys = keys[::-1]
try:
self.SEND_MSG_BAR.send_keys(keys)
except:
self.SEND_MSG_BAR = self.FindOneByXPATH(self.SEND_MSG_BAR_XPATH, 'Discord sending bar')
self.SEND_MSG_BAR.send_keys(keys)
sleep(uniform(3, 4))
That's normal, your code will only Wait if an error is handled.
Either you align (vertically the sleep
with if
/try
and catch
or you add a second sleep
right before thé except line)
(sorry i'm on phone so I can't really code rn)
I'm getting
CHECKLIST = Checklists(DRIVER)
File "C:\Users\dreir\poke\Classes\Checklists.py", line 14, in init
if self.checklist():
File "C:\Users\dreir\poke\Classes\Checklists.py", line 19, in checklist
message = self.DRIVER.WaitNew(';checklist', f"{ self.DRIVER.USERNAME }'s Checklist")
File "C:\Users\dreir\poke\Classes\CustomDriver.py", line 138, in WaitNew
self.SendMessage(to_send)
File "C:\Users\dreir\poke\Classes\CustomDriver.py", line 116, in SendMessage
sleep(uniform(3, 4))
NameError: name 'uniform' is not defined
def SendMessage(self, keys: str):
if self.BACKWARDS : keys = keys[::-1]
try:
self.SEND_MSG_BAR.send_keys(keys)
sleep(uniform(3, 4))
except:
self.SEND_MSG_BAR = self.FindOneByXPATH(self.SEND_MSG_BAR_XPATH, 'Discord sending bar')
self.SEND_MSG_BAR.send_keys(keys)
sleep(uniform(3, 4))
And here is when I align with the try
File "C:\Users\dreir\poke\bot.py", line 11, in
def SendMessage(self, keys: str):
if self.BACKWARDS : keys = keys[::-1]
try:
self.SEND_MSG_BAR.send_keys(keys)
sleep(uniform(3, 4))
except:
self.SEND_MSG_BAR = self.FindOneByXPATH(self.SEND_MSG_BAR_XPATH, 'Discord sending bar')
self.SEND_MSG_BAR.send_keys(keys)
self.SEND_MSG_BAR.send_keys(Keys.RETURN)
first you forgot
from random import uniform
at the begining of the file if you get NameError: name 'uniform' is not defined
as for the code itself either
def SendMessage(self, keys: str):
if self.BACKWARDS : keys = keys[::-1]
try:
self.SEND_MSG_BAR.send_keys(keys)
sleep(uniform(3, 4))
except:
self.SEND_MSG_BAR = self.FindOneByXPATH(self.SEND_MSG_BAR_XPATH, 'Discord sending bar')
self.SEND_MSG_BAR.send_keys(keys)
sleep(uniform(3, 4))
or
def SendMessage(self, keys: str):
if self.BACKWARDS : keys = keys[::-1]
try:
self.SEND_MSG_BAR.send_keys(keys)
except:
self.SEND_MSG_BAR = self.FindOneByXPATH(self.SEND_MSG_BAR_XPATH, 'Discord sending bar')
self.SEND_MSG_BAR.send_keys(keys)
finally:
sleep(uniform(3, 4))
(I forgot about the finally
block, been a while since doing python)
Yay~ It is finally working with a delay, thank for so much for your help!
Hi, as stated in title. I tried running this python bot.py -U 'XXXXX#1234' -M 'testing@yahoo.com' -P 'password' -C '123456789012345678' (replaced actual letters with XX and number with random numbers) It opens up firefox and leave it hanging there with the below message on CMD. I tried full URL 'https://discord.com/channels/1324283712345854709/123456789012345678' and it too did not work
File "C:\Users\Lalala\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.InvalidArgumentException: Message: Malformed URL: URL constructor: '123456789012345678' is not a valid URL.
And when I tried along with -D chrome it gives
File "C:\Users\Hehehe\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 92 Current browser version is 96.0.4664.110 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
Thank you for your help!