
    ic                    *   d Z ddlmZ ddlmZmZmZ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 er(dd
lmZmZ ddlmZ ddlmZmZmZmZmZ ddl m!Z! ddl"m#Z# dZ$ G d d          Z G d d          Z G d d          Z% G 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.
    )annotations)ListTYPE_CHECKINGLiteralOptional   )utils)Asset)ApplicationFlags)Permissions)MISSING)DictAny)Guild)AppInfoPartialAppInfoTeamInstallParamsAppIntegrationTypeConfig)User)ConnectionState)r   r   AppInstallParamsIntegrationTypeConfigc                      e Zd ZdZdZd,dZd-d
Zed.d            Zed.d            Z	ed/d            Z
ed0d            Zed1d            Zed1d            Zeeeeeeeeeeeeeeedd2d*Zd+S )3r   a  Represents the application info for the bot provided by Discord.


    Attributes
    -------------
    id: :class:`int`
        The application ID.
    name: :class:`str`
        The application name.
    owner: :class:`User`
        The application owner.
    team: Optional[:class:`Team`]
        The application's team.

        .. versionadded:: 1.3

    description: :class:`str`
        The application description.
    bot_public: :class:`bool`
        Whether the bot can be invited by anyone or if it is locked
        to the application owner.
    bot_require_code_grant: :class:`bool`
        Whether the bot requires the completion of the full oauth2 code
        grant flow to join.
    rpc_origins: Optional[List[:class:`str`]]
        A list of RPC origin URLs, if RPC is enabled.

    verify_key: :class:`str`
        The hex encoded key for verification in interactions and the
        GameSDK's :ddocs:`GetTicket <game-sdk/applications#getticket>`.

        .. versionadded:: 1.3

    guild_id: Optional[:class:`int`]
        If this application is a game sold on Discord,
        this field will be the guild to which it has been linked to.

        .. versionadded:: 1.3

    primary_sku_id: Optional[:class:`int`]
        If this application is a game sold on Discord,
        this field will be the id of the "Game SKU" that is created,
        if it exists.

        .. versionadded:: 1.3

    slug: Optional[:class:`str`]
        If this application is a game sold on Discord,
        this field will be the URL slug that links to the store page.

        .. versionadded:: 1.3

    terms_of_service_url: Optional[:class:`str`]
        The application's terms of service URL, if set.

        .. versionadded:: 2.0

    privacy_policy_url: Optional[:class:`str`]
        The application's privacy policy URL, if set.

        .. versionadded:: 2.0

    tags: List[:class:`str`]
        The list of tags describing the functionality of the application.

        .. versionadded:: 2.0

    custom_install_url: List[:class:`str`]
        The custom authorization URL for the application, if enabled.

        .. versionadded:: 2.0

    install_params: Optional[:class:`AppInstallParams`]
        The settings for custom authorization URL of application, if enabled.

        .. versionadded:: 2.0
    role_connections_verification_url: Optional[:class:`str`]
        The application's connection verification URL which will render the application as
        a verification method in the guild's role verification configuration.

        .. versionadded:: 2.2
    interactions_endpoint_url: Optional[:class:`str`]
        The interactions endpoint url of the application to receive interactions over this endpoint rather than
        over the gateway, if configured.

        .. versionadded:: 2.4
    redirect_uris: List[:class:`str`]
        A list of authentication redirect URIs.

        .. versionadded:: 2.4
    approximate_guild_count: :class:`int`
        The approximate count of the guilds the bot was added to.

        .. versionadded:: 2.4
    approximate_user_install_count: Optional[:class:`int`]
        The approximate count of the user-level installations the bot has.

        .. versionadded:: 2.5
    )_statedescriptionidnamerpc_origins
