
    iNt                       d Z ddlmZ ddlZddlmZmZmZmZm	Z	m
Z
mZ ddl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	 e	rddlmZmZmZmZ ddlm Z   G d d          Z! G d de!          Z G d de!          Z" G d de!          Z# G d d          Z$ G d de!          Z%e
ee"e%e#e$f         Z&ed&d             Z'ed'd"            Z'd(d%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.
    )annotationsN)AnyDictListOptionalTYPE_CHECKINGUnionoverload   )Asset)ActivityTypeStatusDisplayTypetry_enumColour)PartialEmoji)_get_as_snowflake)BaseActivityActivity	StreamingGameSpotifyCustomActivity)r   ActivityTimestampsActivityPartyActivityAssets)ConnectionStatec                  >    e Zd ZdZdZddZedd	            ZddZdS )r   a  The base activity that all user-settable activities inherit from.
    A user-settable activity is one that can be used in :meth:`Client.change_presence`.

    The following types currently count as user-settable:

    - :class:`Activity`
    - :class:`Game`
    - :class:`Streaming`
    - :class:`CustomActivity`

    Note that although these types are considered user-settable by the library,
    Discord typically ignores certain combinations of activity depending on
    what is currently set. This behaviour may change in the future so there are
    no guarantees on whether Discord will actually let you set these types.

    .. versionadded:: 1.3
    )_created_atkwargsr   returnNonec                <    |                     dd           | _        d S )N
