add database global

This commit is contained in:
Cynthia Foxwell 2021-07-23 17:21:50 -06:00
parent e9ec555a96
commit 58b49fb9d8

View file

@ -3,6 +3,7 @@ const logger = require("npmlog");
logger.level = "verbose";
const fs = require("fs");
const {resolve} = require("path");
const sqlite3 = require("sqlite3");
const config = require("../config.json");
const apikeys = require("../apikeys.json");
@ -18,6 +19,8 @@ const bot = new Eris(config.token, {
const commands = new Eris.Collection();
const database = new sqlite3.Database(resolve(__dirname, "..", "database.db"));
function registerCommand(cmdObj) {
if (cmdObj instanceof Command) {
commands.set(cmdObj.name, cmdObj);
@ -39,6 +42,7 @@ global.hf = {
registerCommand,
events,
timer,
database,
};
for (const file of fs.readdirSync(resolve(__dirname, "modules"))) {