Enum Permission

java.lang.Object
java.lang.Enum<Permission>
net.dv8tion.jda.api.Permission
All Implemented Interfaces:
Serializable, Comparable<Permission>

public enum Permission extends Enum<Permission>
Represents the bit offsets used by Discord for Permissions.
  • Enum Constant Details

    • MANAGE_CHANNEL

      public static final Permission MANAGE_CHANNEL
    • MANAGE_SERVER

      public static final Permission MANAGE_SERVER
    • VIEW_AUDIT_LOGS

      public static final Permission VIEW_AUDIT_LOGS
    • VIEW_CHANNEL

      public static final Permission VIEW_CHANNEL
    • VIEW_GUILD_INSIGHTS

      public static final Permission VIEW_GUILD_INSIGHTS
    • MANAGE_ROLES

      public static final Permission MANAGE_ROLES
    • MANAGE_PERMISSIONS

      public static final Permission MANAGE_PERMISSIONS
    • MANAGE_WEBHOOKS

      public static final Permission MANAGE_WEBHOOKS
    • MANAGE_GUILD_EXPRESSIONS

      public static final Permission MANAGE_GUILD_EXPRESSIONS
    • MANAGE_EVENTS

      public static final Permission MANAGE_EVENTS
    • USE_EMBEDDED_ACTIVITIES

      public static final Permission USE_EMBEDDED_ACTIVITIES
    • VIEW_CREATOR_MONETIZATION_ANALYTICS

      public static final Permission VIEW_CREATOR_MONETIZATION_ANALYTICS
    • CREATE_GUILD_EXPRESSIONS

      public static final Permission CREATE_GUILD_EXPRESSIONS
    • CREATE_SCHEDULED_EVENTS

      public static final Permission CREATE_SCHEDULED_EVENTS
    • CREATE_INSTANT_INVITE

      public static final Permission CREATE_INSTANT_INVITE
    • KICK_MEMBERS

      public static final Permission KICK_MEMBERS
    • BAN_MEMBERS

      public static final Permission BAN_MEMBERS
    • NICKNAME_CHANGE

      public static final Permission NICKNAME_CHANGE
    • NICKNAME_MANAGE

      public static final Permission NICKNAME_MANAGE
    • MODERATE_MEMBERS

      public static final Permission MODERATE_MEMBERS
    • MESSAGE_ADD_REACTION

      public static final Permission MESSAGE_ADD_REACTION
    • MESSAGE_SEND

      public static final Permission MESSAGE_SEND
    • MESSAGE_TTS

      public static final Permission MESSAGE_TTS
    • MESSAGE_MANAGE

      public static final Permission MESSAGE_MANAGE
    • MESSAGE_ATTACH_FILES

      public static final Permission MESSAGE_ATTACH_FILES
    • MESSAGE_HISTORY

      public static final Permission MESSAGE_HISTORY
    • MESSAGE_MENTION_EVERYONE

      public static final Permission MESSAGE_MENTION_EVERYONE
    • MESSAGE_EXT_EMOJI

      public static final Permission MESSAGE_EXT_EMOJI
    • USE_APPLICATION_COMMANDS

      public static final Permission USE_APPLICATION_COMMANDS
    • MESSAGE_EXT_STICKER

      public static final Permission MESSAGE_EXT_STICKER
    • MESSAGE_ATTACH_VOICE_MESSAGE

      public static final Permission MESSAGE_ATTACH_VOICE_MESSAGE
    • MESSAGE_SEND_POLLS

      public static final Permission MESSAGE_SEND_POLLS
    • USE_EXTERNAL_APPLICATIONS

      public static final Permission USE_EXTERNAL_APPLICATIONS
    • MANAGE_THREADS

      public static final Permission MANAGE_THREADS
    • CREATE_PUBLIC_THREADS

      public static final Permission CREATE_PUBLIC_THREADS
    • CREATE_PRIVATE_THREADS

      public static final Permission CREATE_PRIVATE_THREADS
    • MESSAGE_SEND_IN_THREADS

      public static final Permission MESSAGE_SEND_IN_THREADS
    • PRIORITY_SPEAKER

      public static final Permission PRIORITY_SPEAKER
    • VOICE_STREAM

      public static final Permission VOICE_STREAM
    • VOICE_CONNECT

      public static final Permission VOICE_CONNECT
    • VOICE_SPEAK

      public static final Permission VOICE_SPEAK
    • VOICE_MUTE_OTHERS

      public static final Permission VOICE_MUTE_OTHERS
    • VOICE_DEAF_OTHERS

      public static final Permission VOICE_DEAF_OTHERS
    • VOICE_MOVE_OTHERS

      public static final Permission VOICE_MOVE_OTHERS
    • VOICE_USE_VAD

      public static final Permission VOICE_USE_VAD
    • VOICE_START_ACTIVITIES

      @Deprecated @ForRemoval(deadline="5.1.0") @ReplaceWith("USE_EMBEDDED_ACTIVITIES") public static final Permission VOICE_START_ACTIVITIES
      Deprecated.
    • VOICE_USE_SOUNDBOARD

      public static final Permission VOICE_USE_SOUNDBOARD
    • VOICE_USE_EXTERNAL_SOUNDS

      public static final Permission VOICE_USE_EXTERNAL_SOUNDS
    • VOICE_SET_STATUS

      public static final Permission VOICE_SET_STATUS
    • REQUEST_TO_SPEAK

      public static final Permission REQUEST_TO_SPEAK
    • ADMINISTRATOR

      public static final Permission ADMINISTRATOR
    • UNKNOWN

      public static final Permission UNKNOWN
  • Field Details

    • EMPTY_PERMISSIONS

      public static final Permission[] EMPTY_PERMISSIONS
      Empty array of Permission enum, useful for optimized use in Collection.toArray(Object[]).
    • ALL_PERMISSIONS

      @Deprecated @ForRemoval(deadline="5.1.0") public static final long ALL_PERMISSIONS
      Deprecated.
      To be removed in 5.1.0
      Represents a raw set of all permissions
    • ALL_CHANNEL_PERMISSIONS

      @Deprecated @ForRemoval(deadline="5.1.0") public static final long ALL_CHANNEL_PERMISSIONS
      Deprecated.
      To be removed in 5.1.0 (use isChannel() instead)
      All permissions that apply to a channel
    • ALL_GUILD_PERMISSIONS

      @Deprecated @ForRemoval(deadline="5.1.0") public static final long ALL_GUILD_PERMISSIONS
      Deprecated.
      To be removed in 5.1.0 (use isGuild() instead)
      All Guild specific permissions which are only available to roles
    • ALL_TEXT_PERMISSIONS

      @Deprecated @ForRemoval(deadline="5.1.0") public static final long ALL_TEXT_PERMISSIONS
      Deprecated.
      To be removed in 5.1.0
      All text channel specific permissions which are only available in text channel permission overrides
    • ALL_VOICE_PERMISSIONS

      @Deprecated @ForRemoval(deadline="5.1.0") public static final long ALL_VOICE_PERMISSIONS
      Deprecated.
      To be removed in 5.1.0
      All voice channel specific permissions which are only available in voice channel permission overrides
  • Method Details

    • values

      public static Permission[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Permission valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getName

      @Nonnull public String getName()
      The readable name as used in the Discord client.
      Returns:
      The readable name of this Permission.
    • getOffset

      public int getOffset()
      The binary offset of the permission.
      For more information about Discord's offset system refer to Discord Permissions.
      Returns:
      The offset that represents this Permission.
    • getRawValue

      public long getRawValue()
      The value of this permission when viewed as a raw value.
      This is equivalent to: 1 << getOffset()
      Returns:
      The raw value of this specific permission.
    • isGuild

      public boolean isGuild()
      Returns whether or not this Permission is present at the Guild level (configurable via Roles)
      Returns:
      True if this permission is present at the Guild level.
    • isChannel

      public boolean isChannel()
      Returns whether or not this Permission is present Channel level (configurable via PermissionsOverrides)
      Returns:
      True if this permission is present at the Channel level.
    • isText

      @Deprecated @ForRemoval(deadline="5.1.0") public boolean isText()
      Deprecated.
      To be removed in 5.1.0
      Whether this permission is specifically for TextChannels
      Returns:
      True, if and only if this permission can only be applied to text channels
    • isVoice

      @Deprecated @ForRemoval(deadline="5.1.0") public boolean isVoice()
      Deprecated.
      To be removed in 5.1.0
      Whether this permission is specifically for VoiceChannels
      Returns:
      True, if and only if this permission can only be applied to voice channels
    • getFromOffset

      @Nonnull public static Permission getFromOffset(int offset)
      Gets the first Permission relating to the provided offset.
      If there is no Permssions that matches the provided offset, Permission.UNKNOWN is returned.
      Parameters:
      offset - The offset to match a Permission to.
      Returns:
      Permission relating to the provided offset.
    • getPermissions

      @Nonnull public static EnumSet<Permission> getPermissions(long permissions)
      A set of all Permissions that are specified by this raw long representation of permissions. The is best used with the getRaw methods in Role or PermissionOverride.

      Example: Role.getPermissionsRaw()

      Parameters:
      permissions - The raw long representation of permissions.
      Returns:
      Possibly-empty EnumSet of Permissions.
    • getRaw

      public static long getRaw(@Nonnull Permission... permissions)
      This is effectively the opposite of getPermissions(long), this takes 1 or more Permissions and returns the raw offset long representation of the permissions.
      Parameters:
      permissions - The array of permissions of which to form into the raw long representation.
      Returns:
      Unsigned long representing the provided permissions.
    • getRaw

      public static long getRaw(@Nonnull Collection<Permission> permissions)
      This is effectively the opposite of getPermissions(long), this takes a Collection of Permissions and returns the raw offset long representation of the permissions.
      Example: getRaw(EnumSet.of(Permission.VIEW_CHANNEL, Permission.MESSAGE_SEND))
      Parameters:
      permissions - The Collection of permissions of which to form into the raw long representation.
      Returns:
      Unsigned long representing the provided permissions.
      See Also: