Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: thread creation payload #2191

Merged
merged 3 commits into from Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -158,6 +158,8 @@ These changes are available on the `master` branch, but have not yet been releas
`Webhook` class. ([#2156](https://github.com/Pycord-Development/pycord/pull/2156))
- Fixed `ScheduledEvent.creator_id` returning `str` instead of `int`.
([#2162](https://github.com/Pycord-Development/pycord/pull/2162))
- Fixed initial message inside of the create thread payload sending legacy beta payload.
([#2191](https://github.com/Pycord-Development/pycord/pull/2191))

## [2.4.1] - 2023-03-20

Expand Down
27 changes: 16 additions & 11 deletions discord/http.py
Expand Up @@ -1183,37 +1183,42 @@ def start_forum_thread(
"auto_archive_duration": auto_archive_duration,
"invitable": invitable,
}
if content:
payload["content"] = content

if applied_tags:
payload["applied_tags"] = applied_tags

message = {}

if content:
message["content"] = content

if embed:
payload["embeds"] = [embed]
message["embeds"] = [embed]

if embeds:
payload["embeds"] = embeds
message["embeds"] = embeds

if nonce:
payload["nonce"] = nonce
message["nonce"] = nonce

if allowed_mentions:
payload["allowed_mentions"] = allowed_mentions
message["allowed_mentions"] = allowed_mentions

if components:
payload["components"] = components
message["components"] = components

if stickers:
payload["sticker_ids"] = stickers
message["sticker_ids"] = stickers

if rate_limit_per_user:
payload["rate_limit_per_user"] = rate_limit_per_user
message["rate_limit_per_user"] = rate_limit_per_user

if message != {}:
payload["message"] = message

# TODO: Once supported by API, remove has_message=true query parameter
route = Route(
"POST",
"/channels/{channel_id}/threads?has_message=true",
"/channels/{channel_id}/threads",
channel_id=channel_id,
)

Expand Down