1 #pragma once
2 #include <stdint.h>
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 typedef struct DiscordRichPresence
9 {
10     const char* state;          /* max 128 bytes */
11     const char* details;        /* max 128 bytes */
12     int64_t startTimestamp;
13     int64_t endTimestamp;
14     const char* largeImageKey;  /* max 32 bytes */
15     const char* largeImageText; /* max 128 bytes */
16     const char* smallImageKey;  /* max 32 bytes */
17     const char* smallImageText; /* max 128 bytes */
18     const char* partyId;        /* max 128 bytes */
19     int partySize;
20     int partyMax;
21     const char* matchSecret;    /* max 128 bytes */
22     const char* joinSecret;     /* max 128 bytes */
23     const char* spectateSecret; /* max 128 bytes */
24     int8_t instance;
25 } DiscordRichPresence;
26 
27 typedef struct DiscordUser
28 {
29     const char* userId;
30     const char* username;
31     const char* discriminator;
32     const char* avatar;
33 } DiscordUser;
34 
35 typedef struct DiscordEventHandlers
36 {
37     void (*ready)(const DiscordUser* request);
38     void (*disconnected)(int errorCode, const char* message);
39     void (*errored)(int errorCode, const char* message);
40     void (*joinGame)(const char* joinSecret);
41     void (*spectateGame)(const char* spectateSecret);
42     void (*joinRequest)(const DiscordUser* request);
43 } DiscordEventHandlers;
44 
45 #define DISCORD_REPLY_NO 0
46 #define DISCORD_REPLY_YES 1
47 #define DISCORD_REPLY_IGNORE 2
48 
49 void Discord_Initialize(const char* applicationId,
50       DiscordEventHandlers* handlers,
51       int autoRegister,
52       const char* optionalSteamId);
53 void Discord_Shutdown(void);
54 
55 /* checks for incoming messages, dispatches callbacks */
56 void Discord_RunCallbacks(void);
57 
58 /* If you disable the lib starting its own I/O thread,
59  * you'll need to call this from your own */
60 #ifdef DISCORD_DISABLE_IO_THREAD
61 void Discord_UpdateConnection(void);
62 #endif
63 
64 void Discord_UpdatePresence(const DiscordRichPresence* presence);
65 void Discord_ClearPresence(void);
66 
67 void Discord_Respond(const char* userid,
68       /* DISCORD_REPLY_ */ int reply);
69 
70 void Discord_UpdateHandlers(DiscordEventHandlers* handlers);
71 
72 #ifdef __cplusplus
73 } /* extern "C" */
74 #endif
75