-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathbotConsole.js
More file actions
37 lines (33 loc) · 805 Bytes
/
botConsole.js
File metadata and controls
37 lines (33 loc) · 805 Bytes
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
/*
botConsole.log(message);
ideas:
- add colors
*/
class BotConsole {
constructor() {
this.string = [];
this.updateSettings();
}
renderSettings = () => {
setTimeout(() => {
this.updateSettings();
let interval = setInterval(() => {
this.updateSettings();
if (!uw.$('#modern_console').length) clearInterval(interval);
}, 1000);
}, 100);
return `<div class="console_modernbot" id="modern_console"><div>`;
};
log = (string) => {
const date = new Date();
const time = date.toLocaleTimeString();
this.string.push(`[${time}] ${string}`);
};
updateSettings = () => {
let console = uw.$('#modern_console');
this.string.forEach((e, i) => {
if (uw.$(`#log_id_${i}`).length) return;
console.prepend(`<p id="log_id_${i}">${e}</p>`);
});
};
}