Skip to content

Commit

Permalink
fix: attachment metadata being set incorrectly in interaction respons…
Browse files Browse the repository at this point in the history
…es (#2679)

* fix: Fixed Attachment Metadata Being Set Incorrectly In Interaction Responses

* style(pre-commit): auto fixes from pre-commit.com hooks

* fix: Ensure Payload Data Exists

* chore: use inline if

Signed-off-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>

---------

Signed-off-by: Ice Wolfy <44532864+Icebluewolf@users.noreply.github.com>
Signed-off-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 28, 2024
1 parent 1ca07cb commit b4b2bdb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ These changes are available on the `master` branch, but have not yet been releas
- Fixed an error when responding non-ephemerally with a `Paginator` to an ephemerally
deferred interaction.
([#2661](https://github.com/Pycord-Development/pycord/pull/2661))
- Fixed attachment metadata being set incorrectly in interaction responses causing the
metadata to be ignored by Discord.
([#2679](https://github.com/Pycord-Development/pycord/pull/2679))

### Changed

Expand Down
6 changes: 3 additions & 3 deletions discord/webhook/async_.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,7 @@ def create_interaction_response(
"type": type,
}

if data is not None:
payload["data"] = data
payload["data"] = data if data is not None else {}
form = [{"name": "payload_json"}]
attachments = []
files = files or []
Expand All @@ -527,7 +526,8 @@ def create_interaction_response(
"content_type": "application/octet-stream",
}
)
payload["attachments"] = attachments
if attachments:
payload["data"]["attachments"] = attachments
form[0]["value"] = utils._to_json(payload)

route = Route(
Expand Down

0 comments on commit b4b2bdb

Please sign in to comment.