-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Discord.cpp
43 lines (32 loc) · 1.05 KB
/
Discord.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "Discord.h"
#include <time.h>
#include <ctime>
static time_t g_startTime;
void Discord::initialize(bool setTimestamp)
{
DiscordEventHandlers handlers;
memset(&handlers, 0, sizeof(handlers));
// Initialize Discord RPC
Discord_Initialize("997798118185771059", &handlers, 1, NULL);
// Prepare rich presence struct
DiscordRichPresence discordRichPresence;
memset(&discordRichPresence, 0, sizeof(discordRichPresence));
if (setTimestamp) {
g_startTime = std::time(0);
}
discordRichPresence.startTimestamp = g_startTime;
discordRichPresence.state = "In Menu";
discordRichPresence.details = "Browsing catalog";
discordRichPresence.largeImageKey = "https://avatars.githubusercontent.com/u/13152917";
discordRichPresence.largeImageText = "Stremio";
// Update Discord presence
update(discordRichPresence);
}
void Discord::update(DiscordRichPresence discordRichPresence)
{
Discord_UpdatePresence(&discordRichPresence);
}
time_t Discord::GetStartTime()
{
return g_startTime;
}