created_at)popr   )selfr    s     W/home/ubuntu/.hermes/hermes-agent/venv/lib/python3.11/site-packages/discord/activity.py__init__zBaseActivity.__init__{   s    ,2JJ|T,J,J    Optional[datetime.datetime]c                    | j         8t          j                            | j         dz  t          j        j                  S dS )zOptional[:class:`datetime.datetime`]: When the user started doing this activity in UTC.

        .. versionadded:: 1.3
        N  tzr   datetimefromtimestamptimezoneutcr&   s    r'   r$   zBaseActivity.created_at~   ?     '$2243Cd3JxO`Od2eee ('r)   ActivityPayloadc                    t           N)NotImplementedErrorr4   s    r'   to_dictzBaseActivity.to_dict   s    !!r)   Nr    r   r!   r"   r!   r*   )r!   r6   )	__name__
__module____qualname____doc__	__slots__r(   propertyr$   r:    r)   r'   r   r   f   su         $ !IK K K K f f f Xf" " " " " "r)   r   c                       e Zd ZdZdZd f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edd            Zedd            Z xZS )r   a  Represents an activity in Discord.

    This could be an activity such as streaming, playing, listening
    or watching.

    For memory optimisation purposes, some activities are offered in slimmed
    down versions:

    - :class:`Game`
    - :class:`Streaming`

    Attributes
    ------------
    application_id: Optional[:class:`int`]
        The application ID of the game.
    name: Optional[:class:`str`]
        The name of the activity.
    url: Optional[:class:`str`]
        A stream URL that the activity could be doing.
    type: :class:`ActivityType`
        The type of activity currently being done.
    state: Optional[:class:`str`]
        The user's current state. For example, "In Game".
    details: Optional[:class:`str`]
        The detail of the user's current activity.
    platform: Optional[:class:`str`]
        The user's current platform.

        .. versionadded:: 2.4
    timestamps: :class:`dict`
        A dictionary of timestamps. It contains the following optional keys:

        - ``start``: Corresponds to when the user started doing the
          activity in milliseconds since Unix epoch.
        - ``end``: Corresponds to when the user will finish doing the
          activity in milliseconds since Unix epoch.

    assets: :class:`dict`
        A dictionary representing the images and their hover text of an activity.
        It contains the following optional keys:

        - ``large_image``: A string representing the ID for the large image asset.
        - ``large_text``: A string representing the text when hovering over the large image asset.
        - ``large_url``: A string representing the URL of the large image asset.
        - ``small_image``: A string representing the ID for the small image asset.
        - ``small_text``: A string representing the text when hovering over the small image asset.
        - ``small_url``: A string representing the URL of the small image asset.

    party: :class:`dict`
        A dictionary representing the activity party. It contains the following optional keys:

        - ``id``: A string representing the party ID.
        - ``size``: A list of up to two integer elements denoting (current_size, maximum_size).
    buttons: List[:class:`str`]
        A list of strings representing the labels of custom buttons shown in a rich presence.

        .. versionadded:: 2.0

    emoji: Optional[:class:`PartialEmoji`]
        The emoji that belongs to this activity.
    details_url: Optional[:class:`str`]
        A URL that is linked to when clicking on the details text of the activity.

        .. versionadded:: 2.6
    state_url: Optional[:class:`str`]
        A URL that is linked to when clicking on the state text of the activity.

        .. versionadded:: 2.6
    status_display_type: Optional[:class:`StatusDisplayType`]
        Determines which field from the user's status text is displayed
        in the members list.

        .. versionadded:: 2.6
    )statedetails
timestampsplatformassetspartyflagssync_id
session_idtypenameurlapplication_idemojibuttons	state_urldetails_urlstatus_display_typer    r   r!   r"   c                    t                      j        di | |                    dd           | _        |                    dd           | _        |                    di           | _        |                    dd           | _        |                    di           | _        |                    di           | _        t          |d          | _
        |                    dd           | _        |                    d	d           | _        |                    d
d          | _        |                    dd           | _        |                    dd           | _        |                    dg           | _        |                    dd          }t#          |t$                    r|nt'          t$          |          | _        |                    dd           }|t+          j        |          nd | _        |                    dd           | _        |                    dd           | _        |                    dd           }t#          |t4                    r|n|t'          t4          |          nd | _        d S )NrE   rF   rG   rH   rI   rJ   rQ   rO   rP   rK   r   rL   rM   rS   rN   rR   rT   rU   rV   rC   )superr(   r%   rE   rF   rG   rH   rI   rJ   r   rQ   rO   rP   rK   rL   rM   rS   
isinstancer   r   rN   r   	from_dictrR   rT   rU   r   rV   )r&   r    activity_typerR   rV   	__class__s        r'   r(   zActivity.__init__   s&   ""6"""$*JJw$=$=
&,jjD&A&A.4jjr.J.J'-zz*d'C'C&,jj2&>&>$*JJw$;$;
->vGW-X-X#)::fd#;#;	"(**UD"9"9 **Wa00
&,jjD&A&A)/L$)G)G"(**Y";";

62..'|DDoMM(S_anJoJo 		 

7D))NSN_\-CE-J-J-Jei
(.

;(E(E*0**]D*I*I$jj)>EE -/@AA #. +-@AAA 	   r)   strc           	         d| j         fd| j        fd| j        fd| j        fd| j        fd| j        fd| j        fd| j        ff}d	                    d
 |D                       }d| dS )NrN   rO   rP   rH   rF   rQ   rM   rR    c              3      K   | ]	}d |z  V  
dS )z%s=%rNrC   ).0ts     r'   	<genexpr>z$Activity.__repr__.<locals>.<genexpr>  s&      441444444r)   z
<Activity >)	rN   rO   rP   rH   rF   rQ   rM   rR   join)r&   attrsinners      r'   __repr__zActivity.__repr__  s    TYTYDH'%t234?+dj!	
 44e44444$E$$$$r)   Dict[str, Any]c                \   i }| j         D ]D}t          | |d           }|t          |t                    rt	          |          dk    r?|||<   Et          | j                  |d<   | j        r| j                                        |d<   | j	        rt          | j	        j
                  |d<   |S )Nr   rN   rR   rV   )rA   getattrrZ   dictlenintrN   rR   r:   rV   value)r&   retattrrp   s       r'   r:   zActivity.to_dict  s     N 	 	DD$--E}%&& 3u::??CII$)nnF: 	0:--//CL# 	M),T-E-K)L)LC%&
r)   r*   c                    	 | j         d         dz  }t          j                            |t          j        j                  S # t
          $ r Y dS w xY w)zfOptional[:class:`datetime.datetime`]: When the user started doing this activity in UTC, if applicable.startr,   r-   NrG   r0   r1   r2   r3   KeyErrorr&   	timestamps     r'   rt   zActivity.start0  sa    	X047I $229ARAV2WWW  	 	 	44	   A 
AAc                    	 | j         d         dz  }t          j                            |t          j        j                  S # t
          $ r Y dS w xY w)zhOptional[:class:`datetime.datetime`]: When the user will stop doing this activity in UTC, if applicable.endr,   r-   Nru   rw   s     r'   r{   zActivity.end:  sa    	X.5I $229ARAV2WWW  	 	 	44	ry   Optional[str]c                j    	 | j         d         }|                     |          S # t          $ r Y dS w xY w)zhOptional[:class:`str`]: Returns a URL pointing to the large image asset of this activity, if applicable.large_imageNrI   
_image_urlrv   )r&   r~   s     r'   large_image_urlzActivity.large_image_urlD  K    	0+m4K ??;///  	 	 	44	   $ 
22c                j    	 | j         d         }|                     |          S # t          $ r Y dS w xY w)zhOptional[:class:`str`]: Returns a URL pointing to the small image asset of this activity, if applicable.small_imageNr   )r&   r   s     r'   small_image_urlzActivity.small_image_urlN  r   r   imagec                    |                     d          rd|dd           S | j        t          j        d| j         d| dz   S d S )Nzmp:zhttps://media.discordapp.net/   z/app-assets//z.png)
startswithrQ   r   BASE)r&   r   s     r'   r   zActivity._image_urlX  sd    E"" 	Q>59>>> ,: Pt/B P PU P P PPP -,r)   c                8    | j                             dd          S )zaOptional[:class:`str`]: Returns the large image asset hover text of this activity, if applicable.
large_textNrI   getr4   s    r'   large_image_textzActivity.large_image_text^       {|T222r)   c                8    | j                             dd          S )zaOptional[:class:`str`]: Returns the small image asset hover text of this activity, if applicable.
small_textNr   r4   s    r'   small_image_textzActivity.small_image_textc  r   r)   r;   r!   r^   r!   rj   r<   r!   r|   )r   r^   r!   r|   )r=   r>   r?   r@   rA   r(   ri   r:   rB   rt   r{   r   r   r   r   r   __classcell__r]   s   @r'   r   r      sZ       I IVI*"
 "
 "
 "
 "
 "
H% % % %   $ X X X XX X X X XX 0 0 0 X0 0 0 0 X0Q Q Q Q 3 3 3 X3 3 3 3 X3 3 3 3 3r)   r   c                       e Zd ZdZdZd fd	Zedd            Zedd            Zedd            Z	ddZ
ddZddZddZddZd dZ xZS )!r   a"  A slimmed down version of :class:`Activity` that represents a Discord game.

    This is typically displayed via **Playing** on the official Discord client.

    .. container:: operations

        .. describe:: x == y

            Checks if two games are equal.

        .. describe:: x != y

            Checks if two games are not equal.

        .. describe:: hash(x)

            Returns the game's hash.

        .. describe:: str(x)

            Returns the game's name.

    Parameters
    -----------
    name: :class:`str`
        The game's name.

    Attributes
    -----------
    name: :class:`str`
        The game's name.
    platform: Optional[:class:`str`]
        Where the user is playing from (ie. PS5, Xbox).

        .. versionadded:: 2.4

    assets: :class:`dict`
        A dictionary representing the images and their hover text of a game.
        It contains the following optional keys:

        - ``large_image``: A string representing the ID for the large image asset.
        - ``large_text``: A string representing the text when hovering over the large image asset.
        - ``small_image``: A string representing the ID for the small image asset.
        - ``small_text``: A string representing the text when hovering over the small image asset.

        .. versionadded:: 2.4
    )rO   _end_startrH   rI   rO   r^   extrar   r!   r"   c                r    t                      j        di | || _        |                    d          | _        |                    di           pi | _        	 |d         }|                    dd          | _        |                    dd          | _        d S # t          $ r d| _        d| _        Y d S w xY w)NrH   rI   rG   rt   r   r{   rC   )	rY   r(   rO   r   rH   rI   r   r   rv   )r&   rO   r   rG   r]   s       r'   r(   zGame.__init__  s    !!5!!!	',yy'<'<&+ii"&=&=&C	1-2<-@J
 %..!44DK"ua00DIII  	 	 	DKDIIII	s   B B65B6r   c                    t           j        S )z:class:`ActivityType`: Returns the game's type. This is for compatibility with :class:`Activity`.

        It always returns :attr:`ActivityType.playing`.
        )r   playingr4   s    r'   rN   z	Game.type  s     ##r)   r*   c                    | j         r8t          j                            | j         dz  t          j        j                  S dS )zdOptional[:class:`datetime.datetime`]: When the user started playing this game in UTC, if applicable.r,   r-   N)r   r0   r1   r2   r3   r4   s    r'   rt   z
Game.start  s=     ; 	a$224;3E(J[J_2```tr)   c                    | j         r8t          j                            | j         dz  t          j        j                  S dS )zfOptional[:class:`datetime.datetime`]: When the user will stop playing this game in UTC, if applicable.r,   r-   N)r   r0   r1   r2   r3   r4   s    r'   r{   zGame.end  s=     9 	_$2249t3CHYH]2^^^tr)   c                *    t          | j                  S r8   r^   rO   r4   s    r'   __str__zGame.__str__      49~~r)   c                (    d| j         d| j        dS )Nz<Game name=
 platform=re   rO   rH   r4   s    r'   ri   zGame.__repr__  s    FTYFFDMFFFFr)   rj   c                    i }| j         r
