
    iZ(                    $   d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZmZ ddlmZ dd	lmZ dd
lmZmZ er(ddlZddlmZmZ ddlmZmZmZ ddlmZ ddlm Z  ddl!m"Z" dZ# G d de	e          Z G d de          Z G d d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)TYPE_CHECKINGOptional   )utils)Hashable)PartialEmoji	_EmojiTag)User)MISSING)Asset
AssetMixinN)DictAny)BaseSoundboardSoundSoundboardDefaultSoundSoundboardSound)ConnectionState)Guild)EmojiInputTypec                  N    e Zd ZdZdZddZddZddZddZe	dd            Z
dS )r   a  Represents a generic Discord soundboard sound.

    .. versionadded:: 2.5

    .. container:: operations

        .. describe:: x == y

            Checks if two sounds are equal.

        .. describe:: x != y

            Checks if two sounds are not equal.

        .. describe:: hash(x)

            Returns the sound's hash.

    Attributes
    ------------
    id: :class:`int`
        The ID of the sound.
    volume: :class:`float`
        The volume of the sound as floating point percentage (e.g. ``1.0`` for 100%).
    )_stateidvolumestater   dataBaseSoundboardSoundPayloadc               r    || _         t          |d                   | _        |                     |           d S )Nsound_id)r   intr   _update)selfr   r   s      Y/home/ubuntu/.hermes/hermes-agent/venv/lib/python3.11/site-packages/discord/soundboard.py__init__zBaseSoundboardSound.__init__Q   s5    ',4
+,,T    otherobjectreturnboolc                Z    t          || j                  r| j        |j        k    S t          S N)
isinstance	__class__r   NotImplementedr"   r&   s     r#   __eq__zBaseSoundboardSound.__eq__V   s+    eT^,, 	'7eh&&r%   c                .    |                      |           S r+   )r0   r/   s     r#   __ne__zBaseSoundboardSound.__ne__[   s    ;;u%%%%r%   c                     |d         | _         d S )Nr   )r   )r"   r   s     r#   r!   zBaseSoundboardSound._update^   s    !(^r%   strc                .    t           j         d| j         S )z+:class:`str`: Returns the URL of the sound.z/soundboard-sounds/)r   BASEr   r"   s    r#   urlzBaseSoundboardSound.urla   s     *:::::r%   N)r   r   r   r   )r&   r'   r(   r)   )r   r   r(   r4   )__name__
__module____qualname____doc__	__slots__r$   r0   r2   r!   propertyr8    r%   r#   r   r   4   s         4 +I   
   
& & & &, , , , ; ; ; X; ; ;r%   r   c                  0     e Zd ZdZdZd fdZdd
Z xZS )r   a  Represents a Discord soundboard default sound.

    .. versionadded:: 2.5

    .. container:: operations

        .. describe:: x == y

            Checks if two sounds are equal.

        .. describe:: x != y

            Checks if two sounds are not equal.

        .. describe:: hash(x)

            Returns the sound's hash.

    Attributes
    ------------
    id: :class:`int`
        The ID of the sound.
    volume: :class:`float`
        The volume of the sound as floating point percentage (e.g. ``1.0`` for 100%).
    name: :class:`str`
        The name of the sound.
    emoji: :class:`PartialEmoji`
        The emoji of the sound.
    )nameemojir   r   r   SoundboardDefaultSoundPayloadc                   |d         | _         t          |d                   | _        t                                          ||           d S )NrB   
emoji_name)rB   r   r   )rB   r	   rC   superr$   )r"   r   r   r-   s      r#   r$   zSoundboardDefaultSound.__init__   sH    f	#/T,5G#H#H#H
u400000r%   r(   r4   c                    d| j         fd| j        fd| j        fd| j        fg}d                    d |D                       }d| j        j         d| dS )	Nr   rB   r   rC    c              3      K   | ]	}d |z  V  
dS z%s=%rNr@   .0ts     r#   	<genexpr>z2SoundboardDefaultSound.__repr__.<locals>.<genexpr>   &      441444444r%   <>)r   rB   r   rC   joinr-   r:   r"   attrsinners      r#   __repr__zSoundboardDefaultSound.__repr__   sp    47OTYt{#dj!	
 44e4444454>*55U5555r%   )r   r   r   rD   r9   )r:   r;   r<   r=   r>   r$   rX   __classcell__r-   s   @r#   r   r   g   sb         < "I1 1 1 1 1 1
6 6 6 6 6 6 6 6r%   r   c                       e Zd ZdZdZd fd	Zd dZd! fdZed"d            Z	ed#d            Z
eeeddd$dZddd%dZ xZS )&r   aA  Represents a Discord soundboard sound.

    .. versionadded:: 2.5

    .. container:: operations

        .. describe:: x == y

            Checks if two sounds are equal.

        .. describe:: x != y

            Checks if two sounds are not equal.

        .. describe:: hash(x)

            Returns the sound's hash.

    Attributes
    ------------
    id: :class:`int`
        The ID of the sound.
    volume: :class:`float`
        The volume of the sound as floating point percentage (e.g. ``1.0`` for 100%).
    name: :class:`str`
        The name of the sound.
    emoji: Optional[:class:`PartialEmoji`]
        The emoji of the sound. ``None`` if no emoji is set.
    guild: :class:`Guild`
        The guild in which the sound is uploaded.
    available: :class:`bool`
        Whether this sound is available for use.
    )r   rB   rC   _user	available_user_idguildr_   r   r   r   r   SoundboardSoundPayloadc                   t                                          ||           || _        t          j        |d          | _        |                    d          | _        |                     |           d S )NrG   user_iduser)	rH   r$   r_   r   _get_as_snowflaker^   getr\   r!   )r"   r_   r   r   r-   s       r#   r$   zSoundboardSound.__init__   sf    u4000
