Skip to content

Commit 75b7ef0

Browse files
committed
fix: Ensure Payload Data Exists
1 parent fb09d53 commit 75b7ef0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

discord/webhook/async_.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ def create_interaction_response(
503503

504504
if data is not None:
505505
payload["data"] = data
506+
else:
507+
payload["data"] = {}
506508
form = [{"name": "payload_json"}]
507509
attachments = []
508510
files = files or []
@@ -522,7 +524,8 @@ def create_interaction_response(
522524
"content_type": "application/octet-stream",
523525
}
524526
)
525-
payload["data"]["attachments"] = attachments
527+
if attachments:
528+
payload["data"]["attachments"] = attachments
526529
form[0]["value"] = utils._to_json(payload)
527530

528531
route = Route(

0 commit comments

Comments
 (0)