Class ClientActivity


  • public class ClientActivity
    extends Object
    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 Detail

      • playing

        public static ClientActivity playing​(String name)
        Creates a playing activity.
        Parameters:
        name - The name of the activity.
        Returns:
        A playing activity with the given name.
      • streaming

        public static ClientActivity streaming​(String name,
                                               String url)
        Creates a streaming activity.
        Parameters:
        name - The name of the activity.
        url - The stream url.
        Returns:
        A streaming activity with the given name and url.
      • listening

        public static ClientActivity listening​(String name)
        Creates a listening activity.
        Parameters:
        name - The name of the activity.
        Returns:
        A listening activity with the given name.
      • watching

        public static ClientActivity watching​(String name)
        Creates a watching activity.
        Parameters:
        name - The name of the activity.
        Returns:
        A watching activity with the given name.
      • competing

        public static ClientActivity competing​(String name)
        Creates a competing activity.
        Parameters:
        name - The name of the activity.
        Returns:
        A competing activity with the given name.
      • of

        public static ClientActivity of​(Activity.Type type,
                                        String name,
                                        @Nullable
                                        String url)
        Creates an activity with the given type, name, and url.
        Parameters:
        type - The type of the activity.
        name - The name of the activity.
        url - The url of the activity (only valid for streaming activities).
        Returns:
        An activity with the given type, name, and url.
      • 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.