Document behavior for empty default permissions

This commit is contained in:
zephyrkul 2022-04-28 10:54:55 -06:00 committed by GitHub
parent a0dfdb9b1d
commit 10af1ea255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -468,6 +468,8 @@ class Command(Generic[GroupT, P, T]):
default_permissions: Optional[:class:`~discord.Permissions`] default_permissions: Optional[:class:`~discord.Permissions`]
The default permissions that can execute this command on Discord. Note The default permissions that can execute this command on Discord. Note
that server administrators can override this value in the client. that server administrators can override this value in the client.
Setting an empty permissions field will disallow anyone except server
administrators from using the command in a guild.
Due to a Discord limitation, this does not work on subcommands. Due to a Discord limitation, this does not work on subcommands.
guild_only: :class:`bool` guild_only: :class:`bool`
@ -874,6 +876,8 @@ class ContextMenu:
default_permissions: Optional[:class:`~discord.Permissions`] default_permissions: Optional[:class:`~discord.Permissions`]
The default permissions that can execute this command on Discord. Note The default permissions that can execute this command on Discord. Note
that server administrators can override this value in the client. that server administrators can override this value in the client.
Setting an empty permissions field will disallow anyone except server
administrators from using the command in a guild.
guild_only: :class:`bool` guild_only: :class:`bool`
Whether the command should only be usable in guild contexts. Whether the command should only be usable in guild contexts.
Defaults to ``False``. Defaults to ``False``.
@ -1025,6 +1029,8 @@ class Group:
default_permissions: Optional[:class:`~discord.Permissions`] default_permissions: Optional[:class:`~discord.Permissions`]
The default permissions that can execute this group on Discord. Note The default permissions that can execute this group on Discord. Note
that server administrators can override this value in the client. that server administrators can override this value in the client.
Setting an empty permissions field will disallow anyone except server
administrators from using the command in a guild.
Due to a Discord limitation, this does not work on subcommands. Due to a Discord limitation, this does not work on subcommands.
guild_only: :class:`bool` guild_only: :class:`bool`
@ -1828,6 +1834,9 @@ def default_permissions(**perms: bool) -> Callable[[T], T]:
However, an administrator can change the permissions needed to execute this command using the official However, an administrator can change the permissions needed to execute this command using the official
client. Therefore, this only serves as a hint. client. Therefore, this only serves as a hint.
Setting an empty permissions field, including via calling this with no arguments, will disallow anyone
except server administrators from using the command in a guild.
This is sent to Discord server side, and is not a :func:`check`. Therefore, error handlers are not called. This is sent to Discord server side, and is not a :func:`check`. Therefore, error handlers are not called.
Due to a Discord limitation, this decorator does nothing in subcommands and is ignored. Due to a Discord limitation, this decorator does nothing in subcommands and is ignored.