
    cjh                     d    d Z ddlmZ ddlmZ ddlmZ ddlmZ dZ	d	e
d
efdZd
efdZd
efd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.
    Callable   )InteractionContextType)Permissions   )ApplicationCommand)default_permissions
guild_onlyis_nsfwpermsreturnc                       t               t        t        j                        z
  }|rt        ddj	                  |             dt
        f fd}|S )a  A decorator that limits the usage of an application command to members with certain
    permissions.

    The permissions passed in must be exactly like the properties shown under
    :class:`.discord.Permissions`.

    .. note::
        These permissions can be updated by server administrators per-guild. As such, these are only "defaults", as the
        name suggests. If you want to make sure that a user **always** has the specified permissions regardless, you
        should use an internal check such as :func:`~.ext.commands.has_permissions`.

    Parameters
    ----------
    **perms: Dict[:class:`str`, :class:`bool`]
        An argument list of permissions to check for.

    Example
    -------

    .. code-block:: python3

        from discord import default_permissions

        @bot.slash_command()
        @default_permissions(manage_messages=True)
        async def test(ctx):
            await ctx.respond('You can manage messages.')
    zInvalid permission(s): z, commandc                     t        | t              r)| j                  t        d      t	        di | _        | S t	        di | _        | S )Nz=Permission restrictions can only be set on top-level commands )
isinstancer	   parentRuntimeErrorr   default_member_permissions__default_member_permissions__)r   r   s    O/var/www/html/venv/lib/python3.12/site-packages/discord/commands/permissions.pyinnerz"default_permissions.<locals>.innerE   sY    g12~~)"S  2=1Eu1EG.  6A5I55IG2    )setr   VALID_FLAGS	TypeErrorjoinr   )r   invalidr   s   `  r   r
   r
   #   sQ    < %j3{6677G1$))G2D1EFGG	x 	 Lr   c                      dt         fd} | S )a|  A decorator that limits the usage of an application command to guild contexts.
    The command won't be able to be used in private message channels.

    Example
    -------

    .. code-block:: python3

        from discord import guild_only

        @bot.slash_command()
        @guild_only()
        async def test(ctx):
            await ctx.respond("You're in a guild.")
    r   c                     t        | t              rt        j                  h| _        | S t        j                  h| _        | S )N)r   r	   r   guildcontexts__contexts__r   s    r   r   zguild_only.<locals>.innerd   s=    g12 6 < <=G  %;$@$@#AG r   r   r   s    r   r   r   S   s    "x  Lr   c                      dt         fd} | S )aI  A decorator that limits the usage of an application command to 18+ channels and users.
    In guilds, the command will only be able to be used in channels marked as NSFW.
    In DMs, users must have opted into age-restricted commands via privacy settings.

    Note that apps intending to be listed in the App Directory cannot have NSFW commands.

    Example
    -------

    .. code-block:: python3

        from discord import is_nsfw

        @bot.slash_command()
        @is_nsfw()
        async def test(ctx):
            await ctx.respond("This command is age restricted.")
    r   c                 F    t        | t              r	d| _        | S d| _        | S )NT)r   r	   nsfw__nsfw__r%   s    r   r   zis_nsfw.<locals>.inner   s*    g12GL   $Gr   r   r&   s    r   r   r   o   s    (x  Lr   N)__doc__typingr   enumsr   permissionsr   corer	   __all__boolr
   r   r   r   r   r   <module>r2      sI   2  * % $
:- -( -`H 8 r   