Merge d23dd4fdbc17292f513103e83c1c203210e38d98 into 963aa9f3e5ce81a4682c6ca3d136cddda614db33

This commit is contained in:
MrKuBu 2023-12-03 16:12:25 -07:00 committed by GitHub
commit 4e2df0744c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 8 deletions

View File

@ -1,6 +1,7 @@
version: '{build}'
install:
- python -m pip install click
- python -m pip install build.py
build_script:
- mkdir examples\unrealstatus\Plugins\discordrpc\Binaries\ThirdParty\discordrpcLibrary\Win64

View File

@ -44,14 +44,20 @@ static void updateDiscordPresence()
discordPresence.endTimestamp = time(0) + 5 * 60;
discordPresence.largeImageKey = "canary-large";
discordPresence.smallImageKey = "ptb-small";
discordPresence.partyId = "party1234";
discordPresence.partySize = 1;
discordPresence.partyMax = 6;
discordPresence.partyPrivacy = DISCORD_PARTY_PUBLIC;
discordPresence.matchSecret = "xyzzy";
discordPresence.joinSecret = "join";
discordPresence.spectateSecret = "look";
discordPresence.instance = 0;
// TEMP DISABLE (Join and Spectate)
//discordPresence.partyId = "party1234";
//discordPresence.partySize = 1;
//discordPresence.partyMax = 6;
//discordPresence.partyPrivacy = DISCORD_PARTY_PUBLIC;
//discordPresence.matchSecret = "xyzzy";
//discordPresence.joinSecret = "join";
//discordPresence.spectateSecret = "look";
//discordPresence.instance = 0;
// EXAMPLE BUTTONS
discordPresence.button1Label = "Example 1 button";
discordPresence.button1Url = "https://example.com";
discordPresence.button2Label = "Example 2 button";
discordPresence.button2Url = "https://example.com";
Discord_UpdatePresence(&discordPresence);
}
else {

View File

@ -39,6 +39,10 @@ typedef struct DiscordRichPresence {
const char* matchSecret; /* max 128 bytes */
const char* joinSecret; /* max 128 bytes */
const char* spectateSecret; /* max 128 bytes */
const char* button1Label; /* max 32 bytes */
const char* button1Url; /* max 512 bytes */
const char* button2Label; /* max 32 bytes */
const char* button2Url; /* max 512 bytes */
int8_t instance;
} DiscordRichPresence;

View File

@ -158,6 +158,32 @@ size_t JsonWriteRichPresenceObj(char* dest,
WriteOptionalString(writer, "spectate", presence->spectateSecret);
}
// Add Custom buttons and links (2 Buttons)
if (((presence->button1Label && presence->button1Label[0]) &&
(presence->button1Url && presence->button1Url[0])) ||
((presence->button2Label && presence->button2Label[0]) &&
(presence->button2Url && presence->button2Url[0]))) {
WriteArray buttons(writer, "buttons");
if ((presence->button1Label && presence->button1Label[0]) &&
(presence->button1Url && presence->button1Url[0])) {
WriteObject button1(writer);
writer.Key("label");
writer.String(presence->button1Label);
writer.Key("url");
writer.String(presence->button1Url);
}
if ((presence->button2Label && presence->button2Label[0]) &&
(presence->button2Url && presence->button2Url[0])) {
WriteObject button2(writer);
writer.Key("label");
writer.String(presence->button2Label);
writer.Key("url");
writer.String(presence->button2Url);
}
}
writer.Key("instance");
writer.Bool(presence->instance != 0);
}