diff --git a/CHANGELOG.md b/CHANGELOG.md index f32a8aab78..73a94e06f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index 7f35e71083..4b87a7e0f3 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -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 [] @@ -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(