
    i(                        d Z ddlmZ ddlmZmZmZmZmZm	Z	m
Z
 ddlmZmZ ddlmZmZmZ ddlmZmZ ddlmZ dd	l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" ddl#m$Z$ ddl%m&Z& ddl'm'Z'  G d dee          ZdS )a:  
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

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)Any
CollectionIteratorListOptionalTYPE_CHECKINGTuple   )Asset
AssetMixin)SnowflakeListsnowflake_timeMISSING)	_EmojiTagPartialEmoji)User)MissingApplicationID)Object)Emoji)Guild)ConnectionState)	Snowflake)Role)datetimec                      e Zd ZU dZdZded<   d1dZd2dZd3dZd4dZ	d5dZ
d5dZd6dZd6dZd7dZed8d            Zed5d             Zed9d"            Zed:d$            Zd;d%Zd&d'd<d*Zeed&d+d=d/Zd;d0Zd&S )>r   a  Represents a custom emoji.

    Depending on the way this object was created, some of the 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 :attr:`~Permissions.manage_emojis`.

        Or if :meth:`.is_application_owned` is ``True``, this is the team member that uploaded
        the emoji, or the bot user if it was uploaded using the API and this can
        only be retrieved using :meth:`~discord.Client.fetch_application_emoji` or :meth:`~discord.Client.fetch_application_emojis`.
    )
require_colonsanimatedmanagedidname_rolesguild_id_stateuser	availablezTuple[str, ...]	__slots__guildr   stater   dataEmojiPayloadreturnNonec               V    |j         | _        || _        |                     |           d S N)r    r#   r$   
_from_data)selfr(   r)   r*   s       T/home/ubuntu/.hermes/hermes-agent/venv/lib/python3.11/site-packages/discord/emoji.py__init__zEmoji.__init__u   s*    "X',    emojic           	     
   |                     dd          | _        |                     dd          | _        t          |d                   | _        |d         | _        |                     dd          | _        |                     dd          | _        t          t          t          |                     d	g                               | _
        |                     d
          }|rt          | j        |          nd | _        d S )Nr   Fr   r    r!   r   r&   Trolesr%   )r)   r*   )getr   r   intr    r!   r   r&   r   mapr"   r   r$   r%   )r1   r5   r%   s      r2   r0   zEmoji._from_dataz   s    $)II.>$F$F"YYy%885;''v	#ii
E::$yyd;;%23sEIIgr<R<R3S3S%T%Tyy  JN$XDt{$F$F$F$FTX			r4   r   c                D    t          | j        | j        | j                  S )N)r!   r   r    )r   r!   r   r    r1   s    r2   _to_partialzEmoji._to_partial   s    T]twOOOOr4   Iterator[Tuple[str, Any]]c              #  h   K   | j         D ]'}|d         dk    rt          | |d           }|||fV  (d S )Nr   _)r'   getattr)r1   attrvalues      r2   __iter__zEmoji.__iter__   sV      N 	( 	(DAw#~~dD11$-'''		( 	(r4   strc                \    | j         rd| j         d| j         dS d| j         d| j         dS )Nz<a::>z<:)r   r!   r    r<   s    r2   __str__zEmoji.__str__   sF    = 	0///TW////*DI******r4   c           	     H    d| j          d| j        d| j         d| j         d	S )Nz
<Emoji id=z name=z
 animated=z	 managed=rH   )r    r!   r   r   r<   s    r2   __repr__zEmoji.__repr__   s5    iDGii49ii$-iiZ^Zfiiiir4   otherobjectboolc                L    t          |t                    o| j        |j        k    S r/   )
isinstancer   r    r1   rL   s     r2   __eq__zEmoji.__eq__   s     %++C580CCr4   c                .    |                      |           S r/   )rR   rQ   s     r2   __ne__zEmoji.__ne__   s    ;;u%%%%r4   r9   c                    | j         dz	  S )N   r    r<   s    r2   __hash__zEmoji.__hash__   s    w"}r4   r   c                *    t          | j                  S )zE:class:`datetime.datetime`: Returns the emoji's creation time in UTC.)r   r    r<   s    r2   
created_atzEmoji.created_at   s     dg&&&r4   c                J    | j         rdnd}t          j         d| j         d| S )z+:class:`str`: Returns the URL of the emoji.zwebp?animated=truepngz/emojis/.)r   r   BASEr    )r1   ends     r2   urlz	Emoji.url   s6     '+m>""*55dg55555r4   
List[Role]c                @      j         }|g S  fd|j        D             S )zList[:class:`Role`]: A :class:`list` of roles that is allowed to use this emoji.

        If roles is empty, the emoji is unrestricted.
        Nc                R    g | ]#}j                             |j                  !|$S  )r"   hasr    ).0roler1   s     r2   
