c 2b 2b discord rich presence

Solutions on MaxInterview for c 2b 2b discord rich presence by the best coders in the world

showing results for - "c 2b 2b discord rich presence"
Sofia
17 Apr 2016
1/*
2Anwser from greper
3Made by Mega145
4query: c++ discord rich presence
5*/
6
7/*
8Download instructions:
9https://github.com/discord/discord-rpc/releases
10choose release for your OS
11for windows i reccomend using win32 static
12from the include folder get both .h files
13and from the lib folder get the .lib file
14add the lib to ur project
15*/
16
17//Code
18#include "discord_rpc.h"
19// Required but we wont get indepth
20static void handleDiscordReady(const DiscordUser* connectedUser)
21{
22}
23
24static void handleDiscordDisconnected(int errcode, const char* message)
25{
26}
27
28static void handleDiscordError(int errcode, const char* message)
29{
30}
31
32static void handleDiscordJoin(const char* secret)
33{
34}
35
36static void handleDiscordSpectate(const char* secret)
37{
38}
39
40static void handleDiscordJoinRequest(const DiscordUser* request)
41{
42}
43//
44//                          V Get it here: https://discord.com/developers/applications
45static const char* ID = "YOUR APP ID";
46DiscordRichPresence discordPresence;
47DiscordEventHandlers handlers;
48memset(&handlers, 0, sizeof(handlers));
49handlers.ready = handleDiscordReady;
50handlers.disconnected = handleDiscordDisconnected;
51handlers.errored = handleDiscordError;
52handlers.joinGame = handleDiscordJoin;
53handlers.spectateGame = handleDiscordSpectate;
54handlers.joinRequest = handleDiscordJoinRequest;
55Discord_Initialize(ID, &handlers, 1, NULL);
56
57// Update presence:
58
59memset(&discordPresence, 0, sizeof(discordPresence)); //REQUIRED
60discordPresence.state = "State";      //REQUIRED
61discordPresence.details = "DETAILS";  //REQUIRED
62discordPresence.startTimestamp = 1507665886;
63discordPresence.endTimestamp = 1507665886;
64discordPresence.largeImageKey = "Large ImageKey"
65discordPresence.largeImageText = "Large ImageText";
66discordPresence.smallImageKey = "Small image key"
67discordPresence.smallImageText = "Small image text";
68discordPresence.partyId = "party-id";
69discordPresence.partySize = 1;
70discordPresence.partyMax = 2;
71discordPresence.joinSecret = "join-secret";
72Discord_UpdatePresence(&discordPresence); //REQUIRED
73