-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
27 lines (19 loc) · 763 Bytes
/
Copy pathapp.js
File metadata and controls
27 lines (19 loc) · 763 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
"use strict";
global.Config = require('./config.js');
global.Commands = global.Db = require('./database.js')(`data`, { timer: false });
const bot = require('./bot.js');
global.toId = function(s) {
return "" + (s && typeof s === "string" ? s : "").toLowerCase().replace(/[^a-z0-9]+/g, "");
};
// set up global tools
global.Tools = require('./tools.js');
// load commands
global.Commands = require('./commandhandler.js')();
global.Bot = new bot();
// overwrite console.log to include a timestamp
console._log = console.log;
console.log = function(...args) {
let date = new Date();
let offset = date.getTimezoneOffset() / -60;
return console._log('[', date.toLocaleString(), `UTC${offset > 0 ? '+' : "-"}${Math.abs(offset)}`, ']', ...args);
}