bot_publicbot_require_code_grantowner_icon
verify_keyteamguild_idprimary_sku_idslug_cover_image_flagsterms_of_service_urlprivacy_policy_urltagscustom_install_urlinstall_params!role_connections_verification_urlinteractions_endpoint_urlredirect_urisapproximate_guild_countapproximate_user_install_count_integration_types_configstater   dataAppInfoPayloadc                (   ddl m} || _        t          |d                   | _        |d         | _        |d         | _        |d         | _        |                    d          | _	        |d         | _
        |d	         | _        |                    |d
                   | _        |                    d          }|r |||          nd | _         |d         | _        t          j        |d          | _        t          j        |d          | _        |                    d          | _        |                    dd          | _        |                    d          | _        |                    d          | _        |                    d          | _        |                    dg           | _        |                    d          | _        |                    d          | _        |                    d          }|rt7          |          nd | _        |                    d          | _        |                    dg           | _        |                    dd          | _        |                    d          | _         |                    di           | _!        d S )Nr   )r   r   r   r   iconr   r    r!   r"   r%   r$   r&   r'   r(   flagsr   cover_imager+   r,   r-   r.   r0   r/   r1   r2   r3   r4   integration_types_config)"r%   r   r   intr   r   r   r#   getr   r    r!   create_userr"   r$   r	   _get_as_snowflaker&   r'   r(   r*   r)   r+   r,   r-   r.   r0   r   r/   r1   r2   r3   r4   r5   )selfr6   r7   r   r%   paramss         V/home/ubuntu/.hermes/hermes-agent/venv/lib/python3.11/site-packages/discord/appinfo.py__init__zAppInfo.__init__   sJ   ',4:f	 $] 3$(L
040G0G $\ 2,01I,J# ,,T'];;
&*hhv&6&69=$GDD$5$5$54	#L1','>tZ'P'P-2-DTK[-\-\#'88F#3#3	88GQ//+/88M+B+B3788<R3S3S!15:N1O1O#xx33	15:N1O1O@DIl@m@m.*++V\:f:J6:R:R:Rbf8<A\8]8]&(,"(E(E,0HH5NPQ,R,R$=AXXFf=g=g+cgckck&d
 d
&&&    returnstrc                r    d| j         j         d| j         d| j        d| j        d| j         d| j        dS )N< id= name= description=z public=z owner=>)	__class____name__r   r   r   r    r"   rB   s    rD   __repr__zAppInfo.__repr__   sl    %' % %TW % %DI % %+% %7;% %Z% % %	
rF   Optional[Asset]c                b    | j         dS t          j        | j        | j        | j         d          S zJOptional[:class:`.Asset`]: Retrieves the application's icon asset, if any.Napp)pathr#   r
   
_from_iconr   r   rQ   s    rD   r:   zAppInfo.icon   1     :4TWdjuMMMMrF   c                ^    | j         dS t          j        | j        | j        | j                   S )zOptional[:class:`.Asset`]: Retrieves the cover image on a store embed, if any.

        This is only available if the application is a game sold on Discord.
        Nr)   r
   _from_cover_imager   r   rQ   s    rD   r<   zAppInfo.cover_image   s.     $4&t{DGT=NOOOrF   Optional[Guild]c                @    | j                             | j                  S )zOptional[:class:`Guild`]: If this application is a game sold on Discord,
        this field will be the guild to which it has been linked

        .. versionadded:: 1.3
        )r   
_get_guildr&   rQ   s    rD   guildzAppInfo.guild   s     {%%dm444rF   r   c                4    t          j        | j                  S z[:class:`ApplicationFlags`: The application's flags.

        .. versionadded:: 2.0
        r   _from_valuer*   rQ   s    rD   r;   zAppInfo.flags        +DK888rF   Optional[IntegrationTypeConfig]c                l    | j         sdS 	 t          | j         d                   S # t          $ r Y dS w xY w)zOptional[:class:`IntegrationTypeConfig`]: The default settings for the
        application's installation context in a guild.

        .. versionadded:: 2.5
        N0r5   r   KeyErrorrQ   s    rD   guild_integration_configz AppInfo.guild_integration_config  Q     - 	4	()G)LMMM 	 	 	44	   % 
33c                l    | j         sdS 	 t          | j         d                   S # t          $ r Y dS w xY w)zOptional[:class:`IntegrationTypeConfig`]: The default settings for the
        application's installation context as a user.

        .. versionadded:: 2.5
        N1rj   rQ   s    rD   user_integration_configzAppInfo.user_integration_config  rm   rn   )reasonr.   r   r0   install_params_scopesinstall_params_permissionsr;   r:   r<   r1   r-   guild_install_scopesguild_install_permissionsuser_install_scopesuser_install_permissionsrr   Optional[str]r.   r   r0   rs   Optional[List[str]]rt   Optional[Permissions]r;   Optional[ApplicationFlags]r:   Optional[bytes]r<   r1   r-   ru   rv   rw   rx   c                 K   i }|t           ur||d<   |t           ur||d<   |t           ur||d<   |t           urOi }|d}nBd|vr|t           urt          d          ||d<   |t           u rd|d	<   n|d|d	<   n
