Skip to content

Commit 5f24360

Browse files
authored
fix: Fix webhook execution payload. (#645)
* fix: Fix webhook execution payload. * refactor: Reimplement execute webhook on new HTTP layout. * refactor: Redefine dct variable.
1 parent 658a62a commit 5f24360

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

interactions/api/http/webhook.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ async def execute_webhook(
105105
webhook_id: int,
106106
webhook_token: str,
107107
payload: dict,
108-
wait: bool = False,
108+
wait: Optional[bool] = False,
109109
thread_id: Optional[int] = None,
110110
) -> Optional[dict]:
111111
"""
@@ -119,9 +119,13 @@ async def execute_webhook(
119119
:return: The message sent, if wait=True, else None.
120120
"""
121121

122+
params = {"wait": "true" if wait else "false"}
123+
if thread_id:
124+
params["thread_id"] = thread_id
125+
122126
return await self._req.request(
123127
Route("POST", f"/webhooks/{webhook_id}/{webhook_token}"),
124-
params={"wait": wait, "thread_id": thread_id},
128+
params=params,
125129
json=payload,
126130
)
127131

0 commit comments

Comments
 (0)