-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.js
32 lines (26 loc) · 993 Bytes
/
index.js
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
const RPC = require("discord-rpc");
const config = require('./config.json');
// creating buttons based on config.json
buttonsArray = []
if (typeof config.button1 != "undefined" && typeof config.buttonURL1 != "undefined") {
buttonsArray.push({label: config.button1, url: config.buttonURL1});
}
if (typeof config.button2 != "undefined" && typeof config.buttonURL2 != "undefined") {
buttonsArray.push({label: config.button2, url: config.buttonURL2});
}
// rpc
const rpc = new RPC.Client({ transport: 'ipc' });
rpc.on("ready", () => {
console.log("Rich Presence set!")
rpc.setActivity({
largeImageKey: config.largeImage,
largeImageText: config.largeImageText,
smallImageKey: config.smallImage,
smallImageText: config.smallImage,
state: config.state,
details: config.details,
startTimestamp: new Date(),
buttons: buttonsArray
})
})
rpc.login({ clientId: config.clientID })