|j        |d	<   ||d
<   n|t           urt          d          |t           ur|||d<   n
|j        |d<   |t           ur|||d<   nt          j        |          |d<   |	t           ur|	|	|d<   nt          j        |	          |d<   |
t           ur|
|d<   |t           ur||d<   i }|t           us	|t           urUi }|dt           fv rg }d|vr|t           urt          d          |dt           fv rd|d	<   n
|j        |d	<   ||d<   d|pdi|d<   n|t           urt          d          |t           us	|t           urUi }|dt           fv rg }d|vr|t           urt          d          |dt           fv rd|d	<   n
|j        |d	<   ||d<   d|pdi|d<   n|t           urt          d          |r||d<   | j        j                            ||           d{V }t          || j                  S )u  |coro|

        Edits the application info.

        .. versionadded:: 2.4

        Parameters
        ----------
        custom_install_url: Optional[:class:`str`]
            The new custom authorization URL for the application. Can be ``None`` to remove the URL.
        description: Optional[:class:`str`]
            The new application description. Can be ``None`` to remove the description.
        role_connections_verification_url: Optional[:class:`str`]
            The new application’s connection verification URL which will render the application
            as a verification method in the guild’s role verification configuration. Can be ``None`` to remove the URL.
        install_params_scopes: Optional[List[:class:`str`]]
            The new list of :ddocs:`OAuth2 scopes <topics/oauth2#shared-resources-oauth2-scopes>` of
            the :attr:`~install_params`. Can be ``None`` to remove the scopes.
        install_params_permissions: Optional[:class:`Permissions`]
            The new permissions of the :attr:`~install_params`. Can be ``None`` to remove the permissions.
        flags: Optional[:class:`ApplicationFlags`]
            The new application’s flags. Only limited intent flags (:attr:`~ApplicationFlags.gateway_presence_limited`,
            :attr:`~ApplicationFlags.gateway_guild_members_limited`, :attr:`~ApplicationFlags.gateway_message_content_limited`)
            can be edited. Can be ``None`` to remove the flags.

            .. warning::

                Editing the limited intent flags leads to the termination of the bot.

        icon: Optional[:class:`bytes`]
            The new application’s icon as a :term:`py:bytes-like object`. Can be ``None`` to remove the icon.
        cover_image: Optional[:class:`bytes`]
            The new application’s cover image as a :term:`py:bytes-like object` on a store embed.
            The cover image is only available if the application is a game sold on Discord.
            Can be ``None`` to remove the image.
        interactions_endpoint_url: Optional[:class:`str`]
            The new interactions endpoint url of the application to receive interactions over this endpoint rather than
            over the gateway. Can be ``None`` to remove the URL.
        tags: Optional[List[:class:`str`]]
            The new list of tags describing the functionality of the application. Can be ``None`` to remove the tags.
        guild_install_scopes: Optional[List[:class:`str`]]
            The new list of :ddocs:`OAuth2 scopes <topics/oauth2#shared-resources-oauth2-scopes>` of
            the default guild installation context. Can be ``None`` to remove the scopes.

            .. versionadded: 2.5
        guild_install_permissions: Optional[:class:`Permissions`]
            The new permissions of the default guild installation context. Can be ``None`` to remove the permissions.

            .. versionadded: 2.5
        user_install_scopes: Optional[List[:class:`str`]]
            The new list of :ddocs:`OAuth2 scopes <topics/oauth2#shared-resources-oauth2-scopes>` of
            the default user installation context. Can be ``None`` to remove the scopes.

            .. versionadded: 2.5
        user_install_permissions: Optional[:class:`Permissions`]
            The new permissions of the default user installation context. Can be ``None`` to remove the permissions.

            .. versionadded: 2.5
        reason: Optional[:class:`str`]
            The reason for editing the application. Shows up on the audit log.

        Raises
        -------
        HTTPException
            Editing the application failed
        ValueError
            The image format passed in to ``icon`` or ``cover_image`` is invalid. This is also raised
            when ``install_params_scopes`` and ``install_params_permissions`` are incompatible with each other,
            or when ``guild_install_scopes`` and ``guild_install_permissions`` are incompatible with each other.

        Returns
        -------
        :class:`AppInfo`
            The newly updated application info.
        r.   r   r0   NbotzK'bot' must be in install_params_scopes if install_params_permissions is setscopesr   permissionsr/   zFinstall_params_scopes must be set if install_params_permissions is setr;   r:   r<   r1   r-   zI'bot' must be in guild_install_scopes if guild_install_permissions is setoauth2_install_paramsri   zDguild_install_scopes must be set if guild_install_permissions is setzG'bot' must be in user_install_scopes if user_install_permissions is setrp   zBuser_install_scopes must be set if user_install_permissions is setr=   )rr   payload)r7   r6   )	r   
