Skip to content

Commit a8389b1

Browse files
committed
build: black reformat
1 parent 291ef2d commit a8389b1

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

listeners/assistant/assistant.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,13 @@ def respond_in_assistant_thread(
7272
thread_context = get_thread_context()
7373
referred_channel_id = thread_context.get("channel_id")
7474
try:
75-
channel_history = client.conversations_history(
76-
channel=referred_channel_id, limit=50
77-
)
75+
channel_history = client.conversations_history(channel=referred_channel_id, limit=50)
7876
except SlackApiError as e:
7977
if e.response["error"] == "not_in_channel":
8078
# If this app's bot user is not in the public channel,
8179
# we'll try joining the channel and then calling the same API again
8280
client.conversations_join(channel=referred_channel_id)
83-
channel_history = client.conversations_history(
84-
channel=referred_channel_id, limit=50
85-
)
81+
channel_history = client.conversations_history(channel=referred_channel_id, limit=50)
8682
else:
8783
raise e
8884

listeners/events/__init__.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,18 @@
1515
def register(app: App):
1616
app.event("assistant_thread_started")(start_thread_with_suggested_prompts)
1717
app.event("assistant_thread_context_changed")(save_new_thread_context)
18-
app.event("message", matchers=[is_user_message_event_in_assistant_thread])(
19-
respond_to_user_message
20-
)
18+
app.event("message", matchers=[is_user_message_event_in_assistant_thread])(respond_to_user_message)
2119
app.event("message", matchers=[is_message_event_in_assistant_thread])(just_ack)
2220

2321

2422
def is_message_event_in_assistant_thread(body: Dict[str, Any]) -> bool:
2523
if is_event(body):
26-
return (
27-
body["event"]["type"] == "message"
28-
and body["event"].get("channel_type") == "im"
29-
)
24+
return body["event"]["type"] == "message" and body["event"].get("channel_type") == "im"
3025
return False
3126

3227

3328
def is_user_message_event_in_assistant_thread(body: Dict[str, Any]) -> bool:
34-
return is_message_event_in_assistant_thread(body) and body["event"].get(
35-
"subtype"
36-
) in (None, "file_share")
29+
return is_message_event_in_assistant_thread(body) and body["event"].get("subtype") in (None, "file_share")
3730

3831

3932
def just_ack():

listeners/events/thread_context_store.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ def _find_parent_message(
2323
)
2424
if response.get("messages"):
2525
for message in response.get("messages"):
26-
if (
27-
message.get("subtype") is None
28-
and message.get("user") == context.bot_user_id
29-
):
26+
if message.get("subtype") is None and message.get("user") == context.bot_user_id:
3027
return message
3128

3229

@@ -37,9 +34,7 @@ def get_thread_context(
3734
channel_id: str,
3835
thread_ts: str,
3936
) -> Optional[dict]:
40-
parent_message = _find_parent_message(
41-
context=context, client=client, channel_id=channel_id, thread_ts=thread_ts
42-
)
37+
parent_message = _find_parent_message(context=context, client=client, channel_id=channel_id, thread_ts=thread_ts)
4338
if parent_message is not None and parent_message.get("metadata") is not None:
4439
return parent_message["metadata"]["event_payload"]
4540

0 commit comments

Comments
 (0)