-
Notifications
You must be signed in to change notification settings - Fork 2
/
ready.js
33 lines (31 loc) · 979 Bytes
/
ready.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
/*
Copyright 2021 Aman Verma. All rights reserved.
Use of this source code is governed by a MIT license that can be
found in the LICENSE file.
*/
const { createStream } = require("table");
const tableConfig = require("../../utils/tableConfig");
const { commandStatus, eventStatus } = require("../../utils/registry");
module.exports = async (client) => {
console.log(`${client.user.tag} has logged in.`);
client.user.setActivity("YOU ALL", { type: "LISTENING" });
await loadTable(commandStatus, 50);
console.log("\n");
await loadTable(eventStatus, 50);
};
function loadTable(arr, interval) {
let fn,
i = 0,
stream = createStream(tableConfig);
return new Promise((resolve) => {
fn = setInterval(() => {
if (i === arr.length) {
clearInterval(fn);
resolve();
} else {
stream.write(arr[i]);
i++;
}
}, interval);
});
}