Skip to content

Commit 4d5d6e6

Browse files
committed
Implement display type and clickable status text links
See discord/discord-api-docs#7674 Thank you @foxfirecodes!
1 parent f726539 commit 4d5d6e6

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

include/discord_rpc.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ extern "C" {
2626
#define DISCORD_BUTTONS_SIZE 2
2727

2828
typedef struct DiscordButton {
29-
const char* label;
30-
const char* url;
29+
const char* label; /* FIXME limit? */
30+
const char* url; /* FIXME limit? */
3131
} DiscordButton;
3232

3333
typedef enum DiscordActivityType {
@@ -39,10 +39,19 @@ typedef enum DiscordActivityType {
3939
DiscordActivityType_Competing = 5
4040
} DiscordActivityType;
4141

42+
typedef enum DiscordStatusDisplayType {
43+
DiscordStatusDisplayType_Name = 0, // the default
44+
DiscordStatusDisplayType_State = 1,
45+
DiscordStatusDisplayType_Details = 2
46+
} DiscordStatusDisplayType;
47+
4248
typedef struct DiscordRichPresence {
4349
DiscordActivityType type;
44-
const char* state; /* max 128 bytes */
45-
const char* details; /* max 128 bytes */
50+
DiscordStatusDisplayType status_display_type;
51+
const char* state; /* max 128 bytes */
52+
const char* state_url; /* FIXME limit? */
53+
const char* details; /* max 128 bytes */
54+
const char* details_url; /* FIXME limit? */
4655
int64_t startTimestamp;
4756
int64_t endTimestamp;
4857
const char* largeImageKey; /* max 32 bytes */

src/serialization.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,14 @@ size_t JsonWriteRichPresenceObj(char* dest,
108108
WriteKey(writer, "type");
109109
writer.Int(presence->type);
110110

111+
WriteKey(writer, "status_display_type");
112+
writer.Int(presence->status_display_type);
113+
111114
WriteOptionalString(writer, "state", presence->state);
115+
WriteOptionalString(writer, "state_url", presence->state_url);
116+
112117
WriteOptionalString(writer, "details", presence->details);
118+
WriteOptionalString(writer, "details_url", presence->details_url);
113119

114120
if (presence->startTimestamp || presence->endTimestamp) {
115121
WriteObject timestamps(writer, "timestamps");

0 commit comments

Comments
 (0)