ValueErrorvaluer	   _bytes_to_base64_datar   httpedit_application_infor   )rB   rr   r.   r   r0   rs   rt   r;   r:   r<   r1   r-   ru   rv   rw   rx   r   r/   r=   guild_install_paramsuser_install_paramsr7   s                         rD   editzAppInfo.edit+  s     | #%W,,,>G()g%%%0GM",G;;;\G78 //79N$,!% 555:T\c:c:c$%rsss+@x(-8845N=111989}558R8X}5(6G$%% *88 !ijjj}#(  #(; w|"&"'"=d"C"Cg%%")4&&).)D[)Q)Q&$G333LG/0w"GFO35 w..2KSZ2Z2Z=? #g66')$0005NV]5]5] !lmmm(T7O;;67$]336O6U$]3-A *-DFZFb^b,c$S))(77 !ghhhg--1IQX1X1X<>"tWo55&(#///4LT[4[4[ !jkkk'D'?::56#M225M5S#M2,?)-DFYFa]a,b$S))'w66 !efff# 	K2JG./[%;;6SZ;[[[[[[[[D4444rF   N)r6   r   r7   r8   rG   rH   rG   rS   )rG   r^   rG   r   )rG   rg   ) rr   ry   r.   ry   r   ry   r0   ry   rs   rz   rt   r{   r;   r|   r:   r}   r<   r}   r1   ry   r-   rz   ru   rz   rv   r{   rw   rz   rx   r{   rG   r   )rP   
__module____qualname____doc__	__slots__rE   rR   propertyr:   r<   ra   r;   rl   rq   r   r    rF   rD   r   r   9   sn       b bHI<&
 &
 &
 &
P
 
 
 
 N N N XN P P P XP 5 5 5 X5 9 9 9 X9    X    X" !(,3%,;B5<<C,3 ''.3:$+4;;B3::A#F5 F5 F5 F5 F5 F5 F5 F5rF   r   c                  n    e Zd ZdZdZddZdd
Zedd            Zedd            Z	edd            Z
dS )r   a  Represents a partial AppInfo given by :func:`~discord.abc.GuildChannel.create_invite`

    .. versionadded:: 2.0

    Attributes
    -------------
    id: :class:`int`
        The application ID.
    name: :class:`str`
        The application name.
    description: :class:`str`
        The application description.
    rpc_origins: Optional[List[:class:`str`]]
        A list of RPC origin URLs, if RPC is enabled.
    verify_key: :class:`str`
        The hex encoded key for verification in interactions and the
        GameSDK's :ddocs:`GetTicket <game-sdk/applications#getticket>`.
    terms_of_service_url: Optional[:class:`str`]
        The application's terms of service URL, if set.
    privacy_policy_url: Optional[:class:`str`]
        The application's privacy policy URL, if set.
    approximate_guild_count: :class:`int`
        The approximate count of the guilds the bot was added to.

        .. versionadded:: 2.3
    redirect_uris: List[:class:`str`]
        A list of authentication redirect URIs.

        .. versionadded:: 2.3
    interactions_endpoint_url: Optional[:class:`str`]
        The interactions endpoint url of the application to receive interactions over this endpoint rather than
        over the gateway, if configured.

        .. versionadded:: 2.3
    role_connections_verification_url: Optional[:class:`str`]
        The application's connection verification URL which will render the application as
        a verification method in the guild's role verification configuration.

        .. versionadded:: 2.3
    )r   r   r   r   r   r$   r+   r,   r#   r*   r)   r3   r2   r1   r0   r6   r   r7   PartialAppInfoPayloadc                  || _         t          |d                   | _        |d         | _        |                    d          | _        |                    dd          | _        |                    d          | _        |d         | _        |                    d          | _	        |d	         | _
        |                    d
          | _        |                    d          | _        |                    dd          | _        |                    dg           | _        |                    d          | _        |                    d          | _        d S )Nr   r   r:   r;   r   r<   r   r   r$   r+   r,   r3   r2   r1   r0   )r   r>   r   r   r?   r#   r*   r)   r   r   r$   r+   r,   r3   r2   r1   r0   )rB   r6   r7   s      rD   rE   zPartialAppInfo.__init__0  s   ',4:f	$(HHV$4$4
