Skip to content

Commit abb14fc

Browse files
committed
Updates formatting and logging
1 parent 1e1ea66 commit abb14fc

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ async def startup_event() -> None:
115115
async def shutdown_event():
116116
await Scheduler.shutdown()
117117

118+
118119
# Currently, handled by the old Pybot and can't be handled by us without some legacy token usage
119120
# @api.post("/pybot/api/v1/slack/invite")
120121
# async def invite_new_user(
@@ -168,7 +169,7 @@ async def handle_mentorship_request_claim_reset_click(
168169
await handle_mentorship_request_claim_reset(SlackActionRequestBody(**body), context)
169170

170171

171-
@app.command("/new_join") # This is used specifically for testing in staging
172+
@app.command("/new_join") # This is used specifically for testing in staging
172173
@app.event("member_joined_channel")
173174
async def handle_new_member_join_event(
174175
body: dict[str, Any], context: AsyncBoltContext
@@ -273,12 +274,11 @@ async def handle_daily_programmer(
273274

274275

275276
@app.event("message")
276-
async def handle_message_event(
277-
body: dict[str, Any], context: AsyncBoltContext
278-
) -> None:
277+
async def handle_message_event(body: dict[str, Any], context: AsyncBoltContext) -> None:
279278
logger.info("STAGE: Processing message event...")
280279
await context.ack()
281280

281+
282282
if __name__ == "__main__":
283283
if os.environ.get("RUN_ENV") == "development":
284284
uvicorn.run(

modules/handlers/daily_programmer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ def process_daily_programmer_post_text(body: SlackMessageInfo) -> None:
5252
.replace("]", "")
5353
.replace("*", ""),
5454
"Text": body.text[name.span()[1] + 1 :],
55-
"Initially Posted On": str(datetime.fromtimestamp(
56-
float(body.ts), timezone.utc
57-
)),
58-
"Last Posted On": str(datetime.fromtimestamp(
59-
float(body.ts), timezone.utc
60-
)),
55+
"Initially Posted On": str(
56+
datetime.fromtimestamp(float(body.ts), timezone.utc)
57+
),
58+
"Last Posted On": str(
59+
datetime.fromtimestamp(float(body.ts), timezone.utc)
60+
),
6161
"Posted Count": 1,
6262
"Initial Slack TS": body.ts,
6363
"Blocks": body.blocks,

modules/models/slack_models/shared_models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import os
2+
import logging
23
from functools import cached_property
3-
from typing import Any, Union, Optional
4+
from typing import Any, Union
45

56
from pydantic import BaseModel, Field
67

8+
logger = logging.getLogger(__name__)
9+
710

811
class SlackUserInfo(BaseModel):
912
id: str = Field(
@@ -277,6 +280,7 @@ def __init__(self, team_info: SlackTeamInfo) -> None:
277280
self._team_info = team_info
278281

279282
def find_channel_by_name(self, channel_name: str) -> SlackConversationInfo:
283+
logger.debug(f"Finding channel by name: {channel_name}")
280284
return [
281285
conversation
282286
for conversation in self.full_conversation_list

modules/utils/message_scheduler.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ async def schedule_messages(async_app: AsyncApp) -> None:
5757
f"and Next Send: {next_when_to_send}"
5858
)
5959
scheduled_message_table.update_record(
60-
message.airtable_id, {"Last Sent": str(datetime_to_update), "When To Send": str(next_when_to_send)}
60+
message.airtable_id,
61+
{
62+
"Last Sent": str(datetime_to_update),
63+
"When To Send": str(next_when_to_send),
64+
},
6165
)
6266
else:
6367
logger.warning(

0 commit comments

Comments
 (0)