Skip to content

Commit

Permalink
Ping response to allow webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
dyakovri committed Dec 29, 2023
1 parent 2b29abc commit 011fcfc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions social/routes/discord.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging

from fastapi import APIRouter, BackgroundTasks, Request
from fastapi.responses import JSONResponse
from fastapi_sqlalchemy import db

from social.handlers_discord.base import process_event
Expand All @@ -27,6 +28,9 @@ async def discord_webhook(request: Request, background_tasks: BackgroundTasks):
)
db.session.commit()

if request_data.get("type") == 1:
return JSONResponse({"type": 1})

background_tasks.add_task(process_event, request_data)

return

0 comments on commit 011fcfc

Please sign in to comment.