
    cjhi                         d Z ddlmZ ddlmZmZmZ ddlmZm	Z	 ddl
mZmZ ddlmZ ddlmZmZmZ d	Zer$dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lm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.
    )annotations)TYPE_CHECKINGAnyIterator   )Asset
AssetMixin)PartialEmoji	_EmojiTag)User)MISSINGSnowflakeListsnowflake_time)Emoji)datetime)	Snowflake)Guild)Role)ConnectionStatec                      e Zd ZU dZdZded<   ddZddZd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edd       Zed d       Zd!dZddd"dZeedd	 	 	 	 	 	 	 d#dZy)$r   a  Represents a custom emoji.

    Depending on the way this object was created, some attributes can
    have a value of ``None``.

    .. 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:: iter(x)

            Returns an iterator of ``(field, value)`` pairs. This allows this class
            to be used as an iterable in list/dict/etc constructions.

        .. describe:: str(x)

            Returns the emoji rendered for discord.

    Attributes
    ----------
    name: :class:`str`
        The name of the emoji.
    id: :class:`int`
        The emoji's ID.
    require_colons: :class:`bool`
        If colons are required to use this emoji in the client (:PJSalt: vs PJSalt).
    animated: :class:`bool`
        Whether an emoji is animated or not.
    managed: :class:`bool`
        If this emoji is managed by a Twitch integration.
    guild_id: :class:`int`
        The guild ID the emoji belongs to.
    available: :class:`bool`
        Whether the emoji is available for use.
    user: Optional[:class:`User`]
        The user that created the emoji. This can only be retrieved using :meth:`Guild.fetch_emoji` and
        having the :attr:`~Permissions.manage_emojis` permission.
    )
require_colonsanimatedmanagedidname_rolesguild_id_stateuser	availableztuple[str, ...]	__slots__c               V    |j                   | _        || _        | j                  |       y N)r   r   r   
_from_data)selfguildstatedatas       @/var/www/html/venv/lib/python3.12/site-packages/discord/emoji.py__init__zEmoji.__init__n   s     "XX',    c           	        |j                  dd      | _        |j                  dd      | _        t        |d         | _        |d   | _        |j                  dd      | _        |j                  dd      | _        t        t        t        |j                  d	g                   | _
        |j                  d
      }|rt        | j                  |      | _        y d | _        y )Nr   Fr   r   r   r   r    Trolesr   )r'   r(   )getr   r   intr   r   r   r    r   mapr   r   r   r   )r%   emojir   s      r)   r$   zEmoji._from_datas   s    $)II.>$F"YYy%85;'v	#ii
E:$yyd;%23sEIIgr<R3S%Tyy GKDKKd!C	QU	r+   c                Z    t        | j                  | j                  | j                        S )N)r   r   r   )r
   r   r   r   r%   s    r)   _to_partialzEmoji._to_partial~   s    T]]twwOOr+   c              #  l   K   | j                   D ]!  }|d   dk7  st        | |d       }|||f # y w)Nr   _)r!   getattr)r%   attrvalues      r)   __iter__zEmoji.__iter__   sB     NN 	&DAw#~dD1$+%		&s   44	4c                    | j                   rd| j                   d| j                   dS d| j                   d| j                   dS )Nz<a::>z<:)r   r   r   r3   s    r)   __str__zEmoji.__str__   sC    ==1TWWIQ//DII;ay**r+   c           	     p    d| j                    d| j                  d| j                   d| j                   d	S )Nz
<Emoji id=z name=z
 animated=z	 managed=r=   )r   r   r   r   r3   s    r)   __repr__zEmoji.__repr__   s@    77)6$))jyQUQ]Q]P^^_a	
r+   c                X    t        |t              xr | j                  |j                  k(  S r#   )
isinstancer   r   )r%   others     r)   __eq__zEmoji.__eq__   s!    %+C5880CCr+   c                     | j                   dz	  S )N   )r   r3   s    r)   __hash__zEmoji.__hash__   s    ww"}r+   c                ,    t        | j                        S )z)Returns the emoji's creation time in UTC.)r   r   r3   s    r)   
created_atzEmoji.created_at   s     dgg&&r+   c                f    | j                   rdnd}t        j                   d| j                   d| S )zReturns the URL of the emoji.gifpngz/emojis/.)r   r   BASEr   )r%   fmts     r)   urlz	Emoji.url   s0     }}e%**XdggYau55r+   c                    | j                   }|g S |j                  D cg c]*  }| j                  j                  |j                        s)|, c}S c c}w )z{A :class:`list` of roles that is allowed to use this emoji.

        If roles is empty, the emoji is unrestricted.
        )r&   r-   r   hasr   )r%   r&   roles      r)   r-   zEmoji.roles   sB     

