-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
42 lines (35 loc) · 941 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
33
34
35
36
37
38
39
40
41
42
const DiscordRPC = require("discord-rpc");
const RPC = new DiscordRPC.Client({ transport: "ipc" });
const config = require("./config.json");
DiscordRPC.register(config.CLIENT_ID);
const TIME = Date.now();
async function setActivity() {
if (!RPC) return;
RPC.setActivity({
details: config.FIRST_LINE,
state: config.SECOND_LINE,
startTimestamp: TIME,
largeImageKey: config.IMAGE_NAME,
largeImageText: config.IMAGE_TEXT,
smallImageKey: config.IMAGE_NAME,
smallImageText: config.IMAGE_TEXT,
instance: false,
buttons: [
{
label: config.BUTTON_1_TEXT,
url: config.BUTTON_1_URL,
},
{
label: config.BUTTON_2_TEXT,
url: config.BUTTON_2_URL,
},
],
});
}
RPC.on("ready", async () => {
setActivity();
setInterval(() => {
setActivity();
}, 15 * 1000);
});
RPC.login({ clientId: config.CLIENT_ID }).catch(error => console.error(error));