B
    f’»d*	  ã               @   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edœdd„ZdS )	Ú
AddHandlerr   zpyrogram.Clientr   )ÚselfÚhandlerÚgroupc             C   s*   t |tƒr|j| _n| 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   ÚcallbackZdisconnect_handlerZ
dispatcherÚadd_handler)r   r   r   © r   úJ/tmp/pip-unpacked-wheel-rcokkf2l/pyrogram/methods/utilities/add_handler.pyr
      s    %

zAddHandler.add_handlerN)r   )Ú__name__Ú
__module__Ú__qualname__Úintr
   r   r   r   r   r      s   r   )ZpyrogramZpyrogram.handlersr   Zpyrogram.handlers.handlerr   r   r   r   r   r   Ú<module>   s   