<listcomp>zEmoji.roles.<locals>.<listcomp>   s.    III0H0HIIIIr4   )r(   r7   )r1   r(   s   ` r2   r7   zEmoji.roles   s2     
=IIIIIIIIIr4   Optional[Guild]c                @    | j                             | j                  S )z0:class:`Guild`: The guild this emoji belongs to.)r$   
_get_guildr#   r<   s    r2   r(   zEmoji.guild   s     {%%dm444r4   c                    | j         r| j        r| j        j        rdS | j        sdS | j        | j        j        j        c}t          fd|D                       S )zZ:class:`bool`: Whether the bot can use this emoji.

        .. versionadded:: 1.3
        FTc              3  B   K   | ]}                     |          V  d S r/   )re   )rf   role_idmy_roless     r2   	<genexpr>z"Emoji.is_usable.<locals>.<genexpr>   s/      DDW8<<((DDDDDDr4   )r&   r(   unavailabler"   meany)r1   emoji_rolesro   s     @r2   	is_usablezEmoji.is_usable   sp    
 ~ 	TZ 	4:3I 	5{ 	4 $TZ]-AXDDDDDDDDDDr4   Nreasonrw   Optional[str]c                 K   |                                  rB| j        j        }|t          | j        j                            || j                   d{V  dS | j        j                            | j        | j        |           d{V  dS )a  |coro|

        Deletes the custom emoji.

        You must have :attr:`~Permissions.manage_emojis` to do this if
        :meth:`.is_application_owned` is ``False``.

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

            This does not apply if :meth:`.is_application_owned` is ``True``.

        Raises
        -------
        Forbidden
            You are not allowed to delete emojis.
        HTTPException
            An error occurred deleting the emoji.
        MissingApplicationID
            The emoji is owned by an application but the application ID is missing.
        Nrv   )	is_application_ownedr$   application_idr   httpdelete_application_emojir    delete_custom_emojir#   )r1   rw   r{   s      r2   deletezEmoji.delete   s      0 $$&& 	![7N%**+";;NDGTTTTTTTTTFk224=$'RX2YYYYYYYYYYYr4   )r!   r7   rw   r!   r7   Collection[Snowflake]c                 K   i }|t           ur||d<   |t           urd |D             |d<   |                                 r|| j        j        }|t          |                    dd           | j        j                            || j        |           d{V }t          t          d          || j                  S | j        j                            | j        | j        ||           d{V }t          | j        || j                  S )	aZ  |coro|

        Edits the custom emoji.

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

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

        Parameters
        -----------
        name: :class:`str`
            The new emoji name.
        roles: 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.

            This does not apply if :meth:`.is_application_owned` is ``True``.

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

            This does not apply if :meth:`.is_application_owned` is ``True``.

        Raises
        -------
        Forbidden
            You are not allowed to edit emojis.
        HTTPException
            An error occurred editing the emoji.
        MissingApplicationID
            The emoji is owned by an application but the application ID is missing

        Returns
        --------
        :class:`Emoji`
            The newly updated emoji.
        r!   c                    g | ]	}|j         
S rd   rW   )rf   rg   s     r2   rh   zEmoji.edit.<locals>.<listcomp>  s    :::D:::r4   r7   N)payloadr   )r(   r*   r)   )r   rw   )r   rz   r$   r{   r   popr|   edit_application_emojir    r   r   edit_custom_emojir#   r(   )r1   r!   r7   rw   r   r{   r*   s          r2   editz
Emoji.edit   s>     R w"GFO::E:::GG$$&& 	H![7N%**KK&&&)@@ A        D
 vayyt4;GGGG[%77twX_hn7oooooooo4:DDDDDr4   c                    | j         dk    S )zd:class:`bool`: Whether the emoji is owned by an application.

        .. versionadded:: 2.5
        r   )r#   r<   s    r2   rz   zEmoji.is_application_owned)  s    
 }!!r4   )r(   r   r)   r   r*   r+   r,   r-   )r5   r+   r,   r-   )r,   r   )r,   r>   )r,   rE   )rL   rM   r,   rN   )r,   r9   )r,   r   )r,   ra   )r,   ri   )r,   rN   )rw   rx   r,   r-   )r!   rE   r7   r   rw   rx   r,   r   )__name__
__module____qualname____doc__r'   __annotations__r3   r0   r=   rD   rI   rK   rR   rT   rX   propertyrZ   r`   r7   r(   ru   r   r   r   rz   rd   r4   r2   r   r   2   s	        3 3j"I       
	Y 	Y 	Y 	YP P P P( ( ( (+ + + +
j j j jD D D D& & & &    ' ' ' X' 6 6 6 X6
 	J 	J 	J X	J 5 5 5 X5
E 
E 
E 
E 7;  Z  Z  Z  Z  Z  ZF %Wfj=E =E =E =E =E =E~" " " " " "r4   r   N)(r   
__future__r   typingr   r   r   r   r   r	   r
   assetr   r   utilsr   r   r   partial_emojir   r   r%   r   errorsr   rM   r   __all__types.emojir   r+   r(   r   r)   r   abcr   rg   r   r   rd   r4   r2   <module>r      s   0 # " " " " " R R R R R R R R R R R R R R R R R R $ $ $ $ $ $ $ $ 9 9 9 9 9 9 9 9 9 9 2 2 2 2 2 2 2 2       ( ( ( ( ( (      
  "222222&&&&&&!!!!!!|" |" |" |" |"Iz |" |" |" |" |"r4   