Skip to content

Commit

Permalink
Add Activity.platform (#995)
Browse files Browse the repository at this point in the history
When users play games from consoles, the Discord Activity API returns a
response like this:

{
  "type": 0,
  "timestamps": {
    "start": 1702191977428
  },
  "platform": "ps5",
  "name": "Sonic Superstars",
  "id": "20ac8563beebf2ec",
  "flags": 0,
  "created_at": 1702191977427,
  "assets": {
    "small_image": "mp:external/at5adOeXGcCj4jN9_zB0SiIL3FR8wOxq_d39CDh9Pqo/https/cdn.discordapp.com/assets/playstation-logo-rich-presence.png"
  }
}

This field is undocumented [1], but I confirmed this value was returned.

See also the PR for discord.py [2].

[1] https://discord.com/developers/docs/events/gateway-events#activity-object
[2] Rapptz/discord.py#9677
  • Loading branch information
giginet authored Jan 5, 2025
1 parent 70f4d59 commit 446d30c
Show file tree
Hide file tree
Showing 8 changed files with 256 additions and 30 deletions.
64 changes: 58 additions & 6 deletions common/api/common.api
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,56 @@ public final class dev/kord/common/entity/ActivityFlags$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}

public abstract class dev/kord/common/entity/ActivityPlatform {
public static final field Companion Ldev/kord/common/entity/ActivityPlatform$Companion;
public synthetic fun <init> (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun equals (Ljava/lang/Object;)Z
public final fun getValue ()Ljava/lang/String;
public final fun hashCode ()I
public final fun toString ()Ljava/lang/String;
}

public final class dev/kord/common/entity/ActivityPlatform$Android : dev/kord/common/entity/ActivityPlatform {
public static final field INSTANCE Ldev/kord/common/entity/ActivityPlatform$Android;
}

public final class dev/kord/common/entity/ActivityPlatform$Companion {
public final fun from (Ljava/lang/String;)Ldev/kord/common/entity/ActivityPlatform;
public final fun getEntries ()Ljava/util/List;
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}

public final class dev/kord/common/entity/ActivityPlatform$Desktop : dev/kord/common/entity/ActivityPlatform {
public static final field INSTANCE Ldev/kord/common/entity/ActivityPlatform$Desktop;
}

public final class dev/kord/common/entity/ActivityPlatform$Embedded : dev/kord/common/entity/ActivityPlatform {
public static final field INSTANCE Ldev/kord/common/entity/ActivityPlatform$Embedded;
}

public final class dev/kord/common/entity/ActivityPlatform$Ios : dev/kord/common/entity/ActivityPlatform {
public static final field INSTANCE Ldev/kord/common/entity/ActivityPlatform$Ios;
}

public final class dev/kord/common/entity/ActivityPlatform$PS4 : dev/kord/common/entity/ActivityPlatform {
public static final field INSTANCE Ldev/kord/common/entity/ActivityPlatform$PS4;
}

public final class dev/kord/common/entity/ActivityPlatform$PS5 : dev/kord/common/entity/ActivityPlatform {
public static final field INSTANCE Ldev/kord/common/entity/ActivityPlatform$PS5;
}

public final class dev/kord/common/entity/ActivityPlatform$Samsung : dev/kord/common/entity/ActivityPlatform {
public static final field INSTANCE Ldev/kord/common/entity/ActivityPlatform$Samsung;
}

public final class dev/kord/common/entity/ActivityPlatform$Unknown : dev/kord/common/entity/ActivityPlatform {
}

public final class dev/kord/common/entity/ActivityPlatform$Xbox : dev/kord/common/entity/ActivityPlatform {
public static final field INSTANCE Ldev/kord/common/entity/ActivityPlatform$Xbox;
}

public abstract class dev/kord/common/entity/ActivityType {
public static final field Companion Ldev/kord/common/entity/ActivityType$Companion;
public synthetic fun <init> (ILkotlin/jvm/internal/DefaultConstructorMarker;)V
Expand Down Expand Up @@ -2174,15 +2224,16 @@ public final class dev/kord/common/entity/DeletedMessage$Companion {

public final class dev/kord/common/entity/DiscordActivity {
public static final field Companion Ldev/kord/common/entity/DiscordActivity$Companion;
public fun <init> (Ljava/lang/String;Ldev/kord/common/entity/ActivityType;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V
public synthetic fun <init> (Ljava/lang/String;Ldev/kord/common/entity/ActivityType;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;Ldev/kord/common/entity/ActivityType;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V
public synthetic fun <init> (Ljava/lang/String;Ldev/kord/common/entity/ActivityType;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component10 ()Ldev/kord/common/entity/optional/Optional;
public final fun component11 ()Ldev/kord/common/entity/optional/Optional;
public final fun component12 ()Ldev/kord/common/entity/optional/Optional;
public final fun component13 ()Ldev/kord/common/entity/optional/OptionalBoolean;
public final fun component14 ()Ldev/kord/common/entity/optional/Optional;
public final fun component13 ()Ldev/kord/common/entity/optional/Optional;
public final fun component14 ()Ldev/kord/common/entity/optional/OptionalBoolean;
public final fun component15 ()Ldev/kord/common/entity/optional/Optional;
public final fun component16 ()Ldev/kord/common/entity/optional/Optional;
public final fun component2 ()Ldev/kord/common/entity/ActivityType;
public final fun component3 ()Ldev/kord/common/entity/optional/Optional;
public final fun component4 ()Lkotlinx/datetime/Instant;
Expand All @@ -2191,8 +2242,8 @@ public final class dev/kord/common/entity/DiscordActivity {
public final fun component7 ()Ldev/kord/common/entity/optional/Optional;
public final fun component8 ()Ldev/kord/common/entity/optional/Optional;
public final fun component9 ()Ldev/kord/common/entity/optional/Optional;
public final fun copy (Ljava/lang/String;Ldev/kord/common/entity/ActivityType;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/common/entity/DiscordActivity;
public static synthetic fun copy$default (Ldev/kord/common/entity/DiscordActivity;Ljava/lang/String;Ldev/kord/common/entity/ActivityType;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/common/entity/DiscordActivity;
public final fun copy (Ljava/lang/String;Ldev/kord/common/entity/ActivityType;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/common/entity/DiscordActivity;
public static synthetic fun copy$default (Ldev/kord/common/entity/DiscordActivity;Ljava/lang/String;Ldev/kord/common/entity/ActivityType;Ldev/kord/common/entity/optional/Optional;Lkotlinx/datetime/Instant;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/common/entity/DiscordActivity;
public fun equals (Ljava/lang/Object;)Z
public final fun getApplicationId ()Ldev/kord/common/entity/optional/OptionalSnowflake;
public final fun getAssets ()Ldev/kord/common/entity/optional/Optional;
Expand All @@ -2204,6 +2255,7 @@ public final class dev/kord/common/entity/DiscordActivity {
public final fun getInstance ()Ldev/kord/common/entity/optional/OptionalBoolean;
public final fun getName ()Ljava/lang/String;
public final fun getParty ()Ldev/kord/common/entity/optional/Optional;
public final fun getPlatform ()Ldev/kord/common/entity/optional/Optional;
public final fun getSecrets ()Ldev/kord/common/entity/optional/Optional;
public final fun getState ()Ldev/kord/common/entity/optional/Optional;
public final fun getTimestamps ()Ldev/kord/common/entity/optional/Optional;
Expand Down
Loading

0 comments on commit 446d30c

Please sign in to comment.