| j         |d<   | j        r
| j        |d<   t          j        j        t          | j                  || j        rt          | j                  nd | j        dS )Nrt   r{   )rN   rO   rG   rH   rI   )	r   r   r   r   rp   r^   rO   rH   rI   )r&   rG   s     r'   r:   zGame.to_dict  sy    %'
; 	."&+Jw9 	* $	Ju !(.	NN$.2mEDM***k
 
 	
r)   otherobjectboolc                L    t          |t                    o|j        | j        k    S r8   )rZ   r   rO   r&   r   s     r'   __eq__zGame.__eq__  s     %&&B5:+BBr)   c                .    |                      |           S r8   r   r   s     r'   __ne__zGame.__ne__      ;;u%%%%r)   ro   c                *    t          | j                  S r8   hashrO   r4   s    r'   __hash__zGame.__hash__      DIr)   )rO   r^   r   r   r!   r"   r!   r   r<   r   r   r   r   r!   r   r!   ro   )r=   r>   r?   r@   rA   r(   rB   rN   rt   r{   r   ri   r:   r   r   r   r   r   s   @r'   r   r   i  s0       . .` AI1 1 1 1 1 1 $ $ $ X$    X    X   G G G G
 
 
 
 C C C C& & & &       r)   r   c                       e Zd ZdZdZd fdZedd            ZddZddZ	edd            Z
ddZddZddZd dZ xZS )!r   a!  A slimmed down version of :class:`Activity` that represents a Discord streaming status.

    This is typically displayed via **Streaming** on the official Discord client.

    .. container:: operations

        .. describe:: x == y

            Checks if two streams are equal.

        .. describe:: x != y

            Checks if two streams are not equal.

        .. describe:: hash(x)

            Returns the stream's hash.

        .. describe:: str(x)

            Returns the stream's name.

    Attributes
    -----------
    platform: Optional[:class:`str`]
        Where the user is streaming from (ie. YouTube, Twitch).

        .. versionadded:: 1.3

    name: Optional[:class:`str`]
        The stream's name.
    details: Optional[:class:`str`]
        An alias for :attr:`name`
    game: Optional[:class:`str`]
        The game being streamed.

        .. versionadded:: 1.3

    url: :class:`str`
        The stream's URL.
    assets: :class:`dict`
        A dictionary comprising of similar keys than those in :attr:`Activity.assets`.
    )rH   rO   gamerP   rF   rI   rO   r|   rP   r^   r   r   r!   r"   c               8    t                      j        di | || _        |                    d|          | _        |                    dd           | _        || _        |                    d| j                  | _        |                    di           | _        d S )NrF   rE   rI   rC   )	rY   r(   rH   r%   rO   r   rP   rF   rI   )r&   rO   rP   r   r]   s       r'   r(   zStreaming.__init__  s    !!5!!!'+#(99Y#=#=	#(99Wd#;#;	&+ii	49&E&E&+ii"&=&=r)   r   c                    t           j        S )z:class:`ActivityType`: Returns the game's type. This is for compatibility with :class:`Activity`.

        It always returns :attr:`ActivityType.streaming`.
        )r   	streamingr4   s    r'   rN   zStreaming.type       %%r)   c                *    t          | j                  S r8   r   r4   s    r'   r   zStreaming.__str__!  r   r)   c                (    d| j         d| j        dS )Nz<Streaming name=r   re   r   r4   s    r'   ri   zStreaming.__repr__$  s    K$)KKKKKKr)   c                t    	 | j         d         }|dd         dk    r
|dd         ndS # t          $ r Y dS w xY w)a   Optional[:class:`str`]: If provided, the twitch name of the user streaming.

        This corresponds to the ``large_image`` key of the :attr:`Streaming.assets`
        dictionary if it starts with ``twitch:``. Typically set by the Discord client.
        r~   N   ztwitch:)rI   rv   )r&   rO   s     r'   twitch_namezStreaming.twitch_name'  s]    	?;}-D  $BQBx944488$>  	 	 	44	s   ) 
77rj   c                    t           j        j        t          | j                  t          | j                  | j        d}| j        r
| j        |d<   |S )N)rN   rO   rP   rI   rF   )r   r   rp   r^   rO   rP   rI   rF   )r&   rq   s     r'   r:   zStreaming.to_dict6  sN     *0	NNtx==k	
 
 < 	*!\C	N
r)   r   r   r   c                l    t          |t                    o|j        | j        k    o|j        | j        k    S r8   )rZ   r   rO   rP   r   s     r'   r   zStreaming.__eq__A  s0    %++a
di0GaEIY]YaLaar)   c                .    |                      |           S r8   r   r   s     r'   r   zStreaming.__ne__D  r   r)   ro   c                *    t          | j                  S r8   r   r4   s    r'   r   zStreaming.__hash__G  r   r)   )rO   r|   rP   r^   r   r   r!   r"   r   r   r   r   r   r   )r=   r>   r?   r@   rA   r(   rB   rN   r   ri   r   r:   r   r   r   r   r   s   @r'   r   r     s       * *X II> > > > > > & & & X&   L L L L ? ? ? X?	 	 	 	b b b b& & & &       r)   r   c                     e Zd ZdZdZd+dZed,d	            Zed-d            Zed.d            Z	ed.d            Z
d/dZed0d            Zd1dZd1dZd2dZd0dZd0dZed0d            Zed3d            Zed0d            Zed0d             Zed0d!            Zed0d"            Zed0d#            Zed4d%            Zed4d&            Zed5d(            Zed0d)            Zd*S )6r   a  Represents a Spotify listening activity from Discord. This is a special case of
    :class:`Activity` that makes it easier to work with the Spotify integration.

    .. container:: operations

        .. describe:: x == y

            Checks if two activities are equal.

        .. describe:: x != y

            Checks if two activities are not equal.

        .. describe:: hash(x)

            Returns the activity's hash.

        .. describe:: str(x)

            Returns the string 'Spotify'.
    )_state_details_timestamps_assets_party_sync_id_session_idr   datar   r!   r"   c                   |                     dd          | _        |                     dd          | _        |                     di           | _        |                     di           | _        |                     di           | _        |                     dd          | _        |                     d          | _        |                     d	d           | _        d S )
NrE    rF   rG   rI   rJ   rL   rM   r$   )	r%   r   r   r   r   r   r   r   r   )r&   r   s     r'   r(   zSpotify.__init__d  s    88GR00!XXi44/3xxb/I/I'+xx"'='=%)XXgr%:%:!XXi44*.((<*@*@,0HH\4,H,Hr)   r   c                    t           j        S )z:class:`ActivityType`: Returns the activity's type. This is for compatibility with :class:`Activity`.

        It always returns :attr:`ActivityType.listening`.
        )r   	listeningr4   s    r'   rN   zSpotify.typen  r   r)   r*   c                    | j         8t          j                            | j         dz  t          j        j                  S dS )zuOptional[:class:`datetime.datetime`]: When the user started listening in UTC.

        .. versionadded:: 1.3
        Nr,   r-   r/   r4   s    r'   r$   zSpotify.created_atv  r5   r)   r   c                     t          d          S )z:class:`Colour`: Returns the Spotify integration colour, as a :class:`Colour`.

        There is an alias for this named :attr:`color`iT r   r4   s    r'   colourzSpotify.colour  s    
 hr)   c                    | j         S )z:class:`Colour`: Returns the Spotify integration colour, as a :class:`Colour`.

        There is an alias for this named :attr:`colour`)r   r4   s    r'   colorzSpotify.color  s    
 {r)   rj   c           
     `    dd| j         | j        | j        | j        | j        | j        | j        d	S )N0   r   )	rK   rO   rI   rJ   rL   rM   rG   rF   rE   )r   r   r   r   r   r   r   r4   s    r'   r:   zSpotify.to_dict  s<    l[}**}[

 

 
	
