Skip to main content
Represents a Guild-specific User. Contains all guild-specific information about a User including roles, nickname, and voice status.

Overview

The Member interface represents a User within the context of a specific Guild. It provides access to guild-specific properties like nickname, roles, and permissions.

Key Properties

User Information

getUser()
User
The User wrapped by this Member entity.
User user = member.getUser();
getGuild()
Guild
The Guild in which this Member is represented.
Guild guild = member.getGuild();
getEffectiveName()
String
The name displayed in the official Discord Client. Returns the guild nickname if present, otherwise returns the user’s effective name.
String displayName = member.getEffectiveName();
getNickname()
String
The current nickname of this Member for the parent Guild.Returns null if no nickname is set.
String nickname = member.getNickname();
if (nickname != null) {
    System.out.println("Nickname: " + nickname);
}

Membership Details

getTimeJoined()
OffsetDateTime
The time this Member joined the Guild.
OffsetDateTime joined = member.getTimeJoined();
System.out.println("Joined: " + joined.toString());
hasTimeJoined()
boolean
Whether this member has accurate join time information. Discord doesn’t always provide this when loading members.
if (member.hasTimeJoined()) {
    System.out.println("Joined: " + member.getTimeJoined());
}
isBoosting()
boolean
Returns whether this member is boosting the guild.
if (member.isBoosting()) {
    System.out.println("This member is a booster!");
}
getTimeBoosted()
OffsetDateTime
The time when this member boosted the guild.Returns null if the member is not currently boosting.
OffsetDateTime boostedSince = member.getTimeBoosted();

Roles and Permissions

getRoles()
List<Role>
The roles applied to this Member. The roles are ordered by position (highest role at index 0).Note: The @everyone role is not included in this list.
List<Role> roles = member.getRoles();
for (Role role : roles) {
    System.out.println(role.getName());
}
getPermissions()
EnumSet<Permission>
Gets the Permissions that this Member has in the Guild.
EnumSet<Permission> permissions = member.getPermissions();
if (permissions.contains(Permission.ADMINISTRATOR)) {
    System.out.println("This member is an admin!");
}
hasPermission(Permission... permissions)
boolean
Checks whether this member has the specified permissions.
if (member.hasPermission(Permission.KICK_MEMBERS, Permission.BAN_MEMBERS)) {
    System.out.println("Can moderate members");
}
isOwner()
boolean
Checks whether this member is the owner of the related Guild.
if (member.isOwner()) {
    System.out.println("Guild owner");
}

Voice State

getVoiceState()
GuildVoiceState
The VoiceState of this Member.Returns null when the VOICE_STATE cache flag is disabled.
GuildVoiceState voiceState = member.getVoiceState();
if (voiceState != null && voiceState.inAudioChannel()) {
    System.out.println("In channel: " + voiceState.getChannel().getName());
}

Status and Activity

getOnlineStatus()
OnlineStatus
Returns the OnlineStatus of the User.Returns OFFLINE if the ONLINE_STATUS cache flag is disabled.
OnlineStatus status = member.getOnlineStatus();
System.out.println("Status: " + status);
getActivities()
List<Activity>
The activities of the user.Requires the ACTIVITY cache flag to be enabled.
List<Activity> activities = member.getActivities();
for (Activity activity : activities) {
    System.out.println("Playing: " + activity.getName());
}
getActiveClients()
EnumSet<ClientType>
All active ClientTypes of this Member (web, mobile, desktop).Requires the CLIENT_STATUS cache flag to be enabled.
EnumSet<ClientType> clients = member.getActiveClients();
if (clients.contains(ClientType.MOBILE)) {
    System.out.println("User is on mobile");
}

Appearance

getAvatarId()
String
The Discord Id for this member’s per-guild avatar image.Returns null if the member has not set a per-guild avatar.
String avatarId = member.getAvatarId();
getEffectiveAvatarUrl()
String
The URL for the member’s effective avatar image. Falls back to the user’s avatar if no per-guild avatar is set.
String avatarUrl = member.getEffectiveAvatarUrl();
getColors()
RoleColors
The colors of this Member’s name in the Guild, determined by the highest role with a color.
RoleColors colors = member.getColors();
Color primary = colors.getPrimary();

Timeout Management

isTimedOut()
boolean
Whether this Member is in timeout.While timed out, members can only view channels and read message history.
if (member.isTimedOut()) {
    System.out.println("Member is timed out");
}
getTimeOutEnd()
OffsetDateTime
The time this Member will be released from timeout.Returns null if not in timeout.
OffsetDateTime timeoutEnd = member.getTimeOutEnd();

Member Actions

Moderation

ban(int deletionTimeframe, TimeUnit unit)
AuditableRestAction<Void>
Bans this Member from the Guild.
member.ban(7, TimeUnit.DAYS)
    .reason("Violation of rules")
    .queue();
kick()
AuditableRestAction<Void>
Kicks this Member from the Guild.
member.kick()
    .reason("Warning issued")
    .queue();
timeoutFor(long amount, TimeUnit unit)
AuditableRestAction<Void>
Puts this Member in timeout for a specific amount of time.Maximum timeout duration is 28 days.
member.timeoutFor(10, TimeUnit.MINUTES)
    .reason("Spam")
    .queue();
removeTimeout()
AuditableRestAction<Void>
Removes a timeout from this Member.
member.removeTimeout()
    .reason("Appealed")
    .queue();

Voice Management

mute(boolean mute)
AuditableRestAction<Void>
Sets the Guild muted state of this Member.Requires the member to be connected to a voice channel.
member.mute(true)
    .queue();
deafen(boolean deafen)
AuditableRestAction<Void>
Sets the Guild deafened state of this Member.Requires the member to be connected to a voice channel.
member.deafen(true)
    .queue();

Profile Management

modifyNickname(String nickname)
AuditableRestAction<Void>
Changes this Member’s nickname in the guild.Provide null or empty string to reset the nickname.
member.modifyNickname("NewNickname")
    .queue();

// Reset nickname
member.modifyNickname(null)
    .queue();

Usage Example

// Get member information
Member member = event.getMember();
System.out.println("Name: " + member.getEffectiveName());
System.out.println("Joined: " + member.getTimeJoined());

// Check permissions
if (member.hasPermission(Permission.ADMINISTRATOR)) {
    System.out.println("This user is an administrator");
}

// Check roles
for (Role role : member.getRoles()) {
    System.out.println("Role: " + role.getName());
}

// Moderate member
if (member.hasPermission(Permission.KICK_MEMBERS)) {
    targetMember.kick()
        .reason("Rule violation")
        .queue();
}

// Update nickname
member.modifyNickname("Cool Member")
    .queue(success -> {
        System.out.println("Nickname updated!");
    });

// Timeout member
member.timeoutFor(1, TimeUnit.HOURS)
    .reason("Spam")
    .queue();

Constants

MAX_TIME_OUT_LENGTH
int
Maximum number of days a Member can be timed out for: 28
MAX_NICKNAME_LENGTH
int
Max length of a member nickname: 32

See Also

Build docs developers (and LLMs) love