-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.js
More file actions
22 lines (18 loc) · 752 Bytes
/
start.js
File metadata and controls
22 lines (18 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const Discord = require('discord.js');
const client = new Discord.Client();
const config = require('./config.json');
const fs = require('fs');
//Call listeners
fs.readdir('./listeners/', (err, files) => {
if (err) return console.log(err);
files.forEach(file => {
let eventFunction = require(`./listeners/${file}`);
let eventName = file.split('.')[0];
console.log("[WumpusOS] Starting " + eventName + "... ");
client.on(eventName, (...args) => eventFunction.run(client, ...args));
});
});
let commandhandler = require(`./commands/commands_handler`);
client.on('message', (...args) => commandhandler.run(client, ...args));
client.on('error', console.error);
client.login(config.token).catch(console.error);