1616from slack_sdk import WebClient
1717from app .core .config import (
1818 BOT_MESSAGES ,
19- get_bot_token ,
2019 get_logger ,
2120 constants ,
2221)
@@ -60,18 +59,17 @@ def mention_handler(event: Dict[str, Any], ack: Ack, body: Dict[str, Any], clien
6059 - If text after the mention starts with 'feedback:', store it as additional feedback.
6160 - Otherwise, forward to the async processing pipeline (Q&A).
6261 """
63- bot_token = get_bot_token ()
6462 logger .debug ("Sending ack response in mention_handler" )
6563 ack ()
66- respond_with_eyes (bot_token , event )
67- event_id = gate_common (event , body )
64+ respond_with_eyes (event = event )
65+ event_id = gate_common (event = event , body = body )
6866 if not event_id :
6967 return
7068 original_message_text = (event .get ("text" ) or "" ).strip ()
7169 user_id = event .get ("user" , "unknown" )
72- conversation_key , thread_root = conversation_key_and_root (event )
70+ conversation_key , thread_root = conversation_key_and_root (event = event )
7371
74- message_text = strip_mentions (original_message_text )
72+ message_text = strip_mentions (message_text = original_message_text )
7573 logger .info (f"Processing @mention from user { user_id } " , extra = {"event_id" : event_id })
7674 _common_message_handler (
7775 message_text = message_text ,
@@ -94,7 +92,7 @@ def dm_message_handler(event: Dict[str, Any], event_id: str, client: WebClient,
9492 return # not a DM; the channel handler will evaluate it
9593 message_text = (event .get ("text" ) or "" ).strip ()
9694 user_id = event .get ("user" , "unknown" )
97- conversation_key , thread_root = conversation_key_and_root (event )
95+ conversation_key , thread_root = conversation_key_and_root (event = event )
9896 logger .info (f"Processing DM from user { user_id } " , extra = {"event_id" : event_id })
9997 _common_message_handler (
10098 message_text = message_text ,
@@ -127,7 +125,7 @@ def thread_message_handler(event: Dict[str, Any], event_id: str, client: WebClie
127125
128126 conversation_key = f"{ constants .THREAD_PREFIX } { channel_id } #{ thread_root } "
129127 try :
130- resp = get_state_information ({"pk" : conversation_key , "sk" : constants .SESSION_SK })
128+ resp = get_state_information (key = {"pk" : conversation_key , "sk" : constants .SESSION_SK })
131129 if "Item" not in resp :
132130 logger .info (f"No session found for thread: { conversation_key } " )
133131 return # not a bot-owned thread; ignore
@@ -152,9 +150,8 @@ def unified_message_handler(event: Dict[str, Any], ack: Ack, body: Dict[str, Any
152150 """Handle all message events - DMs and channel messages"""
153151 logger .debug ("Sending ack response" )
154152 ack ()
155- bot_token = get_bot_token ()
156- respond_with_eyes (bot_token , event )
157- event_id = gate_common (event , body )
153+ respond_with_eyes (event = event )
154+ event_id = gate_common (event = event , body = body )
158155 if not event_id :
159156 return
160157
@@ -179,7 +176,7 @@ def feedback_handler(ack: Ack, body: Dict[str, Any], client: WebClient) -> None:
179176 conversation_key = feedback_data ["ck" ]
180177 message_ts = feedback_data .get ("mt" )
181178
182- if message_ts and not is_latest_message (conversation_key , message_ts ):
179+ if message_ts and not is_latest_message (conversation_key = conversation_key , message_ts = message_ts ):
183180 logger .info (f"Feedback ignored - not latest message: { message_ts } " )
184181 return
185182
0 commit comments