
    iZ                         d dl Z d dlZd dlZd dlmZmZ d dlmZ d dlm	Z	 d dl
mZmZ d dlmZ  e j        e          Zej                            d          ZesdZ ej        e            G d	 d
e          ZdS )    N)OptionalSequence)extract_json)
Attachment)
JsonObjectJsonValidator)BlockSLACKCLIENT_SKIP_DEPRECATIONzhThis class is no longer actively maintained. Please use a dict object for building message data instead.c            	            e Zd ZdhZdZdddddedeee                  deee	                  de
fd	Z ed
e d          d             Zdef fdZ xZS )Messagetextd   NT)attachmentsblocksmarkdownr   r   r   c                F    || _         |pg | _        |pg | _        || _        dS )a  
        Create a message.

        https://docs.slack.dev/messaging/#message-structure

        Args:
            text: Plain or Slack Markdown-like text to display in the message.
            attachments: A list of Attachment objects to display after the rest of
                the message's content. More than 20 is not recommended, but the actual
                limit is 100
            blocks: A list of Block objects to attach to this message. If
                specified, the 'text' property is ignored (more specifically, it's used
                as a fallback on clients that can't render blocks)
            markdown: Whether to parse markdown into formatting such as
                bold/italics, or leave text completely unmodified.
        N)r   r   r   r   )selfr   r   r   r   s        \/root/projects/butler/venv/lib/python3.11/site-packages/slack_sdk/models/messages/message.py__init__zMessage.__init__   s.    0 	&,"l     z$attachments attribute cannot exceed z itemsc                 N    | j         d u pt          | j                   | j        k    S )N)r   lenattachments_max_length)r   s    r   attachments_lengthzMessage.attachments_length8   s(    4'_3t/?+@+@DD_+__r   returnc                    t                                                      }t          | j                  dk    rt                              d           t          | j                  |d<   t          | j                  |d<   | j	        |d<   |S )Ni@  zDMessages over 40,000 characters are automatically truncated by Slackr   r   mrkdwn)
superto_dictr   r   LOGGERerrorr   r   r   r   )r   json	__class__s     r   r   zMessage.to_dict<   sv    ww  ty>>E!!LL_``` +4+;<<]%dk22XXr   )__name__
__module____qualname__
attributesr   strr   r   r   r	   boolr   r   r   dictr   __classcell__)r#   s   @r   r   r      s        J  7;,0! ! ! ! hz23	!
 %)! ! ! ! !: ]X:PXXXYY` ` ZY`          r   r   )loggingoswarningstypingr   r   slack_sdk.modelsr   slack_sdk.models.attachmentsr   slack_sdk.models.basic_objectsr   r   slack_sdk.models.blocksr	   	getLoggerr$   r    environget	skip_warnmessagewarnr    r   r   <module>r;      s    				  % % % % % % % % ) ) ) ) ) ) 3 3 3 3 3 3        * ) ) ) ) )		8	$	$JNN9::	 {GHM'7 7 7 7 7j 7 7 7 7 7r   