/i@@XXf%%
Tr%   r(   r4   c                    d| j         fd| j        fd| j        fd| j        fd| j        fg}d                    d |D                       }d| j        j         d| d	S )
Nr   rB   r   rC   rc   rJ   c              3      K   | ]	}d |z  V  
dS rL   r@   rM   s     r#   rP   z+SoundboardSound.__repr__.<locals>.<genexpr>   rQ   r%   rR   rS   )r   rB   r   rC   rc   rT   r-   r:   rU   s      r#   rX   zSoundboardSound.__repr__   sz    47OTYt{#dj!TY
 44e4444454>*55U5555r%   c                    t                                          |           |d         | _        d | _        t	          j        |d          }|d         }||t          ||          | _        |d         | _        d S )NrB   emoji_idrF   )r   rB   r]   )rH   r!   rB   rC   r   rd   r	   r]   )r"   r   ri   rF   r-   s       r#   r!   zSoundboardSound._update   sv    f	-1
*4<<,'
:#9%
CCCDJ#K0r%   datetime.datetimec                4    t          j        | j                  S )zI:class:`datetime.datetime`: Returns the snowflake's creation time in UTC.)r   snowflake_timer   r7   s    r#   
created_atzSoundboardSound.created_at   s     #DG,,,r%   Optional[User]c                    | j         (| j        dS | j                            | j                  S t	          | j        | j                   S )z9Optional[:class:`User`]: The user who uploaded the sound.NrG   )r\   r^   r   get_userr   r7   s    r#   rc   zSoundboardSound.user   sH     :}$t;''666$+DJ7777r%   N)rB   r   rC   reasonrB   r   Optional[float]rC   Optional[EmojiInputType]rq   Optional[str]c                 K   i }|t           ur||d<   |t           ur||d<   |t           ur|d|d<   d|d<   ntt          |t                    r|                                }n,t          |t                    rt          j        |          }nd}||j        |j        |d<   n
|j        |d<    | j	        j
        j        | j        j        | j        fd|i| d{V }t          | j        | j	        |          S )a>  |coro|

        Edits the soundboard sound.

        You must have :attr:`~Permissions.manage_expressions` to edit the sound.
        If the sound was created by the client, you must have either :attr:`~Permissions.manage_expressions`
        or :attr:`~Permissions.create_expressions`.

        Parameters
        ----------
        name: :class:`str`
            The new name of the sound. Must be between 2 and 32 characters.
        volume: Optional[:class:`float`]
            The new volume of the sound. Must be between 0 and 1.
        emoji: Optional[Union[:class:`Emoji`, :class:`PartialEmoji`, :class:`str`]]
            The new emoji of the sound.
        reason: Optional[:class:`str`]
            The reason for editing this sound. Shows up on the audit log.

        Raises
        -------
        Forbidden
            You do not have permissions to edit the soundboard sound.
        HTTPException
            Editing the soundboard sound failed.

        Returns
        -------
        :class:`SoundboardSound`
            The newly updated soundboard sound.
        rB   r   Nri   rF   rq   )r_   r   r   )r   r,   r
   _to_partialr4   r	   from_strr   rB   r   httpedit_soundboard_soundr_   r   )r"   rB   r   rC   rq   payloadpartial_emojir   s           r#   editzSoundboardSound.edit   s1     P #%w"GFO   &GH}&*
#(,%%eY// )$)$5$5$7$7MMs++ )$0$9%$@$@MM$(M ,$'/0=0B--.;.>
+;T[%;DJM47mm[amelmmmmmmmmTZt{NNNNr%   rq   Nonec               x   K   | j         j                            | j        j        | j        |           d{V  dS )a  |coro|

        Deletes the soundboard sound.

        You must have :attr:`~Permissions.manage_expressions` to delete the sound.
        If the sound was created by the client, you must have either :attr:`~Permissions.manage_expressions`
        or :attr:`~Permissions.create_expressions`.

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

        Raises
        -------
        Forbidden
            You do not have permissions to delete the soundboard sound.
        HTTPException
            Deleting the soundboard sound failed.
        r}   N)r   rx   delete_soundboard_soundr_   r   )r"   rq   s     r#   deletezSoundboardSound.delete0  sG      * k66tz}dgV\6]]]]]]]]]]]r%   )r_   r   r   r   r   r`   r9   )r   r`   )r(   rj   )r(   rn   )rB   r4   r   rr   rC   rs   rq   rt   )rq   rt   r(   r~   )r:   r;   r<   r=   r>   r$   rX   r!   r?   rm   rc   r   r|   r   rY   rZ   s   @r#   r   r      s(          D WI     	6 	6 	6 	61 1 1 1 1 1 - - - X- 8 8 8 X8 ")*1 $CO CO CO CO CO COJ 7; ^ ^ ^ ^ ^ ^ ^ ^ ^ ^r%   r   )$r=   
__future__r   typingr   r    r   mixinsr   r{   r	   r
   rc   r   r   assetr   r   datetimer   r   types.soundboardr   r   r   rD   r   r`   r   r   r_   r   messager   __all__r@   r%   r#   <module>r      s   0 # " " " " " * * * * * * * *             2 2 2 2 2 2 2 2             $ $ $ $ $ $ $ $ (OOO                 
 '&&&&&''''''
N0; 0; 0; 0; 0;(J 0; 0; 0;f.6 .6 .6 .6 .60 .6 .6 .6bm^ m^ m^ m^ m^) m^ m^ m^ m^ m^r%   