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 a Guild. 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 the MemberCachePolicy or disabled member chunking, then getMember() will return null.

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) and createLight(String) disable this by default!

  • Constructor Details

  • Method Details

    • 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