
    i                         d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ  G d de          ZdS )    )OptionalAsyncWebClientAsyncAck)BaseContext)AsyncComplete)	AsyncFail)AsyncRespond)AsyncGetThreadContext)AsyncSaveThreadContext)AsyncSay)AsyncSetStatus)AsyncSetSuggestedPrompts)AsyncSetTitle)create_copyc                      e Zd ZdZddZedd            Zedefd            Zede	fd            Z
edefd            Zedee         fd	            Zedefd
            Zedefd            Zedee         fd            Zedee         fd            Zedee         fd            Zedee         fd            Zedee         fd            ZdS )AsyncBoltContextz4Context object associated with a request from Slack.returnc           	      $   i }|                                  D ]k\  }}|| j        v r|||<   || j        v r	 t          |          }|||<   4# t          $ r+}| j                            d| d| d           Y d }~dd }~ww xY wt          |          S )NzSkipped setting 'zZ' to a copied request for lazy listeners as it's not possible to make a deep copy (error: ))items copyable_standard_property_names$non_copyable_standard_property_namesr   	TypeErrorloggerdebugr   )selfnew_dict	prop_name
prop_valuecopied_valuetes         [/root/projects/butler/venv/lib/python3.11/site-packages/slack_bolt/context/async_context.pyto_copyablezAsyncBoltContext.to_copyable   s    %)ZZ\\ 	 	!IzDAAA&0##dGGG#.z#:#:L*6HY''    K%%RI R RLNR R R       
  )))s   A
B !A;;B AsyncioListenerRunnerc                     | d         S )zSThe properly configured listener_runner that is available for middleware/listeners.listener_runner r   s    r$   r(   z AsyncBoltContext.listener_runner+   s     %&&    c                 @    d| vrt          d          | d<   | d         S )a  The `AsyncWebClient` instance available for this request.

            @app.event("app_mention")
            async def handle_events(context):
                await context.client.chat_postMessage(
                    channel=context.channel_id,
                    text="Thanks!",
                )

            # You can access "client" this way too.
            @app.event("app_mention")
            async def handle_events(client, context):
                await client.chat_postMessage(
                    channel=context.channel_id,
                    text="Thanks!",
                )

        Returns:
            `AsyncWebClient` instance
        clientN)tokenr   r*   s    r$   r-   zAsyncBoltContext.client0   s-    , 4+$777DNH~r+   c                 <    d| vrt                      | d<   | d         S )a  `ack()` function for this request.

            @app.action("button")
            async def handle_button_clicks(context):
                await context.ack()

            # You can access "ack" this way too.
            @app.action("button")
            async def handle_button_clicks(ack):
                await ack()

        Returns:
            Callable `ack()` function
        ackr   r*   s    r$   r0   zAsyncBoltContext.ackJ   s&      "**DKE{r+   c                 b    d| vr$t          | j        | j        | j                  | d<   | d         S )a  `say()` function for this request.

            @app.action("button")
            async def handle_button_clicks(context):
                await context.ack()
                await context.say("Hi!")

            # You can access "ack" this way too.
            @app.action("button")
            async def handle_button_clicks(ack, say):
                await ack()
                await say("Hi!")

        Returns:
            Callable `say()` function
        say)r-   channel	thread_ts)r   r-   
