
    cjh                        d Z ddlmZ ddlZddlmZmZmZmZ ddl	m
Z
 ddlmZmZ ddlmZ d	Zerdd
lmZ ddlmZ dd	lmZ  G d d      Z edd      Z G d dee      Zy)ae  
The MIT License (MIT)

Copyright (c) 2015-2021 Rapptz
Copyright (c) 2021-present Pycord Development

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
    )annotationsN)TYPE_CHECKINGAny	TypedDictTypeVar   )utils)Asset
AssetMixin)InvalidArgument)PartialEmoji)datetime)ConnectionStatec                  $    e Zd ZU dZded<   ddZy)	_EmojiTag intidc                    t         N)NotImplementedErrorselfs    H/var/www/html/venv/lib/python3.12/site-packages/discord/partial_emoji.py_to_partialz_EmojiTag._to_partial1   s    !!    Nreturnr   )__name__
__module____qualname__	__slots____annotations__r   r   r   r   r   r   ,   s    IG"r   r   PEr   )boundc                  @    e Zd ZU dZdZ ej                  d      Zerde	d<   ddd	 	 	 	 	 dd	Z
edd
       Zedd       ZddZddZ	 	 ddZeddd	 	 	 	 	 	 	 	 	 	 	 d d       Zd!dZd Zd"dZd#dZd$dZd$dZd!dZed%d       Zed!d       Zd& fdZ xZS )'r   a  Represents a "partial" emoji.

    This model will be given in two scenarios:

    - "Raw" data events such as :func:`on_raw_reaction_add`
    - Custom emoji that the bot cannot see from e.g. :attr:`Message.reactions`

    .. container:: operations

        .. describe:: x == y

            Checks if two emoji are the same.

        .. describe:: x != y

            Checks if two emoji are not the same.

        .. describe:: hash(x)

            Return the emoji's hash.

        .. describe:: str(x)

            Returns the emoji rendered for discord.

    Attributes
    ----------
    name: Optional[:class:`str`]
        The custom emoji name, if applicable, or the unicode codepoint
        of the non-custom emoji. This can be ``None`` if the emoji
        got deleted (e.g. removing a reaction with a deleted emoji).
    animated: :class:`bool`
        Whether the emoji is animated or not.
    id: Optional[:class:`int`]
        The ID of the custom emoji, if applicable.
    animatednamer   _statez8<?(?P<animated>a)?:?(?P<name>\w+):(?P<id>[0-9]{13,20})>?
int | Noner   FN)r(   r   c               <    || _         || _        || _        d | _        y r   r'   )r   r)   r(   r   s       r   __init__zPartialEmoji.__init__g   s      !	.2r   c                     | |j                  dd      t        j                  |d      |j                  d      xs d      S )Nr(   Fr   r)    )r(   r   r)   )getr	   _get_as_snowflake)clsdatas     r   	from_dictzPartialEmoji.from_dicto   s>    XXj%0&&tT2&!'R
 	
r   c                    | j                   j                  |      }|<|j                         }t        |d         }t	        |d         }|d   } | |||      S  | |dd      S )a2  Converts a Discord string representation of an emoji to a :class:`PartialEmoji`.

        The formats accepted are:

        - ``a:name:id``
        - ``<a:name:id>``
        - ``name:id``
        - ``<:name:id>``

        If the format does not match then it is assumed to be a unicode emoji.

        .. versionadded:: 2.0

        Parameters
        ----------
        value: :class:`str`
            The string representation of an emoji.

        Returns
        -------
        :class:`PartialEmoji`
            The partial emoji from this string.
        Nr(   r   r)   r)   r(   r   Fr)   r   r(   )_CUSTOM_EMOJI_REmatch	groupdictboolr   )r2   valuer9   groupsr(   emoji_idr)   s          r   from_strzPartialEmoji.from_strw   sp    2 $$**51__&FF:./H6$<(H&>DD8AA$77r   c                    d| j                   i}| j                  r| j                  |d<   | j                  r| j                  |d<   |S )Nr)   r   r(   r7   )r   os     r   to_dictzPartialEmoji.to_dict   s=    #TYY/77ggAdG== MMAjMr   c                    | S r   r   r   s    r   r   zPartialEmoji._to_partial   s    r   c                V    | j                   d | j                  dS | j                   d dS )N)r>   
