Package net.dv8tion.jda.core.entities
Interface Member
-
- All Superinterfaces:
java.util.Formattable
,IMentionable
,IPermissionHolder
public interface Member extends IMentionable, IPermissionHolder
Represents a Guild-specific User.Contains all guild-specific information about a User. (Roles, Nickname, VoiceStatus etc.)
- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canInteract(Emote emote)
Whether this Member can interact with the providedEmote
(use in a message)boolean
canInteract(Member member)
Whether this Member can interact with the provided Member (kick/ban/etc.)boolean
canInteract(Role role)
Whether this Member can interact with the providedRole
(kick/ban/move/modify/delete/etc.)java.awt.Color
getColor()
TheColor
of this Member's name in a Guild.int
getColorRaw()
The raw RGB value for the color of this member.TextChannel
getDefaultChannel()
The defaultTextChannel
for aMember
.java.lang.String
getEffectiveName()
Retrieves the Name displayed in the official Discord Client.Game
getGame()
The game that the user is currently playing.Guild
getGuild()
The Guild in which this Member is represented.JDA
getJDA()
The JDA instance.java.time.OffsetDateTime
getJoinDate()
TheTime
this Member joined the Guild.java.lang.String
getNickname()
Returns the current nickname of this Member for the parent Guild.OnlineStatus
getOnlineStatus()
Returns theOnlineStatus
of the User.java.util.List<Permission>
getPermissions(Channel channel)
The Permissions this Member holds in the specifiedChannel
.java.util.List<Role>
getRoles()
The roles applied to this Member.User
getUser()
The user wrapped by this Entity.GuildVoiceState
getVoiceState()
TheVoiceState
of this Member.boolean
isOwner()
Checks whether this member is the owner of its relatedGuild
.-
Methods inherited from interface net.dv8tion.jda.core.entities.IMentionable
formatTo, getAsMention
-
Methods inherited from interface net.dv8tion.jda.core.entities.IPermissionHolder
getPermissions, hasPermission, hasPermission, hasPermission, hasPermission
-
-
-
-
Method Detail
-
getGuild
Guild getGuild()
The Guild in which this Member is represented.- Specified by:
getGuild
in interfaceIPermissionHolder
- Returns:
Guild
-
getJDA
JDA getJDA()
The JDA instance.- Returns:
- The current JDA instance.
-
getJoinDate
java.time.OffsetDateTime getJoinDate()
TheTime
this Member joined the Guild.- Returns:
- The Join Date.
-
getVoiceState
GuildVoiceState getVoiceState()
TheVoiceState
of this Member.
This will be null when theCacheFlag.VOICE_STATE
is disabled manuallyThis can be used to get the Member's VoiceChannel using
GuildVoiceState.getChannel()
.- Returns:
GuildVoiceState
-
getGame
Game getGame()
The game that the user is currently playing.
If the user is not currently playing a game, this will return null.
-
getOnlineStatus
OnlineStatus getOnlineStatus()
- Returns:
- The current
OnlineStatus
of theUser
.
-
getNickname
java.lang.String getNickname()
Returns the current nickname of this Member for the parent Guild.This can be changed using
GuildController.setNickname(Member, String)
.- Returns:
- The nickname or null, if no nickname is set.
-
getEffectiveName
java.lang.String getEffectiveName()
Retrieves the Name displayed in the official Discord Client.- Returns:
- The Nickname of this Member or the Username if no Nickname is present.
-
getRoles
java.util.List<Role> getRoles()
The roles applied to this Member.
The roles are ordered based on their position.A Member's roles can be changed using the addRolesToMember, removeRolesFromMember, and modifyMemberRoles methods in
GuildController
.The Public Role (
@everyone
) is not included in the returned immutable list of roles
It is implicit that every member holds the Public Role in a Guild thus it is not listed here!- Returns:
- An immutable List of
Roles
for this Member.
-
getColor
java.awt.Color getColor()
TheColor
of this Member's name in a Guild.This is determined by the color of the highest role assigned to them that does not have the default color.
If all roles have default color, this returns null.- Returns:
- The display Color for this Member.
- See Also:
getColorRaw()
-
getColorRaw
int getColorRaw()
The raw RGB value for the color of this member.
Defaulting toRole.DEFAULT_COLOR_RAW
if this member uses the default color (special property, it changes depending on theme used in the client)- Returns:
- The raw RGB value or the role default
-
getPermissions
java.util.List<Permission> getPermissions(Channel channel)
The Permissions this Member holds in the specifiedChannel
.
Permissions returned by this may be different fromIPermissionHolder.getPermissions()
due to the Channel'sPermissionOverrides
.- Parameters:
channel
- TheChannel
of which to get Permissions for- Returns:
- An immutable List of Permissions granted to this Member.
-
canInteract
boolean canInteract(Member member)
Whether this Member can interact with the provided Member (kick/ban/etc.)- Parameters:
member
- The target Member to check- Returns:
- True, if this Member is able to interact with the specified Member
- Throws:
java.lang.NullPointerException
- if the specified Member is nulljava.lang.IllegalArgumentException
- if the specified Member is not from the same guild- See Also:
PermissionUtil.canInteract(Member, Member)
-
canInteract
boolean canInteract(Role role)
Whether this Member can interact with the providedRole
(kick/ban/move/modify/delete/etc.)- Parameters:
role
- The target Role to check- Returns:
- True, if this member is able to interact with the specified Role
- Throws:
java.lang.NullPointerException
- if the specified Role is nulljava.lang.IllegalArgumentException
- if the specified Role is not from the same guild- See Also:
PermissionUtil.canInteract(Member, Role)
-
canInteract
boolean canInteract(Emote emote)
Whether this Member can interact with the providedEmote
(use in a message)- Parameters:
emote
- The target Emote to check- Returns:
- True, if this Member is able to interact with the specified Emote
- Throws:
java.lang.NullPointerException
- if the specified Emote is nulljava.lang.IllegalArgumentException
- if the specified Emote is not from the same guild- See Also:
PermissionUtil.canInteract(Member, Emote)
-
isOwner
boolean isOwner()
Checks whether this member is the owner of its relatedGuild
.- Returns:
- True, if this member is the owner of the attached Guild.
-
getDefaultChannel
@Nullable TextChannel getDefaultChannel()
The defaultTextChannel
for aMember
.
This is the channel that the Discord client will default to opening when a Guild is opened for the first time after joining the guild.
The default channel is the channel with the highest position in which the member hasPermission.MESSAGE_READ
permissions. If this requirement doesn't apply for any channel in the guild, this method returnsnull
.- Returns:
- The
TextChannel
representing the default channel for this member or null if no such channel exists.
-
-