Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#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)
- 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)

Expand Down
10 changes: 5 additions & 5 deletions discord/webhook/async_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down Expand Up @@ -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.")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -1824,7 +1825,6 @@ async def send(
multipart=params.multipart,
files=params.files,
thread_id=thread_id,
thread_name=thread_name,
wait=wait,
)

Expand Down
6 changes: 1 addition & 5 deletions discord/webhook/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down Expand Up @@ -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
Expand All @@ -1094,7 +1091,6 @@ def send(
multipart=params.multipart,
files=params.files,
thread_id=thread_id,
thread_name=thread_name,
wait=wait,
)
if wait:
Expand Down