r)   r^   c                    dS )zE:class:`str`: The activity's name. This will always return "Spotify".r   rC   r4   s    r'   rO   zSpotify.name  s	     yr)   r   r   r   c                    t          |t                    o/|j        | j        k    o|j        | j        k    o|j        | j        k    S r8   )rZ   r   r   r   rt   r   s     r'   r   zSpotify.__eq__  sK    ug&& *!T%55*$-/* tz)		
r)   c                .    |                      |           S r8   r   r   s     r'   r   zSpotify.__ne__  r   r)   ro   c                *    t          | j                  S r8   )r   r   r4   s    r'   r   zSpotify.__hash__  s    D$%%%r)   c                    dS )Nr   rC   r4   s    r'   r   zSpotify.__str__  s    yr)   c                8    d| j         d| j        d| j        dS )Nz<Spotify title=z artist=z
 track_id=re   )titleartisttrack_idr4   s    r'   ri   zSpotify.__repr__  s+    bbbt{bbPTP]bbbbr)   c                    | j         S )z1:class:`str`: The title of the song being played.)r   r4   s    r'   r   zSpotify.title       }r)   	List[str]c                6    | j                             d          S )z9List[:class:`str`]: The artists of the song being played.z; )r   splitr4   s    r'   artistszSpotify.artists  s     {  &&&r)   c                    | j         S )z:class:`str`: The artist of the song being played.

        This does not attempt to split the artist information into
        multiple artists. Useful if there's only a single artist.
        )r   r4   s    r'   r   zSpotify.artist  s     {r)   c                8    | j                             dd          S )z>:class:`str`: The album that the song being played belongs to.r   r   r   r   r4   s    r'   albumzSpotify.album  s     |b111r)   c                v    | j                             dd          }|dd         dk    rdS |dd         }d|z   S )z;:class:`str`: The album cover image URL from Spotify's CDN.r~   r   N   zspotify:zhttps://i.scdn.co/image/r   )r&   r~   album_image_ids      r'   album_cover_urlzSpotify.album_cover_url  sK     l&&}b99rr?j((2$QRR)N::r)   c                    | j         S )zA:class:`str`: The track ID used by Spotify to identify this song.)r   r4   s    r'   r   zSpotify.track_id  r   r)   c                    d| j          S )zY:class:`str`: The track URL to listen on Spotify.

        .. versionadded:: 2.0
        zhttps://open.spotify.com/track/)r   r4   s    r'   	track_urlzSpotify.track_url  s     A@@@r)   datetime.datetimec                ~    t           j                             | j        d         dz  t           j        j                  S )zK:class:`datetime.datetime`: When the user started playing this song in UTC.rt   r,   r-   r0   r1   r   r2   r3   r4   s    r'   rt   zSpotify.start  s4      ..t/?/H4/OT\TeTi.jjjr)   c                ~    t           j                             | j        d         dz  t           j        j                  S )zM:class:`datetime.datetime`: When the user will stop playing this song in UTC.r{   r,   r-   r   r4   s    r'   r{   zSpotify.end  s4      ..t/?/F/MRZRcRg.hhhr)   datetime.timedeltac                     | j         | j        z
  S )zC:class:`datetime.timedelta`: The duration of the song being played.)r{   rt   r4   s    r'   durationzSpotify.duration  s     x$*$$r)   c                8    | j                             dd          S )z2:class:`str`: The party ID of the listening party.idr   )r   r   r4   s    r'   party_idzSpotify.party_id  s     {tR(((r)   N)r   r   r!   r"   r   r<   )r!   r   r   r   r   r   )r!   r   )r!   r   )r!   r   )r=   r>   r?   r@   rA   r(   rB   rN   r$   r   r   r:   rO   r   r   r   r   ri   r   r   r   r   r   r   r   rt   r{   r  r  rC   r)   r'   r   r   K  s        , uII I I I & & & X& f f f Xf       X     X
 
 
 
    X
 
 
 
& & & && & & &   c c c c    X ' ' ' X'    X 2 2 2 X2 ; ; ; X;    X A A A XA k k k Xk
 i i i Xi
 % % % X% ) ) ) X) ) )r)   r   c                  v     e Zd ZdZdZddd fdZedd            ZddZddZ	ddZ
