public final class Role extends Object implements Entity
Modifier and Type | Field and Description |
---|---|
static Color |
DEFAULT_COLOR
The default
Color of a Role . |
Constructor and Description |
---|
Role(ServiceMediator serviceMediator,
RoleBean data,
long guildId)
Constructs a
Role with an associated ServiceMediator and Discord data. |
Modifier and Type | Method and Description |
---|---|
Flux<Role> |
changePosition(int position)
Requests to change this role's position.
|
Mono<Void> |
delete()
Requests to delete this role.
|
Mono<Void> |
delete(String reason)
Requests to delete this role while optionally specifying the reason.
|
Mono<Role> |
edit(Consumer<? super RoleEditSpec> spec)
Requests to edit this role.
|
boolean |
equals(Object obj) |
DiscordClient |
getClient()
Gets the DiscordClient associated to this object.
|
Color |
getColor()
Gets the color assigned to this role.
|
Mono<Guild> |
getGuild()
Requests to retireve the guild this role is associated to.
|
Snowflake |
getGuildId()
Gets the ID of the guild this role is associated to.
|
Snowflake |
getId()
Gets the Snowflake that uniquely identifies this entity.
|
String |
getMention()
Gets the raw mention.
|
String |
getName()
Gets the role name.
|
PermissionSet |
getPermissions()
Gets the permissions assigned to this role.
|
Mono<Integer> |
getPosition() |
int |
getRawPosition() |
int |
hashCode() |
boolean |
isEveryone()
Gets whether this role corresponds to the @everyone role.
|
boolean |
isHoisted()
Gets whether if this role is pinned in the user listing.
|
boolean |
isManaged()
Gets whether this role is managed by an integration.
|
boolean |
isMentionable()
Gets whether this role is mentionable.
|
String |
toString() |
public Role(ServiceMediator serviceMediator, RoleBean data, long guildId)
Role
with an associated ServiceMediator and Discord data.serviceMediator
- The ServiceMediator associated to this object, must be non-null.data
- The raw data as represented by Discord, must be non-null.guildId
- The ID of the guild this role is associated to.public DiscordClient getClient()
DiscordObject
getClient
in interface DiscordObject
public int getRawPosition()
public String getName()
public Color getColor()
public boolean isHoisted()
true
if this role is pinned in the user listing, false
otherwise.public PermissionSet getPermissions()
public boolean isManaged()
true
if this role is managed by an integration, false
otherwise.public boolean isMentionable()
true
if this role is mentionable, false
otherwise.public boolean isEveryone()
true
if this role represents the @everyone role, false
otherwise.public Snowflake getGuildId()
public String getMention()
public Snowflake getId()
Entity
public Mono<Role> edit(Consumer<? super RoleEditSpec> spec)
spec
- A Consumer
that provides a "blank" RoleEditSpec
to be operated on.Mono
where, upon successful completion, emits the edited Role
. If an error is received,
it is emitted through the Mono
.public Mono<Void> delete()
Mono
where, upon successful completion, emits nothing; indicating the role has been deleted. If
an error is received, it is emitted through the Mono
.public Mono<Void> delete(@Nullable String reason)
reason
- The reason, if present.Mono
where, upon successful completion, emits nothing; indicating the role has been deleted. If
an error is received, it is emitted through the Mono
.public Flux<Role> changePosition(int position)