-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathindex.js
More file actions
39 lines (26 loc) · 750 Bytes
/
index.js
File metadata and controls
39 lines (26 loc) · 750 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
28
29
30
31
32
33
34
35
36
37
38
39
var botFactory = require( "./lib/bot" );
var fs = require( "fs");
var path = require( "path" )
var sqlFactory = require( "sqlite3" ).verbose().Database;
//
// Global Objects
// These are for use by plugins
//
GLOBAL.bot = new botFactory();
GLOBAL.db = new sqlFactory( "store.db", LoadPlugins );
function LoadPlugins() {
var plugins = fs.readdirSync( "./plugins" );
// Load our main plugin first
plugins.unshift( "../main.js" );
plugins.forEach( function( plugin ) {
if ( path.extname( plugin ) != ".js" )
return;
try {
require( "./plugins/" + plugin );
console.log( "Loaded " + plugin );
} catch ( e ) {
bot.sendMessage( "Failed to load plugin '" + plugin + "'\n" + e + "." );
console.trace( e );
}
} );
}