emoji_namer   r)   r   s    r   _to_forum_reaction_payloadz'PartialEmoji._to_forum_reaction_payload   s+    
 77? $DII>> $t<<r   c               *     | |||      }||_         |S )Nr6   )r*   )r2   stater)   r(   r   r   s         r   
with_statezPartialEmoji.with_state   s     xB7r   c                    | j                   xs d}| j                  |S | j                  rdnd}d| d| d| j                   dS )N_ar/   <:>r7   )r   r)   animated_tags      r   __str__zPartialEmoji.__str__   sJ    yyC77?K"mms<.$q	33r   c           	         d| j                   j                   d| j                   d| j                  d| j                   d	S )NrN   z
 animated=z name=z id=rP   )	__class__r   r(   r)   r   r   s    r   __repr__zPartialEmoji.__repr__   s@    4>>**+:dmm_F499-W[\`\c\c[ddeffr   c                    | j                         r+t        |t              xr | j                  |j                  k(  S t        |t              r| j
                  |j
                  k(  S y)NF)is_unicode_emoji
isinstancer   r)   r   r   )r   others     r   __eq__zPartialEmoji.__eq__   sM      "e\2NtyyEJJ7NNeY'77ehh&&r   c                D    t        | j                  | j                  f      S r   )hashr   r)   r   s    r   __hash__zPartialEmoji.__hash__   s    TWWdii())r   c                    | j                   duS )z-Checks if this is a custom non-Unicode emoji.Nr   r   s    r   is_custom_emojizPartialEmoji.is_custom_emoji   s    wwd""r   c                    | j                   du S )z"Checks if this is a Unicode emoji.Nr_   r   s    r   rW   zPartialEmoji.is_unicode_emoji   s    ww$r   c                h    | j                   | j                  S | j                   d| j                    S )NrO   rF   r   s    r   _as_reactionzPartialEmoji._as_reaction   s.    77?99))AdggY''r   c                Z    | j                   yt        j                  | j                         S )zkReturns the emoji's creation time in UTC, or None if Unicode emoji.

        .. versionadded:: 1.6
        N)r   r	   snowflake_timer   s    r   
created_atzPartialEmoji.created_at   s%     77?##DGG,,r   c                    | j                         ry| j                  rdnd}t        j                   d| j                   d| S )z~Returns the URL of the emoji, if it is custom.

        If this isn't a custom emoji then an empty string is returned
        r/   gifpngz/emojis/.)rW   r(   r
   BASEr   )r   fmts     r   urlzPartialEmoji.url   s?       "}}e%**XdggYau55r   c                r   K   | j                         rt        d      t        |           d {   S 7 w)Nz"PartialEmoji is not a custom emoji)rW   r   superread)r   rT   s    r   rp   zPartialEmoji.read   s1       "!"FGGW\^###s   -757)r)   z
str | Noner(   r;   r   r+   )r2   type[PE]r3   z$PartialEmojiPayload | dict[str, Any]r   r$   )r2   rq   r<   strr   r$   )r   zdict[str, Any]r   )r   zTypedDict('ReactionPayload', {'emoji_id': int, 'emoji_name': None}) | TypedDict('ReactionPayload', {'emoji_id': None, 'emoji_name': str}))r2   rq   rI   r   r)   rr   r(   r;   r   r+   r   r$   )r   rr   )rY   r   r   r;   )r   r   )r   r;   )r   zdatetime | None)r   bytes)r   r    r!   __doc__r"   recompiler8   r   r#   r-   classmethodr4   r?   rB   r   rG   rJ   rR   rU   rZ   r]   r`   rW   rc   propertyrf   rm   rp   __classcell__)rT   s   @r   r   r   8   s?   #J 5I!rzzC  5:D3!3-13?I3 
 
  8  8D=
L=  


 	

 
 
 

 
4g*#(
 - - 	6 	6$ $r   )rt   
__future__r   ru   typingr   r   r   r   r/   r	   assetr
   r   errorsr   __all__r   rI   r   types.messager   PartialEmojiPayloadr   r$   r   r   r   <module>r      sZ   2 # 	 9 9  $ #
!&B" " T(B$9j B$r   