-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (28 loc) · 838 Bytes
/
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
const Reader = require("./reader.js");
const Bot = require("./discord.js");
const Data = require("./data");
const settings = require("./settings.json");
var library = [];
async function constructReaders(rDataList) {
await rDataList.forEach(rData => {
var channel = Bot.client.channels.get(rData.readChannel);
if (channel) {
library.push(new Reader(channel, rData));
}
});
console.log(library);
}
function startup() {
console.log(`Logged in as ${Bot.client.user.username} within ${Bot.client.guilds.size} guilds!`);
Data.getAllData()
.then(constructReaders)
.catch(console.error);
}
Bot.client.on("ready", startup);
if (settings) {
Bot.client.login(settings.token)
.then()
.catch(console.error);
} else {
console.error("settings.json file missing!");
}