Skip to content

fix: 🐛 TypeError when specifying thread_name in Webhook.send #2761

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Paillat-dev
Copy link
Contributor

@Paillat-dev Paillat-dev commented Apr 4, 2025

Summary

CC @Lumabots

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.

@Lumabots
Copy link

Lumabots commented Apr 5, 2025

kwargs = {'content': '<@1118670495466934274>', 'username': 'Winiii', 'avatar_url': 'https://cdn.discordapp.com/attachments/1357984230285643797/1357984578232389754/1302995806780919898.png?ex=67f23131&is=67f0dfb1&hm=925cec84d69c8d3505074c30b5504e020206341016cd7fd397a83ced339913e1&', 'embeds': [], 'files': [<discord.file.File object at 0x7f1f6c34bbe0>, <discord.file.File object at 0x7f1f6c34a140>], 'allowed_mentions': AllowedMentions(everyone=False, users=False, roles=False, replied_user=False), 'wait': True, 'thread_name': "Hey je programme un pote pour du rp Harry Potter et j'aurai besoin d'aide en BDD"}

message = await backup_webhook.send(**kwargs)

    |   File "/home/container/.local/lib/python3.11/site-packages/discord/webhook/async_.py", line 1818, in send
    |     data = await adapter.execute_webhook(
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/container/.local/lib/python3.11/site-packages/discord/webhook/async_.py", line 225, in request
    |     raise HTTPException(response, data)
    | discord.errors.HTTPException: 400 Bad Request (error code: 50109): The request body contains invalid JSON.

In case that can help

@Paillat-dev
Copy link
Contributor Author

@Lumabots sorry for the delay, I'll be gone till Friday so won't be able to work on this. I'll take a look when I'm back.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants