dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
683 stars 162 forks source link

Error while sending a message to user due to captcha #327

Closed mrcrien closed 2 years ago

mrcrien commented 2 years ago

Summary

selfbot

Reproduction Steps

when selfbot tries to send a message to user-based object, it throws '400 Bad Request (error code: 0)'

Code

class SelfBot(discord.Client):
    def __init__(self, token: str, connector):
        super().__init__()
        self.token = token
        self.connector = connector
        self.success = 0
        self.fail = 0
        self.work_status = True

    def get_id(self):
        return self.user.id

    async def send_to_user(self, user_id: int, message: str, file: str = None):
        try:
            user = await self.fetch_user(user_id=user_id)
            if file:
                await user.send(message, file=discord.File(file))
            else:
                await user.send(message)
            self.success += 1
        except Exception as e:
            self.fail += 1
            print(e)
            if self.fail > 100:
                self.work_status = False

Expected Results

Message sended

Actual Results

Throwing error because of hCaptcha verification

System Information

Python v3.10.0-final discord.py-self v1.9.1-final aiohttp v3.7.4.post0 system info: Windows 10 10.0.19044

Checklist

Additional Information

it is on closed issues but it is still an active issue

dolfies commented 2 years ago

Captcha handling exists in the master branch.

mrcrien commented 2 years ago

Captcha handling exists in the master branch.

it is not working