Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")})
Expand Down
13 changes: 7 additions & 6 deletions src/core/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}")
Expand Down
6 changes: 4 additions & 2 deletions src/core/wikithoughts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading