Interface Role

All Superinterfaces:
Comparable<Role>, Entity, GuildEntity, HasGuild, HasName, Mentionable, Permissable, Snowflake, Timestamped
All Known Implementing Classes:
RoleImpl

public interface Role extends Mentionable, Comparable<Role>, Permissable, HasName
A role in a guild.
Since:
9/4/18.
Author:
amy
  • Method Details

    • color

      @CheckReturnValue int color()
      Integer representation of the role color.
      To use this, you must convert the integer to base-16, hex, format. The default role color is 0.
      Returns:
      The integer representation of the role color. Never null.
    • position

      @CheckReturnValue int position()
      Position of the role within the guild it's from.

      Note: Raw positions fetched from Discord are a bit weird and may confuse you sometimes.

      Returns:
      The position of the role within its guild's role hierarchy.
    • hoist

      @CheckReturnValue boolean hoist()
      Whether or not the role "hoists" users with it into a group in the user list.
      Returns:
      True if the role is grouped and hoisted, false otherwise.
    • permissionsRaw

      @CheckReturnValue long permissionsRaw()
      Permissions this role grants users in the guild.
      Channels may override and add to or remove from this.
      Specified by:
      permissionsRaw in interface Permissable
      Returns:
      Bit set of permissions granted by this role.
    • permissions

      @Nonnull @CheckReturnValue default Set<Permission> permissions()
      Permissions this role grants users in the guild.
      Channels may override and add to or remove from this.
      Specified by:
      permissions in interface Permissable
      Returns:
      Set of permissions granted by this role. Never null.
    • managed

      @CheckReturnValue boolean managed()
      Whether or not this role is managed by a 3rd party connection.
      Most often, this is seen on bots which were added using a permission parameter in their invite link.
      If true, this role cannot be modified by users through normal means.
      Returns:
      True if the role is managed, false otherwise.
    • mentionable

      @CheckReturnValue boolean mentionable()
      Whether or not mentioning this role will effectively mention those with it.
      Roles can always be mentioned, but will not mention users with it unless this is true.
      Returns:
      True if the role is mentionable, false otherwise.
    • tags

      @Nonnull @CheckReturnValue RoleTags tags()
      The tags for this role. Role tags are things like:
      1. Whether or not this is the Nitro boost role.
      2. Whether or not this is a bot-specific role.
      3. Whether or not this is an integration-specific role.
      Returns:
      The tags for this role.
    • icon

      @Nullable @CheckReturnValue String icon()
      This role's icon hash. Use with CDNFormat.roleIconUrl(String, String, ImageOptions). This property is only non-nullable if the guild has the GuildFeature.ROLE_ICONS feature.
    • unicodeEmoji

      @Nullable @CheckReturnValue String unicodeEmoji()
      See Also:
    • asMention

      @Nonnull @CheckReturnValue default String asMention()
      Specified by:
      asMention in interface Mentionable
      Returns:
      A mention for this role that can be sent in a message.
    • hasPermissions

      default boolean hasPermissions(@Nonnull Collection<Permission> permissions)
      Description copied from interface: Permissable
      Checks whether the entity has the permissions or not.
      Specified by:
      hasPermissions in interface Permissable
      Parameters:
      permissions - The permissions to check.
      Returns:
      Whether the entity has the permissions or not
    • hasPermissions

      default boolean hasPermissions(@Nonnull GuildChannel channel, @Nonnull Collection<Permission> permissions)
      Description copied from interface: Permissable
      Checks whether the entity has the permissions or not in a specific GuildChannel.
      Specified by:
      hasPermissions in interface Permissable
      Parameters:
      channel - The channel in which the entity should have the permission
      permissions - The permissions to check.
      Returns:
      Whether the entity has the permissions or not
    • canInteract

      default boolean canInteract(@Nonnull Role role)
      Description copied from interface: Permissable
      Checks whether the entity can interact with a role or not.
      Specified by:
      canInteract in interface Permissable
      Parameters:
      role - The role the entity should interact with.
      Returns:
      Whether the entity can interact with a role or not
    • canInteract

      default boolean canInteract(@Nonnull Member member)
      Description copied from interface: Permissable
      Checks whether the entity can interact with a member or not.
      Specified by:
      canInteract in interface Permissable
      Parameters:
      member - The member the entity should interact with.
      Returns:
      Whether the entity can interact with a member or not
    • compareTo

      default int compareTo(@Nonnull Role o)
      Specified by:
      compareTo in interface Comparable<Role>