forked from ktiedt/NodeJS-IRC-Bot
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bot.js
42 lines (36 loc) · 959 Bytes
/
bot.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
36
37
38
39
40
41
42
/**
* IRC Bot
*
* @author Michael Owens
* @website http://www.michaelowens.nl
* @copyright Michael Owens 2011
*/
var sys = require('util'),
irc = require('./lib/irc'),
pkgconfig = require('pkgconfig'),
winston = require('winston'),
argv = require('optimist').default('config', 'config').argv; // alternative: nconf
var confName = argv.config;
/**
* More advanced config
*
* we should provide a way to "enable" environment specific configs (like
* found on rails apps)
*/
var options = {
schema: 'config/schema.json',
config: 'config/' + confName + '.json'
};
var config = pkgconfig(options);
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({ level: config.logLevel })
// new (winston.transports.File)({ level: config.logLevel, filename: 'ircbot.log' })
]
});
config.logger = logger;
/**
* Let's power up
*/
var ircClient = new irc.Server(config);
ircClient.connect();