mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 09:08:01 +01:00
Add InteractionRole#getAsMention + InteractionRole#canInteract
This commit is contained in:
parent
ba5a8becfc
commit
52c500ee6d
@ -10,6 +10,12 @@ public interface InteractionRole {
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the mention of this role.
|
||||
* @return this role's mention.
|
||||
*/
|
||||
String getAsMention();
|
||||
|
||||
/**
|
||||
* Whether this role is managed by an external integration.
|
||||
* @return true if the role is managed.
|
||||
@ -34,6 +40,12 @@ public interface InteractionRole {
|
||||
*/
|
||||
boolean isDefaultColor();
|
||||
|
||||
/**
|
||||
* Whether this role can be given to other members by the current logged in bot.
|
||||
* @return true if this role can be interacted with by the current bot user.
|
||||
*/
|
||||
boolean canInteract();
|
||||
|
||||
/**
|
||||
* Gets the ID of this role.
|
||||
* @return this role's ID.
|
||||
|
@ -15,6 +15,11 @@ public class InteractionRoleImpl implements InteractionRole {
|
||||
return role.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAsMention() {
|
||||
return role.getAsMention();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isManaged() {
|
||||
return role.isManaged();
|
||||
@ -35,6 +40,11 @@ public class InteractionRoleImpl implements InteractionRole {
|
||||
return role.getColorRaw() == Role.DEFAULT_COLOR_RAW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteract() {
|
||||
return role.getGuild().getSelfMember().canInteract(role);
|
||||
}
|
||||
|
||||
public Role getJdaObject() {
|
||||
return role;
|
||||
}
|
||||
@ -43,4 +53,9 @@ public class InteractionRoleImpl implements InteractionRole {
|
||||
public String getId() {
|
||||
return role.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InteractionRoleImpl{name=" + getName() + ",id=" + getId() + "}";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user