diff --git a/CHANGELOG.md b/CHANGELOG.md index b31e2a492a..5bef258a5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,7 +104,9 @@ These changes are available on the `master` branch, but have not yet been releas - Fixed `ForumChannel.edit` allowing `default_reaction_emoji` to be `None`. ([#2739](https://github.com/Pycord-Development/pycord/pull/2739)) - Fixed missing `None` type hints in `Select.__init__`. - ([#2746](https://github.com/Pycord-Development/pycord/pull/2746)) + ([#2746])(https://github.com/Pycord-Development/pycord/pull/2746) +- Fixed `TypeError` when specifying `thread_name` in `Webhook.send`. + ([#2761])(https://github.com/Pycord-Development/pycord/pull/2761) - Updated `valid_locales` to support `in` and `es-419`. ([#2767](https://github.com/Pycord-Development/pycord/pull/2767)) - Fixed `Webhook.edit` not working with `attachments=[]`. diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index 1661b1bb67..3edc81d8e2 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -337,16 +337,12 @@ def execute_webhook( multipart: list[dict[str, Any]] | None = None, files: list[File] | None = None, thread_id: int | None = None, - thread_name: str | None = None, wait: bool = False, ) -> Response[MessagePayload | None]: params = {"wait": int(wait)} if thread_id: params["thread_id"] = thread_id - if thread_name: - payload["thread_name"] = thread_name - route = Route( "POST", "/webhooks/{webhook_id}/{webhook_token}", @@ -633,6 +629,7 @@ def handle_message_parameters( allowed_mentions: AllowedMentions | None = MISSING, previous_allowed_mentions: AllowedMentions | None = None, suppress: bool = False, + thread_name: str | None = None, ) -> ExecuteWebhookParameters: if files is not MISSING and file is not MISSING: raise TypeError("Cannot mix file and files keyword arguments.") @@ -717,6 +714,9 @@ def handle_message_parameters( payload["flags"] = flags.value + if thread_name: + payload["thread_name"] = thread_name + if multipart_files: multipart.append({"name": "payload_json", "value": utils._to_json(payload)}) payload = None @@ -1808,6 +1808,7 @@ async def send( applied_tags=applied_tags, allowed_mentions=allowed_mentions, previous_allowed_mentions=previous_mentions, + thread_name=thread_name, ) adapter = async_context.get() thread_id: int | None = None @@ -1824,7 +1825,6 @@ async def send( multipart=params.multipart, files=params.files, thread_id=thread_id, - thread_name=thread_name, wait=wait, ) diff --git a/discord/webhook/sync.py b/discord/webhook/sync.py index d2d3213d71..fde7031321 100644 --- a/discord/webhook/sync.py +++ b/discord/webhook/sync.py @@ -307,16 +307,12 @@ def execute_webhook( multipart: list[dict[str, Any]] | None = None, files: list[File] | None = None, thread_id: int | None = None, - thread_name: str | None = None, wait: bool = False, ): params = {"wait": int(wait)} if thread_id: params["thread_id"] = thread_id - if thread_name: - payload["thread_name"] = thread_name - route = Route( "POST", "/webhooks/{webhook_id}/{webhook_token}", @@ -1080,6 +1076,7 @@ def send( allowed_mentions=allowed_mentions, previous_allowed_mentions=previous_mentions, suppress=suppress, + thread_name=thread_name, ) adapter: WebhookAdapter = _get_webhook_adapter() thread_id: int | None = None @@ -1094,7 +1091,6 @@ def send( multipart=params.multipart, files=params.files, thread_id=thread_id, - thread_name=thread_name, wait=wait, ) if wait: