o
    @Mh
                     @   sP   d Z ddlmZmZ G dd dZG dd dZG dd dZG d	d
 d
ZdS )z+
File with all middleware classes, states.
    )StateStatesGroupc                   @   s6   e Zd ZU dZdZeed< dd Zdd Zdd	 Z	d
S )BaseMiddlewarea  
    Base class for middleware.
    Your middlewares should be inherited from this class.

    Set update_sensitive=True if you want to get different updates on
    different functions. For example, if you want to handle pre_process for
    message update, then you will have to create pre_process_message function, and
    so on. Same applies to post_process.

    .. code-block:: python
        :caption: Example of class-based middlewares

        class MyMiddleware(BaseMiddleware):
            def __init__(self):
                self.update_sensitive = True
                self.update_types = ['message', 'edited_message']
            
            async def pre_process_message(self, message, data):
                # only message update here
                pass

            async def post_process_message(self, message, data, exception):
                pass # only message update here for post_process

            async def pre_process_edited_message(self, message, data):
                # only edited_message update here
                pass

            async def post_process_edited_message(self, message, data, exception):
                pass # only edited_message update here for post_process
    Fupdate_sensitivec                 C      d S N selfr   r   S/var/www/html/venv/lib/python3.10/site-packages/telebot/asyncio_handler_backends.py__init__*      zBaseMiddleware.__init__c                       t r   NotImplementedError)r
   messagedatar   r   r   pre_process-      zBaseMiddleware.pre_processc                    r   r   r   )r
   r   r   	exceptionr   r   r   post_process0   r   zBaseMiddleware.post_processN)
__name__
__module____qualname____doc__r   bool__annotations__r   r   r   r   r   r   r   r      s   
  r   c                   @      e Zd ZdZdddZdS )SkipHandlerz
    Class for skipping handlers.
    Just return instance of this class 
    in middleware to skip handler.
    Update will go to post_process,
    but will skip execution of handler.
    returnNc                 C   r   r   r   r	   r   r   r   r   =   r   zSkipHandler.__init__r   Nr   r   r   r   r   r   r   r   r   r   4       r   c                   @   r   )CancelUpdatez
    Class for canceling updates.
    Just return instance of this class 
    in middleware to skip update.
    Update will skip handler and execution
    of post_process in middlewares.
    r   Nc                 C   r   r   r   r	   r   r   r   r   J   r   zCancelUpdate.__init__r    r!   r   r   r   r   r#   A   r"   r#   c                   @   r   )ContinueHandlinga7  
    Class for continue updates in handlers.
    Just return instance of this class 
    in handlers to continue process.
    
    .. code-block:: python3
        :caption: Example of using ContinueHandling

        @bot.message_handler(commands=['start'])
        async def start(message):
            await bot.send_message(message.chat.id, 'Hello World!')
            return ContinueHandling()
        
        @bot.message_handler(commands=['start'])
        async def start2(message):
            await bot.send_message(message.chat.id, 'Hello World2!')
   
    r   Nc                 C   r   r   r   r	   r   r   r   r   a   r   zContinueHandling.__init__r    r!   r   r   r   r   r$   N   s    r$   N)r   telebot.statesr   r   r   r   r#   r$   r   r   r   r   <module>   s    -