=I!&I0HIIIs   *A
Ac                L    | j                   j                  | j                        S )z The guild this emoji belongs to.)r   
_get_guildr   r3   s    r)   r&   zEmoji.guild   s     {{%%dmm44r+   c                    | j                   sy| j                  sy| j                  | j                  j                  j                  c}t	        fd|D              S )zKWhether the bot can use this emoji.

        .. versionadded:: 1.3
        FTc              3  @   K   | ]  }j                  |        y wr#   )rR   ).0role_idmy_roless     r)   	<genexpr>z"Emoji.is_usable.<locals>.<genexpr>   s     DW8<<(Ds   )r    r   r&   meany)r%   emoji_rolesrZ   s     @r)   	is_usablezEmoji.is_usable   sH    
 ~~{{ $TZZ]]-A-AXDDDDr+   Nreasonc                  K   | j                   j                  j                  | j                  j                  | j                  |       d{    y7 w)a  |coro|

        Deletes the custom emoji.

        You must have :attr:`~Permissions.manage_emojis` permission to
        do this.

        Parameters
        ----------
        reason: Optional[:class:`str`]
            The reason for deleting this emoji. Shows up on the audit log.

        Raises
        ------
        Forbidden
            You are not allowed to delete emojis.
        HTTPException
            An error occurred deleting the emoji.
        r`   N)r   httpdelete_custom_emojir&   r   )r%   ra   s     r)   deletezEmoji.delete   sB     * kk22JJMM4776 3 
 	
 	
s   A
AAA)r   r-   ra   c               b  K   i }|t         ur||d<   |t         ur|D cg c]  }|j                   c}|d<   | j                  j                  j	                  | j
                  j                  | j                  ||       d{   }t        | j
                  || j                        S c c}w 7 +w)ah  |coro|

        Edits the custom emoji.

        You must have :attr:`~Permissions.manage_emojis` permission to
        do this.

        .. versionchanged:: 2.0
            The newly updated emoji is returned.

        Parameters
        -----------
        name: :class:`str`
            The new emoji name.
        roles: Optional[List[:class:`~discord.abc.Snowflake`]]
            A list of roles that can use this emoji. An empty list can be passed to make it available to everyone.
        reason: Optional[:class:`str`]
            The reason for editing this emoji. Shows up on the audit log.

        Raises
        -------
        Forbidden
            You are not allowed to edit emojis.
        HTTPException
            An error occurred editing the emoji.

        Returns
        --------
        :class:`Emoji`
            The newly updated emoji.
        r   r-   )payloadra   N)r&   r(   r'   )r   r   r   rc   edit_custom_emojir&   r   )r%   r   r-   ra   rg   rS   r(   s          r)   editz
Emoji.edit   s     N w"GFO49:D:GG[[%%77JJMM477GF 8 
 
 4::DDD  ;
s   B/B(AB/B-,B/)r&   r   r'   r   r(   EmojiPayload)r1   rj   )returnr
   )rk   zIterator[tuple[str, Any]])rk   str)rC   r   rk   bool)rk   r/   )rk   r   )rk   z
list[Role])rk   r   )rk   rm   )ra   
str | Nonerk   None)r   rl   r-   zlist[Snowflake]ra   rn   rk   r   )__name__
__module____qualname____doc__r!   __annotations__r*   r$   r4   r:   r>   r@   rD   rG   propertyrI   rP   r-   r&   r_   re   r   ri    r+   r)   r   r   /   s    /b"I 
	VP&+

D ' ' 6 6
 	J 	J 5 5
E 48 
8 !(!0E 0E 	0E
 0E 
0Er+   r   N) rs   
__future__r   typingr   r   r   assetr   r	   partial_emojir
   r   r   r   utilsr   r   r   __all__r   abcr   r&   r   rS   r   r'   r   types.emojir   rj   rv   r+   r)   <module>r      sP   2 # / / $ 2  9 9
!&2[EIz [Er+   