add database global
This commit is contained in:
		
							parent
							
								
									e9ec555a96
								
							
						
					
					
						commit
						58b49fb9d8
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
					@ -3,6 +3,7 @@ const logger = require("npmlog");
 | 
				
			||||||
logger.level = "verbose";
 | 
					logger.level = "verbose";
 | 
				
			||||||
const fs = require("fs");
 | 
					const fs = require("fs");
 | 
				
			||||||
const {resolve} = require("path");
 | 
					const {resolve} = require("path");
 | 
				
			||||||
 | 
					const sqlite3 = require("sqlite3");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const config = require("../config.json");
 | 
					const config = require("../config.json");
 | 
				
			||||||
const apikeys = require("../apikeys.json");
 | 
					const apikeys = require("../apikeys.json");
 | 
				
			||||||
| 
						 | 
					@ -18,6 +19,8 @@ const bot = new Eris(config.token, {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const commands = new Eris.Collection();
 | 
					const commands = new Eris.Collection();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const database = new sqlite3.Database(resolve(__dirname, "..", "database.db"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function registerCommand(cmdObj) {
 | 
					function registerCommand(cmdObj) {
 | 
				
			||||||
  if (cmdObj instanceof Command) {
 | 
					  if (cmdObj instanceof Command) {
 | 
				
			||||||
    commands.set(cmdObj.name, cmdObj);
 | 
					    commands.set(cmdObj.name, cmdObj);
 | 
				
			||||||
| 
						 | 
					@ -39,6 +42,7 @@ global.hf = {
 | 
				
			||||||
  registerCommand,
 | 
					  registerCommand,
 | 
				
			||||||
  events,
 | 
					  events,
 | 
				
			||||||
  timer,
 | 
					  timer,
 | 
				
			||||||
 | 
					  database,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for (const file of fs.readdirSync(resolve(__dirname, "modules"))) {
 | 
					for (const file of fs.readdirSync(resolve(__dirname, "modules"))) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue