Package com.mewna.catnip.entity.guild
Interface Role
- All Superinterfaces:
Comparable<Role>
,Entity
,GuildEntity
,HasGuild
,HasName
,Mentionable
,Permissable
,Snowflake
,Timestamped
- All Known Implementing Classes:
RoleImpl
A role in a guild.
- Since:
- 9/4/18.
- Author:
- amy
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mewna.catnip.entity.partials.Timestamped
Timestamped.TimestampStyle
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
default boolean
canInteract
(Member member) Checks whether the entity can interact with a member or not.default boolean
canInteract
(Role role) Checks whether the entity can interact with a role or not.int
color()
Integer representation of the role color.default int
default boolean
hasPermissions
(GuildChannel channel, Collection<Permission> permissions) Checks whether the entity has the permissions or not in a specificGuildChannel
.default boolean
hasPermissions
(Collection<Permission> permissions) Checks whether the entity has the permissions or not.boolean
hoist()
Whether or not the role "hoists" users with it into a group in the user list.icon()
This role's icon hash.boolean
managed()
Whether or not this role is managed by a 3rd party connection.boolean
Whether or not mentioning this role will effectively mention those with it.default Set<Permission>
Permissions this role grants users in the guild.long
Permissions this role grants users in the guild.int
position()
Position of the role within the guild it's from.tags()
The tags for this role.Methods inherited from interface com.mewna.catnip.entity.partials.GuildEntity
guild
Methods inherited from interface com.mewna.catnip.entity.partials.HasGuild
guildId, guildIdAsLong
Methods inherited from interface com.mewna.catnip.entity.partials.Permissable
hasPermissions, hasPermissions
Methods inherited from interface com.mewna.catnip.entity.partials.Snowflake
creationTime, creationTimestamp, id, idAsLong
Methods inherited from interface com.mewna.catnip.entity.partials.Timestamped
asDiscordTimestamp, parseTimestamp
-
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 is0
.- 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 interfacePermissable
- Returns:
- Bit set of permissions granted by this role.
-
permissions
Permissions this role grants users in the guild.
Channels may override and add to or remove from this.- Specified by:
permissions
in interfacePermissable
- 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
The tags for this role. Role tags are things like:- Whether or not this is the Nitro boost role.
- Whether or not this is a bot-specific role.
- Whether or not this is an integration-specific role.
- Returns:
- The tags for this role.
-
icon
This role's icon hash. Use withCDNFormat.roleIconUrl(String, String, ImageOptions)
. This property is only non-nullable if the guild has theGuildFeature.ROLE_ICONS
feature. -
unicodeEmoji
- See Also:
-
asMention
- Specified by:
asMention
in interfaceMentionable
- Returns:
- A mention for this role that can be sent in a message.
-
hasPermissions
Description copied from interface:Permissable
Checks whether the entity has the permissions or not.- Specified by:
hasPermissions
in interfacePermissable
- 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 specificGuildChannel
.- Specified by:
hasPermissions
in interfacePermissable
- Parameters:
channel
- The channel in which the entity should have the permissionpermissions
- The permissions to check.- Returns:
- Whether the entity has the permissions or not
-
canInteract
Description copied from interface:Permissable
Checks whether the entity can interact with a role or not.- Specified by:
canInteract
in interfacePermissable
- Parameters:
role
- The role the entity should interact with.- Returns:
- Whether the entity can interact with a role or not
-
canInteract
Description copied from interface:Permissable
Checks whether the entity can interact with a member or not.- Specified by:
canInteract
in interfacePermissable
- Parameters:
member
- The member the entity should interact with.- Returns:
- Whether the entity can interact with a member or not
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Role>
-