-
Notifications
You must be signed in to change notification settings - Fork 0
/
havePants.js
49 lines (43 loc) · 1.21 KB
/
havePants.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
43
44
45
46
47
48
49
const DiscordRPC = require('discord-rpc'),
log = require("fancy-log");
const keys = require('./keys.json');
const rpc = new DiscordRPC.Client({transport: keys.rpcTransportType}),
appClient = keys.havePantsId,
largeImageKey = keys.imageKeys.pants;
// const date = new Date();
// newYear = new Date();
rpc.on('ready', () => {
log(`Connected to Discord! (${appClient})`);
//var newYear = new Date();
// newYear.setTime(23*1000*60*60);
// newYear.setFullYear(2018, 0, 1);
// log(`time set to: (${newYear})`);
f();
setInterval(f, f1(10))
});
// setInterval(f2, f1(10))
f2();
function f() {
let d = {
//details: "For",
state: "https://youtu.be/3j2uBoC5nUA",
//startTimestamp: date,
// endTimestamp: date,
largeImageKey: largeImageKey,
//smallImageKey: smallImageKey,
largeImageText: undefined,
//smallImageText: undefined,
instance: false,
};
rpc.setActivity(d);
log("setting activity " + d);
}
function f1(a) {
return a * 60 * 1000;
}
function f2() {
log("(re)starting rpc connection");
rpc.login({
clientId: appClient
}).catch(log.error);
}