Package discord4j.core.object.presence
Class ClientActivity
java.lang.Object
discord4j.core.object.presence.ClientActivity
Activity data that can be sent to Discord.
This is as opposed to Activity
which is received from Discord.
An activity is combined with a Status
to create a ClientPresence
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClientActivity
Creates acompeting
activity.static ClientActivity
Creates acustom
activity.discord4j.discordjson.json.ActivityUpdateRequest
Converts this activity's data to an object for use by the gateway.static ClientActivity
Creates alistening
activity.static ClientActivity
of
(Activity.Type type, String name, String url) Creates an activity with the given type, name, and url.static ClientActivity
of
(Activity.Type type, String name, String url, String state) Creates an activity with the given type, name, url and state.static ClientActivity
Creates aplaying
activity.static ClientActivity
Creates astreaming
activity.static ClientActivity
Creates awatching
activity.Create a newClientActivity
from this one by including the given "state" field value.
-
Method Details
-
playing
Creates aplaying
activity.- Parameters:
name
- the name of the activity- Returns:
- a playing activity with the given name
-
streaming
Creates astreaming
activity.- Parameters:
name
- the name of the activityurl
- the stream url- Returns:
- a streaming activity with the given name and url
-
listening
Creates alistening
activity.- Parameters:
name
- the name of the activity- Returns:
- a listening activity with the given name
-
watching
Creates awatching
activity.- Parameters:
name
- the name of the activity- Returns:
- a watching activity with the given name
-
competing
Creates acompeting
activity.- Parameters:
name
- the name of the activity- Returns:
- a competing activity with the given name
-
custom
Creates acustom
activity.- Parameters:
name
- the custom status used in this activity- Returns:
- a custom activity with the given "state" value
-
of
Creates an activity with the given type, name, and url.- Parameters:
type
- the type of the activityname
- the name of the activityurl
- the url of the activity (only valid forstreaming
activities)- Returns:
- an activity with the given type, name, and url
-
of
public static ClientActivity of(Activity.Type type, String name, @Nullable String url, @Nullable String state) Creates an activity with the given type, name, url and state.- Parameters:
type
- the type of the activityname
- the name of the activityurl
- the url of the activity if the type isSTREAMING
state
- the status if the type isCUSTOM
, or shown as additional data under an activity's name for other types- Returns:
- an activity with the given type, name, url and state
-
withState
Create a newClientActivity
from this one by including the given "state" field value. For activity types other thanActivity.Type.CUSTOM
, it will be shown as additional data under an activity's name.- Parameters:
state
- the custom status or additional data to include under an activity- Returns:
- a new client activity based on this one with the given state value
-
getActivityUpdateRequest
public discord4j.discordjson.json.ActivityUpdateRequest getActivityUpdateRequest()Converts this activity's data to an object for use by the gateway.- Returns:
- an equivalent
ActivityUpdateRequest
for this activity
-