dolfies / discord.py-self

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

400 Bad Request (error code: 50109): The request body contains invalid JSON. #484

Closed JamesTesting888 closed 1 year ago

JamesTesting888 commented 1 year ago

Summary

Failed to send a message, while it was working before.

Reproduction Steps

  1. Bot definition:
    bot = commands.Bot(
    self_bot=False,
    command_prefix='r! ',
    captcha_handler=HCaptchaHandler()
    )
  2. Send code:
    channel = await author.create_dm()
    await channel.send(some_message, file=discord.File(file_path))

Note: I tried with a slightly older version of the master branch and it works fine. It was the master branch from a week before or so, which is installed on my local computer.

Code

No response

Expected Results

Message sent

Actual Results

Error: ERROR:asyncio:Task exception was never retrieved future: <Task finished name='discord.py: on_message' coro=<Client._run_event() done, defined at /usr/local/lib/python3.9/dist-packages/discord/client.py:488> exception=AttributeError("'str' object has no attribute 'traceback'")> Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/discord/client.py", line 496, in _run_event await coro(*args, **kwargs) File "", line 620, in on_message await channel.send(fine_tune(random.choice(starter_phrases)), file=discord.File(recruit_banner)) File "/usr/local/lib/python3.9/dist-packages/discord/abc.py", line 1654, in send data = await state.http.send_message(channel.id, params=params) File "/usr/local/lib/python3.9/dist-packages/discord/http.py", line 843, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 50109): The request body contains invalid JSON.

System Information

Using the latest master branch. (Just installed)

Checklist

Additional Information

No response

dolfies commented 1 year ago

Should be fixed! Not sure captcha handling with form body payloads ever worked though; if it did, Discord changed something.