d dZd!dZd!dZ xZS )"r   ab  Represents a custom activity from Discord.

    .. container:: operations

        .. describe:: x == y

            Checks if two activities are equal.

        .. describe:: x != y

            Checks if two activities are not equal.

        .. describe:: hash(x)

            Returns the activity's hash.

        .. describe:: str(x)

            Returns the custom status text.

    .. versionadded:: 1.3

    Attributes
    -----------
    name: Optional[:class:`str`]
        The custom activity's name.
    emoji: Optional[:class:`PartialEmoji`]
        The emoji to pass to the activity, if any.
    )rO   rR   rE   N)rR   rO   r|   rR   2Optional[Union[PartialEmoji, Dict[str, Any], str]]r   r   r!   r"   c                   t                      j        di | || _        |                    d|          | _        | j        dk    r| j        | _        |  |	|| _        d S t          |t                    rt          j	        |          | _        d S t          |t                    rt          |          | _        d S t          |t                    r	|| _        d S t          dt          |          d          )NrE   Custom Status)rO   z.Expected str, PartialEmoji, or None, received z	 instead.rC   )rY   r(   rO   r%   rE   rR   rZ   rm   r   r[   r^   	TypeErrorrN   )r&   rO   rR   r   r]   s       r'   r(   zCustomActivity.__init__  s     	!!5!!!#'	$)IIgt$<$<
