o
    -˜Žjð  ã                   @   sX   d dl Z d dlmZmZmZ d dlZd dlmZ d dlmZ e  e	¡Z
G dd„ dƒZdS )é    N)ÚUnionÚListÚIterable)Úraw)Útypesc                   @   sF   e Zd Zdddeeef deeee f deded f fdd„Zd	S )
Ú
GetStoriesÚselfzpyrogram.ClientÚchat_idÚ	story_idsÚreturnztypes.Storyc                 ƒ   s°   �ˆ  |¡I dH ‰ t|tƒ }|rt|ƒn|g}tjjjˆ |d�}ˆj|dd�I dH }|r>t	 
‡ ‡fdd„|jD ƒI dH ¡S |jrVt|jƒdkrVt	j ˆ|jd ˆ ¡I dH S dS )a!  Get one or more story from an user by using story identifiers.

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

        Parameters:
            chat_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the target user/channel.
                For your personal story you can simply use "me" or "self".
                For a contact that exists in your Telegram address book you can use his phone number (str).
                You can also use user profile/channel public link in form of *t.me/<username>* (str).

            story_ids (``int`` | Iterable of ``int``):
                Pass a single story identifier or an iterable of story ids (as integers) to get the content of the
                story themselves.

        Returns:
            :obj:`~pyrogram.types.Story` | List of :obj:`~pyrogram.types.Story`: In case *story_ids* was not
            a list, a single story is returned, otherwise a list of stories is returned.

        Example:
            .. code-block:: python

                # Get one story
                await app.get_stories(chat_id, 12345)

                # Get more than one story (list of stories)
                await app.get_stories(chat_id, [12345, 12346])

        Raises:
            ValueError: In case of invalid arguments.
        N)ÚpeerÚidéÿÿÿÿ)Úsleep_thresholdc                 “   s$   �g | ]}t j ˆ|ˆ ¡I d H ‘qS )N)r   ÚStoryÚ_parse)Ú.0Ústory©r   r   © ú_/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/users/get_stories.pyÚ
<listcomp>L   s   €" z*GetStories.get_stories.<locals>.<listcomp>r   )Úresolve_peerÚ
isinstanceÚintÚlistr   Ú	functionsÚstoriesÚGetStoriesByIDÚinvoker   r   Úlenr   r   )r   r	   r
   Úis_iterableÚidsÚrpcÚrr   r   r   Úget_stories   s   €%"4zGetStories.get_storiesN)	Ú__name__Ú
__module__Ú__qualname__r   r   Ústrr   r   r%   r   r   r   r   r      s    ÿ
þýür   )ÚloggingÚtypingr   r   r   Úpyrogramr   r   Ú	getLoggerr&   Úlogr   r   r   r   r   Ú<module>   s   
