Skip to content

Commit bbbecb7

Browse files
committed
dont thread dm
1 parent 4a13592 commit bbbecb7

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

packages/slackBotFunction/app/slack/slack_handlers.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def mention_handler(event, ack, body, client):
128128
event=event,
129129
event_id=event_id,
130130
bot_token=bot_token,
131+
post_to_thread=True,
131132
)
132133

133134

@@ -154,6 +155,7 @@ def dm_message_handler(event, event_id, client):
154155
event=event,
155156
event_id=event_id,
156157
bot_token=bot_token,
158+
post_to_thread=False,
157159
)
158160

159161

@@ -335,6 +337,7 @@ def _common_message_handler(
335337
event,
336338
event_id,
337339
bot_token,
340+
post_to_thread: bool,
338341
):
339342
if message_text.lower().startswith(constants.FEEDBACK_PREFIX):
340343
feedback_text = message_text.split(":", 1)[1].strip() if ":" in message_text else ""
@@ -353,11 +356,15 @@ def _common_message_handler(
353356
logger.error(f"Failed to store channel feedback via mention: {e}", extra={"error": traceback.format_exc()})
354357
BOT_MESSAGES = get_bot_messages()
355358
try:
356-
client.chat_postMessage(
357-
channel=channel_id,
358-
text=BOT_MESSAGES["feedback_thanks"],
359-
thread_ts=thread_root,
360-
)
359+
params = {
360+
"channel": channel_id,
361+
"text": BOT_MESSAGES["feedback_thanks"],
362+
}
363+
364+
if post_to_thread:
365+
params["thread_ts"] = thread_root
366+
367+
client.chat_postMessage(**params)
361368
except Exception as e:
362369
logger.error(f"Failed to post channel feedback ack: {e}", extra={"error": traceback.format_exc()})
363370
return

0 commit comments

Comments
 (0)