9''
DI*=DJJJt$$ 	g%/66DJJJs## 	g%5111DJJJ|,, 	gDJJJeTRW[[eeefffr)   r   c                    t           j        S )z:class:`ActivityType`: Returns the activity's type. This is for compatibility with :class:`Activity`.

        It always returns :attr:`ActivityType.custom`.
        )r   customr4   s    r'   rN   zCustomActivity.type.  s     ""r)   rj   c                    | j         | j        k    rt          j        j        | j         dd}nt          j        j        | j         d}| j        r| j                                        |d<   |S )Nr  )rN   rE   rO   )rN   rO   rR   )rO   rE   r   r  rp   rR   r:   )r&   os     r'   r:   zCustomActivity.to_dict6  st    9
""$+1' AA %+1	 A
 : 	.++--AgJr)   r   r   r   c                l    t          |t                    o|j        | j        k    o|j        | j        k    S r8   )rZ   r   rO   rR   r   s     r'   r   zCustomActivity.__eq__G  s2    %00jUZ495LjQVQ\`d`jQjjr)   c                .    |                      |           S r8   r   r   s     r'   r   zCustomActivity.__ne__J  r   r)   ro   c                R    t          | j        t          | j                  f          S r8   )r   rO   r^   rR   r4   s    r'   r   zCustomActivity.__hash__M  s    TYDJ0111r)   r^   c                    | j         r,| j        r| j          d| j         S t          | j                   S t          | j                  S )Nr`   )rR   rO   r^   r4   s    r'   r   zCustomActivity.__str__P  sJ    : 	"y 3*22ty222tz??"ty>>!r)   c                (    d| j         d| j        dS )Nz<CustomActivity name=z emoji=re   )rO   rR   r4   s    r'   ri   zCustomActivity.__repr__X  s    JtyJJ4:JJJJr)   )rO   r|   rR   r  r   r   r!   r"   r   r   r   r   r   )r=   r>   r?   r@   rA   r(   rB   rN   r:   r   r   r   r   ri   r   r   s   @r'   r   r     s        < +I cgg g g g g g g g* # # # X#   "k k k k& & & &2 2 2 2" " " "K K K K K K K Kr)   r   r   r6   rE   r   r!   ActivityTypesc                    d S r8   rC   r   rE   s     r'   create_activityr  _  s    UXUXr)   r"   c                    d S r8   rC   r  s     r'   r  r  c  s    ADr)   Optional[ActivityPayload]Optional[ActivityTypes]c                V   | sd S t          t          |                     dd                    }|t          j        u r d| v sd| v rt	          di | S t          di | S |t          j        u rA	 |                     d          }t          dd|i| }nt# t          $ r t	          di | }Y n\w xY w|t          j
        u rd| v rt          di | S t	          di | S |t          j        u rd| v rd| v rt          di | S t	          di | }t          |j        t                     r||j        _        |S )	NrN   rX   rQ   rM   rO   rP   rL   rC   )r   r   r   r   r   r   r  r%   r   rv   r   r   r   r   rZ   rR   r   r   )r   rE   	game_typerO   rq   s        r'   r  r  g  s    ttxx';';<<IL(((t##|t';';##d###||d||	l)	)	)	488F##D
 !33d3d33CC	  	# 	# 	#""T""CCC	#
 
l,	,	,D==$$t$$$$	l,	,	,d1B1B|W[G[G[#)\** ! 	Js   +B B('B()r   r6   rE   r   r!   r  )r   r"   rE   r   r!   r"   )r   r  rE   r   r!   r  )(r@   
__future__r   r0   typingr   r   r   r   r   r	   r
   assetr   enumsr   r   r   r   r   partial_emojir   utilsr   __all__types.activityr   r6   r   r   r   rE   r   r   r   r   r   r   r  r  rC   r)   r'   <module>r$     s   0 # " " " " "  L L L L L L L L L L L L L L L L L L       < < < < < < < < < <       ' ' ' ' ' ' $ $ $ $ $ $,\  '            '&&&&&"" "" "" "" "" "" "" ""J[3 [3 [3 [3 [3| [3 [3 [3|u u u u u< u u upg g g g g g g gTj) j) j) j) j) j) j) j)ZaK aK aK aK aK\ aK aK aKH hniHI 
 X X X 
 X 
 D D D 
 D     r)   