Skip to content

Commit b4b2bdb

Browse files
Icebluewolfpre-commit-ci[bot]Dorukyum
authored
fix: attachment metadata being set incorrectly in interaction responses (#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 <[email protected]> --------- Signed-off-by: Ice Wolfy <[email protected]> Signed-off-by: Dorukyum <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Dorukyum <[email protected]>
1 parent 1ca07cb commit b4b2bdb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ These changes are available on the `master` branch, but have not yet been releas
7171
- Fixed an error when responding non-ephemerally with a `Paginator` to an ephemerally
7272
deferred interaction.
7373
([#2661](https://github.com/Pycord-Development/pycord/pull/2661))
74+
- Fixed attachment metadata being set incorrectly in interaction responses causing the
75+
metadata to be ignored by Discord.
76+
([#2679](https://github.com/Pycord-Development/pycord/pull/2679))
7477

7578
### Changed
7679

discord/webhook/async_.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,7 @@ def create_interaction_response(
502502
"type": type,
503503
}
504504

505-
if data is not None:
506-
payload["data"] = data
505+
payload["data"] = data if data is not None else {}
507506
form = [{"name": "payload_json"}]
508507
attachments = []
509508
files = files or []
@@ -527,7 +526,8 @@ def create_interaction_response(
527526
"content_type": "application/octet-stream",
528527
}
529528
)
530-
payload["attachments"] = attachments
529+
if attachments:
530+
payload["data"]["attachments"] = attachments
531531
form[0]["value"] = utils._to_json(payload)
532532

533533
route = Route(

0 commit comments

Comments
 (0)