Class GuildMemberRemoveEvent
- java.lang.Object
-
- net.dv8tion.jda.api.events.Event
-
- net.dv8tion.jda.api.events.guild.GenericGuildEvent
-
- net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent
-
- All Implemented Interfaces:
GenericEvent
public class GuildMemberRemoveEvent extends GenericGuildEvent
Indicates that a user was removed from aGuild
. This includes kicks, bans, and leaves respectively.
This can be fired for uncached members and cached members alike. If the member was not cached by JDA, due to theMemberCachePolicy
or disabled member chunking, thengetMember()
will returnnull
.Can be used to detect when a member is removed from a guild, either by leaving or being kicked/banned.
Requirements
This event requires the
GUILD_MEMBERS
intent to be enabled.createDefault(String)
andcreateLight(String)
disable this by default!
-
-
Constructor Summary
Constructors Constructor Description GuildMemberRemoveEvent(JDA api, long responseNumber, Guild guild, User user, Member member)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Member
getMember()
The member instance for this user, if it was cached at the time.User
getUser()
The corresponding user who was removed from the guild.-
Methods inherited from class net.dv8tion.jda.api.events.guild.GenericGuildEvent
getGuild
-
Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getResponseNumber
-
-
-
-
Method Detail
-
getUser
@Nonnull public User getUser()
The corresponding user who was removed from the guild.- Returns:
- The user who was removed
-
getMember
@Nullable public Member getMember()
The member instance for this user, if it was cached at the time.
Discord does not provide the member meta-data when a remove event is dispatched.- Returns:
- Possibly-null member
-
-