From bf7bc03e508af70142db47be012b8c2f02303122 Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 15 Dec 2023 19:27:23 +0300 Subject: [PATCH] webhook-fix-3 --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 229a5514..39b14ba6 100644 --- a/main.py +++ b/main.py @@ -66,9 +66,9 @@ class WebhookEndpoint(HTTPEndpoint): auth = request.headers.get("Authorization") if auth: if auth == os.environ.get("WEBHOOK_SECRET"): - user_id = data["user"]["id"] - slug = (data["user"]["preferred_username"] or data["user"]["email"]).split("@")[0].lowercase() - slug = re.sub("[^0-9a-zA-Z]+", "-", slug or "") + user_id: str = data["user"]["id"] + slug: str = data["user"]["email"].split("@")[0] + slug: str = re.sub("[^0-9a-z]+", "-", slug.lower()) await create_author(user_id, slug) return JSONResponse({"status": "success"}) except Exception as e: