Class PresenceUpdateEvent

java.lang.Object
discord4j.core.event.domain.Event
discord4j.core.event.domain.PresenceUpdateEvent

public class PresenceUpdateEvent extends Event
Dispatched when a user's presence changes. This includes username, discriminator, and avatar changes.

The old presence may not be present if presences are not stored.

This event is dispatched by Discord.

See Also:
  • Constructor Details

  • Method Details

    • getGuildId

      public Snowflake getGuildId()
      Gets the Snowflake ID of the Guild containing the User whose presence has been updated.
      Returns:
      The ID of the Guild involved.
    • getGuild

      public Mono<Guild> getGuild()
      Gets the Guild containing the User whose presence has been updated.
      Returns:
      A Mono where, upon successful completion, emits the Guild involved in the event.
    • getOldUser

      public Optional<User> getOldUser()
      Gets the old version of the User that was updated, if present. This may not be available if Users are not stored.
      Returns:
      The old version of the User, if present.
    • getNewUsername

      public Optional<String> getNewUsername()
      Gets the User's new username, if present. This may not exist if the user's username has not been changed.
      Returns:
      The User's new username, if present.
    • getNewDiscriminator

      public Optional<String> getNewDiscriminator()
      Gets the User's new discriminator, if present. This may not exist if the User's discriminator has not been changed.
      Returns:
      The User's new discriminator, if present.
    • getNewAvatar

      public Optional<String> getNewAvatar()
      Gets the User's new avatar, if present. This may not exist if the User's discriminator has not been changed.
      Returns:
      The user's new avatar, if present.
    • getUserId

      public Snowflake getUserId()
      Gets the Snowflake ID of the User whose presence has been updated in this event.
      Returns:
      The ID of the User whose presence has been updated.
    • getUser

      public Mono<User> getUser()
      Requests to retrieve the User whose presence has been changed in this event.
      Returns:
      A Mono where, upon successful completion, emits the User involved in this event. If an error is received, it is emitted through the Mono.
    • getMember

      public Mono<Member> getMember()
      Requests to retrieve the Member object of the User involved in this event.
      Returns:
      A Mono where, upon successful completion, emits the Member involved in this event. If an error is received, it is emitted through the Mono.
    • getCurrent

      public Presence getCurrent()
      Gets the current, new version of the Presence.
      Returns:
      The current, new version of the Presence.
    • getOld

      public Optional<Presence> getOld()
      Gets the old version of the Presence that was changed, if present. This may not be available if Presence are not stored.
      Returns:
      The old version of the Presence, if present.
    • toString

      public String toString()
      Overrides:
      toString in class Object