Skip to content

Commit f8376ef

Browse files
committed
thread_id is a param, not a body item
1 parent b831af4 commit f8376ef

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

backend/routes/forms/submit.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,6 @@ async def send_submission_webhook(
334334
"username": form.name or "Python Discord Forms",
335335
}
336336

337-
if form.webhook.thread_id:
338-
hook["thread_id"] = form.webhook.thread_id
339-
340337
# Set hook message
341338
message = form.webhook.message
342339
if message:
@@ -354,9 +351,14 @@ async def send_submission_webhook(
354351

355352
hook["content"] = message.replace("_USER_MENTION_", mention)
356353

354+
params = {}
355+
356+
if form.webhook.thread_id:
357+
params["thread_id"] = form.webhook.thread_id
358+
357359
# Post hook
358360
async with httpx.AsyncClient() as client:
359-
r = await client.post(form.webhook.url, json=hook)
361+
r = await client.post(form.webhook.url, json=hook, params=params)
360362
r.raise_for_status()
361363

362364
@staticmethod
@@ -368,7 +370,7 @@ async def assign_role(form: Form, request_user: User) -> None:
368370

369371
url = (
370372
f"{constants.DISCORD_API_BASE_URL}/guilds/{constants.DISCORD_GUILD}"
371-
f"/members/{request_user.payload["id"]}/roles/{form.discord_role}"
373+
f"/members/{request_user.payload['id']}/roles/{form.discord_role}"
372374
)
373375

374376
async with httpx.AsyncClient() as client:

0 commit comments

Comments
 (0)