From 53bf95a7a5be3d1f534d5c391d58df2c9f5a4ab0 Mon Sep 17 00:00:00 2001 From: Weather Date: Wed, 18 Mar 2026 20:47:36 -0400 Subject: [PATCH] So Close... yet so very very far --- src/api/endpoints.py | 1 + src/core/slack.py | 13 +++++++------ src/core/wikithoughts.py | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/api/endpoints.py b/src/api/endpoints.py index 9090f3e..373ebd0 100644 --- a/src/api/endpoints.py +++ b/src/api/endpoints.py @@ -60,6 +60,7 @@ async def slack_events(request: Request) -> JSONResponse: logger.info("Received Slack event!") body: dict = await request.json() + if request.headers.get("content-type") == "application/json": if body.get("type") == "url_verification": return JSONResponse({"challenge": body.get("challenge")}) diff --git a/src/core/slack.py b/src/core/slack.py index 49b054d..54346e7 100644 --- a/src/core/slack.py +++ b/src/core/slack.py @@ -71,10 +71,12 @@ async def request_upload_via_dm(user_id: str, announcement_text: str) -> None: message: dict = SLACK_DM_TEMPLATE.copy() message[0]["text"]["text"] += announcement_text - message[1]["elements"][0]["value"] = str({ - "text": announcement_text, - "user": user_id, - }) + message[1]["elements"][0]["value"] = str( + { + "text": announcement_text, + "user": user_id, + } + ) await client.chat_postMessage( channel=user_id, text=SLACK_JUMPSTART_MESSAGE, blocks=message @@ -98,8 +100,7 @@ def convert_user_response_to_bool(message_data: dict) -> bool: try: user_response = ( - message_data.get("actions", []).get(0, {}).get("action_id", "no_j") - == "yes_j" + message_data.get("actions", [])[0].get("action_id", "no_j") == "yes_j" ) except Exception as e: logger.error(f"Failed to parse data: {e}") diff --git a/src/core/wikithoughts.py b/src/core/wikithoughts.py index a46c4b1..9894ace 100644 --- a/src/core/wikithoughts.py +++ b/src/core/wikithoughts.py @@ -250,8 +250,10 @@ async def refresh_page_dictionary() -> None: results[page["title"]] = first_paragraph else: - logger.warning(f"Failure in refreshing the wiki page dictionary, JSON:\n{r_json}") - results = {"ERROR":"ERROR"} + logger.warning( + f"Failure in refreshing the wiki page dictionary, JSON:\n{r_json}" + ) + results = {"ERROR": "ERROR"} page_dict_cache = results