Package net.dv8tion.jda.core.managers
Interface Presence
-
public interface Presence
The Presence associated with the provided JDA instance- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Game
getGame()
The current Game for this session.JDA
getJDA()
The JDA instance of this PresenceOnlineStatus
getStatus()
The current OnlineStatus for this session.boolean
isIdle()
Whether the current session is marked as afk or not.void
setGame(Game game)
Sets theGame
for this session.void
setIdle(boolean idle)
Sets whether this session should be marked as afk or notvoid
setPresence(Game 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, Game game)
Sets two presence fields of this session.void
setPresence(OnlineStatus status, Game game, boolean idle)
Sets all presence fields of this session.void
setStatus(OnlineStatus status)
Sets theOnlineStatus
for this session
-
-
-
Method Detail
-
getJDA
JDA getJDA()
The JDA instance of this Presence- Returns:
- The current JDA instance
-
getStatus
OnlineStatus getStatus()
The current OnlineStatus for this session.
This might not be what the Discord Client displays due to session clashing!- Returns:
- The
OnlineStatus
of the current session
-
getGame
Game getGame()
The current Game for this session.
This might not be what the Discord Client displays due to session clashing!- Returns:
- The
Game
of the current session or null if no game is set
-
isIdle
boolean isIdle()
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.
- Returns:
- True if this session is marked as afk
-
setStatus
void setStatus(OnlineStatus status)
Sets theOnlineStatus
for this session- Parameters:
status
- theOnlineStatus
to be used (OFFLINE/null -> INVISIBLE)- Throws:
java.lang.IllegalArgumentException
- if the provided OnlineStatus isUNKNOWN
-
setGame
void setGame(Game game)
Sets theGame
for this session.
A Game can be retrieved viaGame.playing(String)
. For streams you provide a valid streaming url as second parameterExamples:
presence.setGame(Game.playing("Thrones"));
presence.setGame(Game.streaming("Thrones", "https://twitch.tv/EasterEggs"));
- Parameters:
game
- AGame
instance or null to reset- See Also:
Game.playing(String)
,Game.streaming(String, String)
-
setIdle
void setIdle(boolean idle)
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.
- Parameters:
idle
- boolean
-
setPresence
void setPresence(OnlineStatus status, Game game, boolean idle)
Sets all presence fields of this session.- Parameters:
status
- TheOnlineStatus
for this session (SeesetStatus(OnlineStatus)
)game
- TheGame
for this session (SeesetGame(Game)
for more info)idle
- Whether to mark this session as idle (useful for client accountssetIdle(boolean)
)- Throws:
java.lang.IllegalArgumentException
- If the specified OnlineStatus isUNKNOWN
-
setPresence
void setPresence(OnlineStatus status, Game game)
Sets two presence fields of this session.
The third field stays untouched.- Parameters:
status
- TheOnlineStatus
for this session (SeesetStatus(OnlineStatus)
)game
- TheGame
for this session (SeesetGame(Game)
for more info)- Throws:
java.lang.IllegalArgumentException
- If the specified OnlineStatus isUNKNOWN
-
setPresence
void setPresence(OnlineStatus status, boolean idle)
Sets two presence fields of this session.
The third field stays untouched.- Parameters:
status
- TheOnlineStatus
for this session (SeesetStatus(OnlineStatus)
)idle
- Whether to mark this session as idle (useful for client accountssetIdle(boolean)
)- Throws:
java.lang.IllegalArgumentException
- If the specified OnlineStatus isUNKNOWN
-
setPresence
void setPresence(Game game, boolean idle)
Sets two presence fields of this session.
The third field stays untouched.- Parameters:
game
- TheGame
for this session (SeesetGame(Game)
for more info)idle
- Whether to mark this session as idle (useful for client accountssetIdle(boolean)
)
-
-