summaryrefslogtreecommitdiff
path: root/src/main/richpresence.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/richpresence.ts')
-rw-r--r--src/main/richpresence.ts45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/richpresence.ts b/src/main/richpresence.ts
new file mode 100644
index 0000000..f39341b
--- /dev/null
+++ b/src/main/richpresence.ts
@@ -0,0 +1,45 @@
+// Only for testing as of right now
+const DiscordRPC = require('discord-rpc');
+
+const ClientId = '447258715586822154';
+
+DiscordRPC.register(ClientId);
+
+const rpc = new DiscordRPC.Client({ transport: 'ipc' });
+const startTimestamp = new Date();
+
+async function setActivity() {
+ if (!rpc)
+ return false;
+
+ rpc.setActivity({
+ details: `booped times`,
+ startTimestamp,
+ largeImageKey: 'connect',
+ largeImageText: 'Currently on map xy',
+ // smallImageKey: 'snek_small',
+ // smallImageText: 'i am my own pillows',
+ partySize:2, //TODO get online players
+ partyMax:100,
+ partyId:"ae488379-351d-4a4f-ad32-2b9b01c91657",
+ joinSecret:"MTI4NzM0OjFpMmhuZToxMjMxMjM="
+ });
+}
+
+rpc.on('ready', () => {
+ setActivity();
+
+ // activity can only be set every 15 seconds
+ setInterval(() => {
+ setActivity();
+ }, 15e3);
+});
+
+rpc.login(ClientId).catch(console.error);
+
+rpc.subscribe("",console.log);
+
+export function quit(){
+ rpc.destroy();
+ console.log("Shutting down Discord RPC integration");
+}