
    N[ia                     `    d dl m Z  d dlmZmZmZ d dlZd dlmZmZmZ d dlm	Z	  G d d      Z
y)    )datetime)UnionListOptionalN)rawutilsenums)typesc                   r    e Zd Z	 	 	 	 	 	 	 	 ddddeeef   deded   ded	   d
ededede	deded   ddfdZ
y)SendMessageNselfzpyrogram.Clientchat_idtext
parse_modezenums.ParseModeentitiesztypes.MessageEntitydisable_web_page_previewdisable_notificationreply_to_message_idschedule_dateprotect_contentreply_markup)ztypes.InlineKeyboardMarkupztypes.ReplyKeyboardMarkupztypes.ReplyKeyboardRemoveztypes.ForceReplyreturnztypes.Messagec                 d  K   t        j                  | |||       d{   j                         \  }}| j                  t        j
                  j                  j                  | j                  |       d{   |xs d|xs d|| j                         t        j                  |      |
r|
j                  |        d{   nd|||	
             d{   }t        |t        j                  j                        r	| j                  |       d{   }t        |t        j                  j                        r|j                   n|j"                   }t        j$                  |j&                  t        j(                  |t*        j,                  j.                  |       |t        j0                  |j2                        |j4                  |
|r5|D cg c]#  }t        j6                  j9                  d|i       % c}|       S d|       S |j:                  D ]  }t        |t        j                  j<                  t        j                  j>                  t        j                  j@                  f      s[t        j$                  j9                  | |jB                  |jD                  D ci c]  }|j&                  | c}|jF                  D ci c]  }|j&                  | c}t        t        j                  j@                               d{   c S  y7 7 7 X7 E7 
c c}w c c}w c c}w 7 &w)a  Send text messages.

        .. include:: /_includes/usable-by/users-bots.rst

        Parameters:
            chat_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the target chat.
                For your personal cloud (Saved Messages) you can simply use "me" or "self".
                For a contact that exists in your Telegram address book you can use his phone number (str).

            text (``str``):
                Text of the message to be sent.

            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
                By default, texts are parsed using both Markdown and HTML styles.
                You can combine both syntaxes together.

            entities (List of :obj:`~pyrogram.types.MessageEntity`):
                List of special entities that appear in message text, which can be specified instead of *parse_mode*.

            disable_web_page_preview (``bool``, *optional*):
                Disables link previews for links in this message.

            disable_notification (``bool``, *optional*):
                Sends the message silently.
                Users will receive a notification with no sound.

            reply_to_message_id (``int``, *optional*):
                If the message is a reply, ID of the original message.

            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
                Date when the message will be automatically sent.

            protect_content (``bool``, *optional*):
                Protects the contents of the sent message from forwarding and saving.

            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
                Additional interface options. An object for an inline keyboard, custom reply keyboard,
                instructions to remove reply keyboard or to force a reply from the user.

        Returns:
            :obj:`~pyrogram.types.Message`: On success, the sent text message is returned.

        Example:
            .. code-block:: python

                # Simple example
                await app.send_message("me", "Message sent with **Pyrogram**!")

                # Disable web page previews
                await app.send_message("me", "https://docs.pyrogram.org",
                    disable_web_page_preview=True)

                # Reply to a message using its id
                await app.send_message("me", "this is a reply", reply_to_message_id=123)

            .. code-block:: python

                # For bots only, send messages with keyboards attached

                from pyrogram.types import (
                    ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton)

                # Send a normal keyboard
                await app.send_message(
                    chat_id, "Look at that button!",
                    reply_markup=ReplyKeyboardMarkup([["Nice!"]]))

                # Send an inline keyboard
                await app.send_message(
                    chat_id, "These are inline buttons",
                    reply_markup=InlineKeyboardMarkup(
                        [
                            [InlineKeyboardButton("Data", callback_data="callback_data")],
                            [InlineKeyboardButton("Docs", url="https://docs.pyrogram.org")]
                        ]))
        N)
peer
no_webpagesilentreply_to_msg_id	random_idr   r   messager   
noforwards)idtypeclient)r!   chatr   dateoutgoingr   r   r#   )is_scheduled)$r   parse_text_entitiesvaluesinvoker   	functionsmessagesr   resolve_peerrnd_iddatetime_to_timestampwrite
isinstancer
   UpdateShortSentMessageInputPeerUseruser_idr   Messager!   Chatr	   ChatTypePRIVATEtimestamp_to_datetimer%   outMessageEntity_parseupdatesUpdateNewMessageUpdateNewChannelMessageUpdateNewScheduledMessager   userschats)r   r   r   r   r   r   r   r   r   r   r   r   rr   peer_identityis                    Y/var/www/files/kim/lib/python3.12/site-packages/pyrogram/methods/messages/send_message.pysend_messagezSendMessage.send_message   s    @ $)#<#<T4U]#^^ffh++MM""..,,W553;t+3t 3++-#99-H?K<#5#5d#;;;QU!* / 
 
 a99:**733D dCII$;$;< ll]  ==44ZZ//
 008)  #+ ''..tVR@   $( $  		A!cii88!ii??!iiAAC D #]]11!))&'gg.QTT1W.&'gg.QTT1W.!+Asyy/R/R!S	 2   			Y _ 6 <
  4& /.s   L0LAL06L7AL0>L?L0L=L0LB;L0(L6A7L0.3L0!L$5L0L).L0L.	L0L0L0L0L0L0)NNNNNNNN)__name__
__module____qualname__r   intstrr   r   boolr   rH        rG   r   r      s    
 3704)-%)#'"& $ !UUsCxU U ./	U
 ,-U #'U #U !U  U U 
U" 
#UrP   r   )r   typingr   r   r   pyrogramr   r   r	   r
   r   rO   rP   rG   <module>rS      s(   &  ( (  & & V VrP   