Package discord4j.core.event.domain
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:
- Presence Update
-
-
Constructor Summary
Constructors Constructor Description PresenceUpdateEvent(GatewayDiscordClient gateway, ShardInfo shardInfo, long guildId, User oldUser, discord4j.discordjson.json.PartialUserData user, Presence current, Presence old)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Presence
getCurrent()
Gets the current, new version of thePresence
.Mono<Guild>
getGuild()
Snowflake
getGuildId()
Mono<Member>
getMember()
Optional<String>
getNewAvatar()
Gets theUser
's new avatar, if present.Optional<String>
getNewDiscriminator()
Gets theUser
's new discriminator, if present.Optional<String>
getNewUsername()
Gets theUser
's new username, if present.Optional<Presence>
getOld()
Gets the old version of thePresence
that was changed, if present.Optional<User>
getOldUser()
Gets the old version of theUser
that was updated, if present.Mono<User>
getUser()
Requests to retrieve theUser
whose presence has been changed in this event.Snowflake
getUserId()
String
toString()
-
Methods inherited from class discord4j.core.event.domain.Event
getClient, getShardInfo
-
-
-
-
Method Detail
-
getOldUser
public Optional<User> getOldUser()
Gets the old version of theUser
that was updated, if present. This may not be available ifUsers
are not stored.- Returns:
- The old version of the
User
, if present.
-
getNewUsername
public Optional<String> getNewUsername()
Gets theUser
's new username, if present. This may not exist if theuser
's username has not been changed.- Returns:
- The
User
's new username, if present.
-
getNewDiscriminator
public Optional<String> getNewDiscriminator()
Gets theUser
's new discriminator, if present. This may not exist if theUser
's discriminator has not been changed.- Returns:
- The
User
's new discriminator, if present.
-
getNewAvatar
public Optional<String> getNewAvatar()
Gets theUser
's new avatar, if present. This may not exist if theUser
's discriminator has not been changed.- Returns:
- The user's new avatar, if present.
-
getUser
public Mono<User> getUser()
Requests to retrieve theUser
whose presence has been changed in this event.
-
getCurrent
public Presence getCurrent()
Gets the current, new version of thePresence
.- Returns:
- The current, new version of the
Presence
.
-
getOld
public Optional<Presence> getOld()
Gets the old version of thePresence
that was changed, if present. This may not be available ifPresence
are not stored.- Returns:
- The old version of the
Presence
, if present.
-
-