diff options
author | 2025-05-31 16:56:40 +0100 | |
---|---|---|
committer | 2025-05-31 16:56:40 +0100 | |
commit | f8376effe5d04efb9868743bb7a1559781efd414 (patch) | |
tree | 178c0ba5ca03be123e026ebbf4bf316d390e7d7b /backend | |
parent | Update SCHEMA.md with webhook thread_id (diff) |
thread_id is a param, not a body item
Diffstat (limited to 'backend')
-rw-r--r-- | backend/routes/forms/submit.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/backend/routes/forms/submit.py b/backend/routes/forms/submit.py index 869aec7..ce7da61 100644 --- a/backend/routes/forms/submit.py +++ b/backend/routes/forms/submit.py @@ -334,9 +334,6 @@ class SubmitForm(Route): "username": form.name or "Python Discord Forms", } - if form.webhook.thread_id: - hook["thread_id"] = form.webhook.thread_id - # Set hook message message = form.webhook.message if message: @@ -354,9 +351,14 @@ class SubmitForm(Route): hook["content"] = message.replace("_USER_MENTION_", mention) + params = {} + + if form.webhook.thread_id: + params["thread_id"] = form.webhook.thread_id + # Post hook async with httpx.AsyncClient() as client: - r = await client.post(form.webhook.url, json=hook) + r = await client.post(form.webhook.url, json=hook, params=params) r.raise_for_status() @staticmethod @@ -368,7 +370,7 @@ class SubmitForm(Route): url = ( f"{constants.DISCORD_API_BASE_URL}/guilds/{constants.DISCORD_GUILD}" - f"/members/{request_user.payload["id"]}/roles/{form.discord_role}" + f"/members/{request_user.payload['id']}/roles/{form.discord_role}" ) async with httpx.AsyncClient() as client: |