-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbot.js
More file actions
27 lines (22 loc) · 685 Bytes
/
bot.js
File metadata and controls
27 lines (22 loc) · 685 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
const config = require('./config.json');
const Discord = require('discord.js');
const messageHandler = require('./messageHandler.js');
const Persistance = require('./persistance');
const p = new Persistance();
const client = new Discord.Client();
client.on('ready', () => {
p.init('wombot-config').then(() => {
const wombot = client.channels.find('name', 'wombot');
if (wombot) {
wombot.send('*wombat noises* [wombot started]');
}
messageHandler.init(client, p);
});
});
client.on('error', (err) => {
console.log(err);
});
client.on('message', (msg) => {
messageHandler.handle(msg);
});
client.login(config.auth.token);