o
    -˜Žj1  ã                   @   s>   d dl Z d dl mZmZmZ d dlmZmZ G dd„ dƒZdS )é    N)ÚrawÚtypesÚutils)ÚUnionÚListc                   @   sX   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edf fdd„ZdS )ÚSendTodoNFÚselfzpyrogram.ClientÚchat_idÚtitleÚtasksztypes.InputTodoTaskÚentitiesztypes.MessageEntityÚ
can_appendÚcan_completeÚ
parse_modec                 Ã   sT  �t  | |||¡I dH  ¡ \}}g }t|ƒD ]*\}	}
t  | |
j||
j¡I dH  ¡ \}}| tjj	|	d tjj
||p:g d�d�¡ q|  tjjj|  |¡I dH d|  ¡ tjjtjjtjj
||p_g d�|||d�d�d�¡I dH }|jD ]5}	t|	tjjtjjtjjtjjfƒr§tjj| |	jd	d
„ |jD ƒdd
„ |jD ƒt|	tjjƒd�I dH   S qrdS )aï  Send a todo list to a chat.

        Parameters:
            chat_id (``int`` | ``str``):
                Unique identifier for the target chat or username of the target channel.

            title (``str``):
                Title of the todo list.

            tasks (List of :obj:`~pyrogram.types.TodoTask`):
                List of tasks in the todo list.

            entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
                Entities in the title of the todo list.

            can_append (``bool``, *optional*):
                True, if other users can append tasks to this todo list.

            can_complete (``bool``, *optional*):
                True, if other users can complete tasks in this todo list.
        Né   )Útextr   )Úidr
   Ú )r
   ÚlistÚothers_can_appendÚothers_can_complete)Útodo)ÚpeerÚmessageÚ	random_idÚmediac                 S   ó   i | ]}|j |“qS © ©r   ©Ú.0Úir   r   ú`/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/messages/send_todo.pyÚ
<dictcomp>`   ó    z&SendTodo.send_todo.<locals>.<dictcomp>c                 S   r   r   r   r   r   r   r"   r#   a   r$   )Úis_scheduled)r   Úparse_text_entitiesÚvaluesÚ	enumerater
   r   Úappendr   r   ÚTodoItemÚTextWithEntitiesÚinvokeÚ	functionsÚmessagesÚ	SendMediaÚresolve_peerÚrnd_idÚInputMediaTodoÚTodoListÚupdatesÚ
isinstanceÚUpdateNewMessageÚUpdateNewChannelMessageÚUpdateNewScheduledMessageÚUpdateBotNewBusinessMessageÚMessageÚ_parser   ÚusersÚchats)r   r	   r
   r   r   r   r   r   Ú
tasks_listr!   ÚtaskÚ
task_titleÚtask_entitiesÚrr   r   r"   Ú	send_todo   s\   €"þþÿ
þùÿü
ÿ

ýüüÿzSendTodo.send_todo)NFFN)	Ú__name__Ú
__module__Ú__qualname__r   ÚintÚstrr   ÚboolrC   r   r   r   r"   r      s,    øÿ
þýüûúù
ør   )Úpyrogramr   r   r   Útypingr   r   r   r   r   r   r"   Ú<module>   s   