channel_idr4   r*   s    r$   r2   zAsyncBoltContext.say^   s9    $ "$+tZ^ZhiiiDKE{r+   c                 v    d| vr.t          | j        | j        j        | j        j                  | d<   | d         S )a  `respond()` function for this request.

            @app.action("button")
            async def handle_button_clicks(context):
                await context.ack()
                await context.respond("Hi!")

            # You can access "ack" this way too.
            @app.action("button")
            async def handle_button_clicks(ack, respond):
                await ack()
                await respond("Hi!")

        Returns:
            Callable `respond()` function
        respond)response_urlproxyssl)r   r8   r-   r9   r:   r*   s    r$   r7   zAsyncBoltContext.respondt   sH    $ D  *!.k'KO  DO
 Ir+   c                 V    d| vrt          | j        | j                  | d<   | d         S )aS  `complete()` function for this request. Once a custom function's state is set to complete,
        any outputs the function returns will be passed along to the next step of its housing workflow,
        or complete the workflow if the function is the last step in a workflow. Additionally,
        any interactivity handlers associated to a function invocation will no longer be invocable.

            @app.function("reverse")
            async def handle_button_clicks(ack, complete):
                await ack()
                await complete(outputs={"stringReverse":"olleh"})

            @app.function("reverse")
            async def handle_button_clicks(context):
                await context.ack()
                await context.complete(outputs={"stringReverse":"olleh"})

        Returns:
            Callable `complete()` function
        completer-   function_execution_id)r	   r-   r>   r*   s    r$   r<   zAsyncBoltContext.complete   s7    ( T!!,DKW[WqrrrDJr+   c                 V    d| vrt          | j        | j                  | d<   | d         S )a  `fail()` function for this request. Once a custom function's state is set to error,
        its housing workflow will be interrupted and any provided error message will be passed
        on to the end user through SlackBot. Additionally, any interactivity handlers associated
        to a function invocation will no longer be invocable.

            @app.function("reverse")
            async def handle_button_clicks(ack, fail):
                await ack()
                await fail(error="something went wrong")

            @app.function("reverse")
            async def handle_button_clicks(context):
                await context.ack()
                await context.fail(error="something went wrong")

        Returns:
            Callable `fail()` function
        failr=   )r
   r-   r>   r*   s    r$   r@   zAsyncBoltContext.fail   s4    ( $DKtOijjjDLF|r+   c                 ,    |                      d          S )N	set_titlegetr*   s    r$   rB   zAsyncBoltContext.set_title   s    xx$$$r+   c                 ,    |                      d          S )N
set_statusrC   r*   s    r$   rF   zAsyncBoltContext.set_status   s    xx%%%r+   c                 ,    |                      d          S )Nset_suggested_promptsrC   r*   s    r$   rH   z&AsyncBoltContext.set_suggested_prompts   s    xx/000r+   c                 ,    |                      d          S )Nget_thread_contextrC   r*   s    r$   rJ   z#AsyncBoltContext.get_thread_context   s    xx,---r+   c                 ,    |                      d          S )Nsave_thread_contextrC   r*   s    r$   rL   z$AsyncBoltContext.save_thread_context   s    xx-...r+   N)r   r   )r   r&   )__name__
__module____qualname____doc__r%   propertyr(   r   r-   r   r0   r   r2   r   r   r7   r	   r<   r
   r@   r   rB   r   rF   r   rH   r   rJ   r   rL   r)   r+   r$   r   r      s       >>* * * ** ' ' ' X'     X2 X    X& X    X* ,/    X2  -       X . i    X. %8M2 % % % X% &H^4 & & & X& 1x0H'I 1 1 1 X1 .H-B$C . . . X. /X.D%E / / / X/ / /r+   r   N)typingr   slack_sdk.web.async_clientr    slack_bolt.context.ack.async_ackr   slack_bolt.context.base_contextr   *slack_bolt.context.complete.async_completer	   "slack_bolt.context.fail.async_failr
   (slack_bolt.context.respond.async_respondr   >slack_bolt.context.get_thread_context.async_get_thread_contextr   @slack_bolt.context.save_thread_context.async_save_thread_contextr    slack_bolt.context.say.async_sayr   .slack_bolt.context.set_status.async_set_statusr   Dslack_bolt.context.set_suggested_prompts.async_set_suggested_promptsr   ,slack_bolt.context.set_title.async_set_titler   slack_bolt.util.utilsr   r   r)   r+   r$   <module>r`      s?         5 5 5 5 5 5 5 5 5 5 5 5 7 7 7 7 7 7 D D D D D D 8 8 8 8 8 8 A A A A A A ` ` ` ` ` ` c c c c c c 5 5 5 5 5 5 I I I I I I i i i i i i F F F F F F - - - - - -}/ }/ }/ }/ }/{ }/ }/ }/ }/ }/r+   