88GQ//+/88M+B+B $] 3040G0G#L13788<R3S3S!15:N1O1O,0HH5NPQ,R,R$(,"(E(E8<A\8]8]&@DIl@m@m...rF   rG   rH   c           	     R    d| j         j         d| j         d| j        d| j        d	S )NrJ   rK   rL   rM   rN   )rO   rP   r   r   r   rQ   s    rD   rR   zPartialAppInfo.__repr__A  s8    n4>*nnnntynnY]YinnnnrF   rS   c                b    | j         dS t          j        | j        | j        | j         d          S rU   rX   rQ   s    rD   r:   zPartialAppInfo.iconD  rZ   rF   c                ^    | j         dS t          j        | j        | j        | j                   S )zOptional[:class:`.Asset`]: Retrieves the cover image of the application's default rich presence.

        This is only available if the application is a game sold on Discord.

        .. versionadded:: 2.3
        Nr\   rQ   s    rD   r<   zPartialAppInfo.cover_imageK  s.     $4&t{DGT=NOOOrF   r   c                4    t          j        | j                  S rc   rd   rQ   s    rD   r;   zPartialAppInfo.flagsW  rf   rF   N)r6   r   r7   r   r   r   r   )rP   r   r   r   r   rE   rR   r   r:   r<   r;   r   rF   rD   r   r     s        ' 'RI$n n n n"o o o o N N N XN 	P 	P 	P X	P 9 9 9 X9 9 9rF   r   c                      e Zd ZdZdZd	dZdS )
r   a  Represents the settings for custom authorization URL of an application.

    .. versionadded:: 2.0

    Attributes
    ----------
    scopes: List[:class:`str`]
        The list of :ddocs:`OAuth2 scopes <topics/oauth2#shared-resources-oauth2-scopes>`
        to add the application to a guild with.
    permissions: :class:`Permissions`
        The permissions to give to application in the guild.
    )r   r   r7   InstallParamsPayloadrG   Nonec                    |                     dg           | _        t          t          |d                             | _        d S )Nr   r   )r?   r   r   r>   r   rB   r7   s     rD   rE   zAppInstallParams.__init__p  s:    !%(B!7!7(3C]8K4L4L(M(MrF   N)r7   r   rG   r   )rP   r   r   r   r   rE   r   rF   rD   r   r   `  s?          *IN N N N N NrF   r   c                      e Zd ZdZddZdS )	r   a'  Represents the default settings for the application's installation context.

    .. versionadded:: 2.5

    Attributes
    ----------
    oauth2_install_params: Optional[:class:`AppInstallParams`]
        The install params for this installation context's default in-app authorization link.
    r7   AppIntegrationTypeConfigPayloadrG   r   c                l    d | _         	 t          |d                   | _         d S # t          $ r Y d S w xY w)Nr   )r   r   rk   r   s     rD   rE   zIntegrationTypeConfig.__init__  sM    AE"	)9$?V:W)X)XD&&& 	 	 	DD	s   % 
33N)r7   r   rG   r   )rP   r   r   r   rE   r   rF   rD   r   r   u  s2              rF   r   N)'r   
__future__r   typingr   r   r   r    r	   assetr
   r;   r   r   r   r   r   r   ra   r   types.appinfor   r8   r   r   r   TeamPayloadr   r   r   r   userr   r6   r   __all__r   r   r   rF   rD   <module>r      s
   0 # " " " " " 9 9 9 9 9 9 9 9 9 9 9 9             # # # # # # $ $ $ $ $ $       '                      &&&&&&x5 x5 x5 x5 x5 x5 x5 x5vi9 i9 i9 i9 i9 i9 i9 i9XN N N N N N N N*         rF   