o
    -˜Žju	  ã                   @   s2   d dl Z d dlmZ d dlmZ G dd„ dƒZdS )é    N)ÚDisconnectHandler)ÚHandlerc                   @   s&   e Zd Z	d
dddddefdd„Zd	S )Ú
AddHandlerr   Úselfzpyrogram.ClientÚhandlerr   Úgroupc                 C   s0   t |tƒr|j| _||fS | j ||¡ ||fS )a'  Register an update handler.

        You can register multiple handlers, but at most one handler within a group will be used for a single update.
        To handle the same update more than once, register your handler using a different group id (lower group id
        == higher priority). This mechanism is explained in greater details at
        :doc:`More on Updates <../../topics/more-on-updates>`.

        Parameters:
            handler (``Handler``):
                The handler to be registered.

            group (``int``, *optional*):
                The group identifier, defaults to 0.

        Returns:
            ``tuple``: A tuple consisting of *(handler, group)*.

        Example:
            .. code-block:: python

                from pyrogram import Client
                from pyrogram.handlers import MessageHandler

                async def hello(client, message):
                    print(message)

                app = Client("my_account")

                app.add_handler(MessageHandler(hello))

                app.run()
        )Ú
isinstancer   ÚcallbackÚdisconnect_handlerÚ
dispatcherÚadd_handler)r   r   r   © r   úc/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/utilities/add_handler.pyr      s
   
%þzAddHandler.add_handlerN)r   )Ú__name__Ú
__module__Ú__qualname__Úintr   r   r   r   r   r      s    ýÿþýr   )ÚpyrogramÚpyrogram.handlersr   Úpyrogram.handlers.handlerr   r   r   r   r   r   Ú<module>   s   