-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
126 lines (117 loc) · 5.12 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
const fs = require('fs');
const RPC = require("discord-rpc");
const rpc = new RPC.Client({
transport: "ipc"
});
const chalk = require("chalk");
const prompt = require("prompt");
var time = new Date().toDateString() + ' ' + new Date().toLocaleTimeString();
function choice() {
console.log(chalk.hex("#FABDF3")(`
▄▄▄ ▪ ▄▄· ▄ .▄ ▄▄▄·▄▄▄ ▄▄▄ ..▄▄ · ▄▄· ▄▄▄ . ▐ ▄ ▄▄· ▄▄▄ .
▀▄ █·██ ▐█ ▌▪██▪▐█ ▐█ ▄█▀▄ █·▀▄.▀·▐█ ▀. ▐█ ▌▪▀▄.▀·•█▌▐█▐█ ▌▪▀▄.▀·
▐▀▀▄ ▐█·██ ▄▄██▀▐█ ██▀·▐▀▀▄ ▐▀▀▪▄▄▀▀▀█▄██ ▄▄▐▀▀▪▄▐█▐▐▌██ ▄▄▐▀▀▪▄
▐█•█▌▐█▌▐███▌██▌▐▀ ▐█▪·•▐█•█▌▐█▄▄▌▐█▄▪▐█▐███▌▐█▄▄▌██▐█▌▐███▌▐█▄▄▌
.▀ ▀▀▀▀·▀▀▀ ▀▀▀ · .▀ .▀ ▀ ▀▀▀ ▀▀▀▀ ·▀▀▀ ▀▀▀ ▀▀ █▪·▀▀▀ ▀▀▀
[Made by Nomik]
`));
prompt.start();
console.log(chalk.inverse.hex("#ffb7c5")("Press Corrosponding Number for your choice!"));
console.log(chalk.hex("#ffb7c5")("[1] Load Config!"));
console.log(chalk.hex("#ffb7c5")("[2] Config Builder"));
console.log("");
prompt.get(['Options'], function(err, result) {
var options = result.Options;
switch (options) {
case "1":
console.log("");
console.log(chalk.inverse("Enter the Name of A Config File Within the Variables Folder!"));
importer();
break;
case "2":
console.log("");
builder();
break;
default:
console.clear()
choice();
break;
}
})
}
function builder() {
prompt.start();
prompt.get([`Config_Name`, `clientID`, `details`, `state`, `largeImageKey`, `largeImageText`, `smallImageKey`, `smallImageText`, `button1`, `url1`, `button2`, `url2`], function(err, result) {
var Config_Name = result.Config_Name;
var clientID = result.clientID;
var details = result.details;
var state = result.state;
var largeImageKey = result.largeImageKey;
var largeImageText = result.largeImageText;
var smallImageKey = result.smallImageKey;
var smallImageText = result.smallImageText;
var button1 = result.button1;
var url1 = result.url1;
var button2 = result.button2;
var url2 = result.url2;
var Newconfig = {
clientID: clientID,
details: details,
state: state,
largeImageKey: largeImageKey,
largeImageText: largeImageText,
smallImageKey: smallImageKey,
smallImageText: smallImageText,
button1: button1,
url1: url1,
button2: button2,
url2: url2
};
console.log(Newconfig);
let data = JSON.stringify(Newconfig, null, 2);
fs.writeFile(`configs/${Config_Name}.json`, data, (err) => {
if (err) throw err;
console.log(chalk.hex("00FF00")('[Success] Data written to file'));
console.log(chalk.hex("00FF00")(`[Presence] Now Running Rich Precense!`));
});
})
}
async function importer() {
await prompt.start();
prompt.get(['config'], function(err, result) {
var config = result.config;
var botconfig = require(`./configs/${config}.json`);
rpc.login({
clientId: botconfig.clientID
});
rpc.on("ready", () => {
rpc.setActivity({
startTimestamp: new Date(),
details: botconfig.details,
state: botconfig.state,
largeImageKey: botconfig.largeImageKey,
largeImageText: botconfig.largeImageText,
smallImageKey: botconfig.smallImageKey,
smallImageText: botconfig.smallImageText,
buttons: [{
label: botconfig.label1,
url: botconfig.url1
}, {
label: botconfig.label2,
url: botconfig.url2
}]
});
console.log(chalk.inverse.hex("#ffb7c5")(chalk.inverse.white(`[${time}]`) + ` Connected to Client ID: ${botconfig.clientID}`));
console.log(chalk.inverse.hex("#ffb7c5")(chalk.inverse.white(`[${time}]`) + ` State: ${botconfig.state}`));
console.log(chalk.inverse.hex("#ffb7c5")(chalk.inverse.white(`[${time}]`) + ` Details: ${botconfig.details}`));
});
rpc.on("disconnect", () => {
console.log(chalk.inverse.hex("#ffb7c5")(chalk.inverse.white(`[${time}]`) + ` Attempting to Reconnect Rich Presence!`));
rpc.login({
clientId: botconfig.clientID
});
})
})
}
process.title = "[313] Rich Prescence Tool";
choice();