This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsrp-console.mjs
45 lines (40 loc) · 1.36 KB
/
jsrp-console.mjs
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
import chalk from "chalk";
import io from "socket.io-client";
// let url = "http://painel.saturno-2287.ga:30130";
let url = "http://localhost:30130";
const socket = io.connect(url, { reconnect: true });
const getFromColor = (from) => {
if (from == "c") return chalk.blueBright(`[${from}]`);
if (from == "n") return chalk.magentaBright(`[${from}]`);
return chalk.yellow(`[${from}]`);
};
socket.on("connect", () => {
console.log("");
console.log(" o8o ooooooooo. ooooooooo. ");
console.log(" ` `888 `Y88. `888 `Y88. ");
console.log(" oooo .oooo.o 888 .d88 888 .d88 ");
console.log(' `888 d88( "8 888ooo88P 888ooo88P ');
console.log(' 888 `"Y88b. 888`88b. 888 ');
console.log(" 888 o. )88b 888 `88b. 888 ");
console.log(' 888 8""888P o888o o888o o888o ');
console.log(" 888");
console.log(".o. 88P");
console.log("`Y888P");
console.log("");
console.log(chalk.green("Connected! ") + socket.id);
});
socket.onAny((eventName, ...args) => {
// console.log(eventName);
// console.log(args);
});
socket.on("log", (log) => {
console.log(log);
});
socket.on("prettylog", (from, modl, log) => {
let fr = getFromColor(from);
try {
console.log(`${fr} [${modl}]`, JSON.parse(log));
} catch (error) {
console.log(`${fr} [${modl}]`, log);
}
});