-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
39 lines (37 loc) · 1.22 KB
/
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
const { Client } = require('discord-rpc');
const { DETAILS, STATE, LARGE_IMAGE, LARGE_TEXT, SMALL_IMAGE, SMALL_TEXT, BUTTONS } = require('./config');
const checkConfig = require('./helpers/checkConfig');
require("dotenv").config();
checkConfig();
const client = new Client({
transport: 'ipc'
});
client.on('ready', async () => {
console.log("Loading Rich Presence...");
try {
await client.request('SET_ACTIVITY', {
pid: process.pid,
activity: {
details: DETAILS,
state: STATE,
timestamps: {
start: Date.now()
},
assets: { //comment this part if you don't want to add images or comment a specific part
large_image: LARGE_IMAGE,
large_text: LARGE_TEXT,
small_image: SMALL_IMAGE,
small_text: SMALL_TEXT
},
buttons: BUTTONS
}
});
console.log("Rich Presence loaded successfully");
} catch (error) {
console.error("Error loading Rich Presence", error);
}
});
client.login({
clientId: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET
});