vic1707 / AutoPlay-PokeMeow-Discord

A bot that plays PokeMeow for you
15 stars 19 forks source link

How detectable? #12

Closed pokefan2 closed 3 years ago

pokefan2 commented 3 years ago

I was wondering how detectable this bot is using this script. Is it using discord api to spam the commands or would it just look like a person typing on discord's side?

vic1707 commented 3 years ago

It acts like a normal human, it just type at super speed. A solution to avoid detection would be to type letter by letter with a timeout between each letter to simulate a real human before typing enter to send the message.

pokefan2 commented 3 years ago

how would i go about doing that?

vic1707 commented 3 years ago

Humm, I would replace all the SendMessage function in CustomDriver.py by :

def SendMessage(self, keys: str):
        if self.BACKWARDS : keys = keys[::-1] # this line can be removed... because the backwards flag becomes useless (other lines need to be changed to completly remove the option so keep it here ^^ )
        try: 
            for key in keys: 
                self.SEND_MSG_BAR.send_keys(key)
                sleep(0.1)
        except:
            self.SEND_MSG_BAR = self.FindOneByXPATH(self.SEND_MSG_BAR_XPATH, 'Discord sending bar')
            for key in keys: 
                self.SEND_MSG_BAR.send_keys(key)
                sleep(0.1)

        self.SEND_MSG_BAR.send_keys(Keys.RETURN)

This should send keys one by one with a cooldown of 0.1sec between each key. You can try to adjust the timing if it keeps being detected. If always waiting the same time trigger the detection you could try to wait a random number of seconds :

# on top of the files with others imports
from random import uniform
# code...

# replace 0.1 in both of the sleep of the above function by : uniform(0, 1)
# which gives :
sleep(uniform(0, 1))

The the bot will be waiting a random time between 0 and 1 second.