Package discord4j.core.object.command
Class ApplicationCommandPermission
java.lang.Object
discord4j.core.object.command.ApplicationCommandPermission
- All Implemented Interfaces:
DiscordObject
Represents an individual application command permission, allowing you to enable or disable commands for specific
users, roles, or channels within a guild.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Represents the various types of application command permissions. -
Constructor Summary
ConstructorDescriptionApplicationCommandPermission
(GatewayDiscordClient gateway, Snowflake guildId, discord4j.discordjson.json.ApplicationCommandPermissionsData data) Constructs anApplicationCommandPermission
with an associatedGatewayDiscordClient
and Discord data. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether this channel permission uses a constant representing it applies to all channels.boolean
Returns whether this role permission uses a constant representing it applies to everyone.Returns theGatewayDiscordClient
that created this object.getId()
Return the ID of the role, user, or channel.getType()
Returns the type of this permission.boolean
toString()
-
Constructor Details
-
ApplicationCommandPermission
public ApplicationCommandPermission(GatewayDiscordClient gateway, Snowflake guildId, discord4j.discordjson.json.ApplicationCommandPermissionsData data) Constructs anApplicationCommandPermission
with an associatedGatewayDiscordClient
and Discord data.- Parameters:
gateway
- theGatewayDiscordClient
associated to this object, must be non-null.data
- the raw data as represented by Discord, must be non-null.
-
-
Method Details
-
getId
Return the ID of the role, user, or channel. It can also be a permission constant which can be detected byappliesToEveryone()
orappliesToAllChannels()
.- Returns:
- the permission target as a Snowflake ID
-
appliesToEveryone
public boolean appliesToEveryone()Returns whether this role permission uses a constant representing it applies to everyone.- Returns:
true
if this permission applies to all members in a guild,false
if otherwise
-
appliesToAllChannels
public boolean appliesToAllChannels()Returns whether this channel permission uses a constant representing it applies to all channels.- Returns:
true
if this permission applies to all channels in a guild,false
if otherwise
-
getType
Returns the type of this permission.- Returns:
- the type of this permission
-
isAllowed
public boolean isAllowed()Returns whether this permission allows or disallows a command for the target given bygetType()
andgetId()
.- Returns:
true
if this permission is allowing the command,false
if it disallows it.
-
getClient
Description copied from interface:DiscordObject
Returns theGatewayDiscordClient
that created this object. Methods in it are exclusively based on the entity cache orStore
in use. Refer to callinggetClient().rest()
to access aDiscordClient
that is capable of requesting entities directly from the REST API.- Specified by:
getClient
in interfaceDiscordObject
- Returns:
- The
GatewayDiscordClient
associated to this object.
-
toString
-