@@ -131,25 +131,25 @@ def handle_app_mentioned(
131131``` python
132132from logging import Logger
133133
134- from slack_bolt.context.async_context import AsyncBoltContext
135- from slack_bolt.context.say.async_say import AsyncSay
136- from slack_bolt.context.say_stream.async_say_stream import AsyncSayStream
137- from slack_bolt.context.set_status.async_set_status import AsyncSetStatus
138- from slack_sdk.web.async_client import AsyncWebClient
134+ from slack_bolt.context import BoltContext
135+ from slack_bolt.context.say import Say
136+ from slack_bolt.context.say_stream import SayStream
137+ from slack_bolt.context.set_status import SetStatus
138+ from slack_sdk import WebClient
139139
140140from agent import CaseyDeps, run_casey_agent
141141from thread_context import session_store
142142from listeners.views.feedback_builder import build_feedback_blocks
143143
144144
145- async def handle_message (
146- client : AsyncWebClient ,
147- context : AsyncBoltContext ,
145+ def handle_message (
146+ client : WebClient ,
147+ context : BoltContext ,
148148 event : dict ,
149149 logger : Logger,
150- say : AsyncSay ,
151- say_stream : AsyncSayStream ,
152- set_status : AsyncSetStatus ,
150+ say : Say ,
151+ say_stream : SayStream ,
152+ set_status : SetStatus ,
153153):
154154 """ Handle messages sent to Casey via DM or in threads the bot is part of."""
155155 # Issue submissions are posted by the bot with metadata so the message
@@ -211,9 +211,7 @@ The Assistant side panel requires additional setup. See the [Assistant class gui
211211``` py
212212from logging import Logger
213213
214- from slack_bolt.context.set_suggested_prompts.async_set_suggested_prompts import (
215- AsyncSetSuggestedPrompts,
216- )
214+ from slack_bolt.context.set_suggested_prompts import SetSuggestedPrompts
217215
218216SUGGESTED_PROMPTS = [
219217 {" title" : " Reset Password" , " message" : " I need to reset my password" },
@@ -222,12 +220,12 @@ SUGGESTED_PROMPTS = [
222220]
223221
224222
225- async def handle_assistant_thread_started (
226- set_suggested_prompts : AsyncSetSuggestedPrompts , logger : Logger
223+ def handle_assistant_thread_started (
224+ set_suggested_prompts : SetSuggestedPrompts , logger : Logger
227225):
228226 """ Handle assistant thread started events by setting suggested prompts."""
229227 try :
230- await set_suggested_prompts(
228+ set_suggested_prompts(
231229 prompts = SUGGESTED_PROMPTS ,
232230 title = " How can I help you today?" ,
233231 )
@@ -279,12 +277,10 @@ The `say_stream` utility streamlines calling the Python Slack SDK's [`WebClient.
279277If neither a ` channel_id ` or ` thread_ts ` can be sourced, then the utility will be ` None ` .
280278
281279``` python
282- app.message(' *' , async ({ sayStream }) = > {
283- const stream = sayStream();
284- await stream.append({ markdown_text: " Here's my response..." });
285- await stream.append({ markdown_text: " And here's more..." });
286- await stream.stop();
287- });
280+ streamer = say_stream()
281+ streamer.append(markdown_text = " Here's my response..." )
282+ streamer.append(markdown_text = " And here's more..." )
283+ streamer.stop()
288284```
289285
290286---
@@ -492,25 +488,25 @@ def handle_app_mentioned(
492488import re
493489from logging import Logger
494490
495- from slack_bolt.context.async_context import AsyncBoltContext
496- from slack_bolt.context.say.async_say import AsyncSay
497- from slack_bolt.context.say_stream.async_say_stream import AsyncSayStream
498- from slack_bolt.context.set_status.async_set_status import AsyncSetStatus
499- from slack_sdk.web.async_client import AsyncWebClient
491+ from slack_bolt.context import BoltContext
492+ from slack_bolt.context.say import Say
493+ from slack_bolt.context.say_stream import SayStream
494+ from slack_bolt.context.set_status import SetStatus
495+ from slack_sdk import WebClient
500496
501497from agent import CaseyDeps, run_casey_agent
502498from thread_context import session_store
503499from listeners.views.feedback_builder import build_feedback_blocks
504500
505501
506- async def handle_app_mentioned (
507- client : AsyncWebClient ,
508- context : AsyncBoltContext ,
502+ def handle_app_mentioned (
503+ client : WebClient ,
504+ context : BoltContext ,
509505 event : dict ,
510506 logger : Logger,
511- say : AsyncSay ,
512- say_stream : AsyncSayStream ,
513- set_status : AsyncSetStatus ,
507+ say : Say ,
508+ say_stream : SayStream ,
509+ set_status : SetStatus ,
514510):
515511 """ Handle @Casey mentions in channels."""
516512 try :
@@ -522,22 +518,22 @@ async def handle_app_mentioned(
522518 cleaned_text = re.sub(r " <@[A-Z0-9 ]+ >" , " " , text).strip()
523519
524520 if not cleaned_text:
525- await say(
521+ say(
526522 text = " Hey there! How can I help you? Describe your IT issue and I'll do my best to assist." ,
527523 thread_ts = thread_ts,
528524 )
529525 return
530526
531527 # Add eyes reaction only to the first message (not threaded replies)
532528 if not event.get(" thread_ts" ):
533- await client.reactions_add(
529+ client.reactions_add(
534530 channel = channel_id,
535531 timestamp = event[" ts" ],
536532 name = " eyes" ,
537533 )
538534
539535 # Set assistant thread status with loading messages
540- await set_status(
536+ set_status(
541537 status = " Thinking..." ,
542538 loading_messages = [
543539 " Teaching the hamsters to type faster…" ,
@@ -559,15 +555,15 @@ async def handle_app_mentioned(
559555 thread_ts = thread_ts,
560556 message_ts = event[" ts" ],
561557 )
562- response_text, new_session_id = await run_casey_agent(
558+ response_text, new_session_id = run_casey_agent(
563559 cleaned_text, session_id = existing_session_id, deps = deps
564560 )
565561
566562 # Stream response in thread with feedback buttons
567- streamer = await say_stream()
568- await streamer.append(markdown_text = response_text)
563+ streamer = say_stream()
564+ streamer.append(markdown_text = response_text)
569565 feedback_blocks = build_feedback_blocks()
570- await streamer.stop(blocks = feedback_blocks)
566+ streamer.stop(blocks = feedback_blocks)
571567
572568 # Store session ID for future context
573569 if new_session_id:
0 commit comments