Class PresenceImpl
java.lang.Object
net.dv8tion.jda.internal.managers.PresenceImpl
- All Implemented Interfaces:
Presence
The Presence associated with the provided JDA instance
Note that this does not automatically handle the 5/60 second rate limit!
Note that this does not automatically handle the 5/60 second rate limit!
- Since:
- 3.0
-
Constructor Summary
ConstructorsConstructorDescriptionPresenceImpl
(JDAImpl jda) Creates a new Presence representation for the provided JDAImpl instance -
Method Summary
Modifier and TypeMethodDescriptionThe current Activity for this session.static DataObject
getGameJson
(Activity activity) getJDA()
The JDA instance of this PresenceThe current OnlineStatus for this session.boolean
isIdle()
Whether the current session is marked as afk or not.void
setActivity
(Activity game) Sets theActivity
for this session.setCacheActivity
(Activity game) setCacheIdle
(boolean idle) setCacheStatus
(OnlineStatus status) void
setIdle
(boolean idle) Sets whether this session should be marked as afk or notvoid
setPresence
(Activity game, boolean idle) Sets two presence fields of this session.void
setPresence
(OnlineStatus status, boolean idle) Sets two presence fields of this session.void
setPresence
(OnlineStatus status, Activity activity) Sets two presence fields of this session.void
setPresence
(OnlineStatus status, Activity activity, boolean idle) Sets all presence fields of this session.void
setStatus
(OnlineStatus status) Sets theOnlineStatus
for this session
-
Constructor Details
-
PresenceImpl
Creates a new Presence representation for the provided JDAImpl instance- Parameters:
jda
- The not-null JDAImpl instance to use
-
-
Method Details
-
getJDA
Description copied from interface:Presence
The JDA instance of this Presence -
getStatus
Description copied from interface:Presence
The current OnlineStatus for this session.
This might not be what the Discord Client displays due to session clashing!- Specified by:
getStatus
in interfacePresence
- Returns:
- The
OnlineStatus
of the current session
-
getActivity
Description copied from interface:Presence
The current Activity for this session.
This might not be what the Discord Client displays due to session clashing!- Specified by:
getActivity
in interfacePresence
- Returns:
- The
Activity
of the current session or null if no activity is set
-
isIdle
public boolean isIdle()Description copied from interface:Presence
Whether the current session is marked as afk or not.This is relevant to client accounts to monitor whether new messages should trigger mobile push-notifications.
-
setStatus
Description copied from interface:Presence
Sets theOnlineStatus
for this session- Specified by:
setStatus
in interfacePresence
- Parameters:
status
- theOnlineStatus
to be used (OFFLINE/null -> INVISIBLE)
-
setActivity
Description copied from interface:Presence
Sets theActivity
for this session.
An Activity can be retrieved viaActivity.playing(String)
. For streams you provide a valid streaming url as second parameterExamples:
presence.setActivity(Activity.playing("Thrones"));
presence.setActivity(Activity.streaming("Thrones", "https://twitch.tv/EasterEggs"));
- Specified by:
setActivity
in interfacePresence
- Parameters:
game
- AnActivity
instance or null to reset- See Also:
-
setIdle
public void setIdle(boolean idle) Description copied from interface:Presence
Sets whether this session should be marked as afk or notThis is relevant to client accounts to monitor whether new messages should trigger mobile push-notifications.
-
setPresence
Description copied from interface:Presence
Sets all presence fields of this session.- Specified by:
setPresence
in interfacePresence
- Parameters:
status
- TheOnlineStatus
for this session (SeePresence.setStatus(OnlineStatus)
)activity
- TheActivity
for this session (SeePresence.setActivity(net.dv8tion.jda.api.entities.Activity)
for more info)idle
- Whether to mark this session as idle (useful for client accountsPresence.setIdle(boolean)
)
-
setPresence
Description copied from interface:Presence
Sets two presence fields of this session.
The third field stays untouched.- Specified by:
setPresence
in interfacePresence
- Parameters:
status
- TheOnlineStatus
for this session (SeePresence.setStatus(OnlineStatus)
)activity
- TheActivity
for this session (SeePresence.setActivity(net.dv8tion.jda.api.entities.Activity)
for more info)
-
setPresence
Description copied from interface:Presence
Sets two presence fields of this session.
The third field stays untouched.- Specified by:
setPresence
in interfacePresence
- Parameters:
status
- TheOnlineStatus
for this session (SeePresence.setStatus(OnlineStatus)
)idle
- Whether to mark this session as idle (useful for client accountsPresence.setIdle(boolean)
)
-
setPresence
Description copied from interface:Presence
Sets two presence fields of this session.
The third field stays untouched.- Specified by:
setPresence
in interfacePresence
- Parameters:
game
- TheActivity
for this session (SeePresence.setActivity(net.dv8tion.jda.api.entities.Activity)
for more info)idle
- Whether to mark this session as idle (useful for client accountsPresence.setIdle(boolean)
)
-
setCacheStatus
-
setCacheActivity
-
setCacheIdle
-
getFullPresence
-
getGameJson
-