load package.json as client variable

This commit is contained in:
Emily 2020-10-06 18:50:07 +11:00
parent dc96cb2e1c
commit a8300fc91d

View file

@ -21,10 +21,11 @@ class Custom extends Client {
} }
this.path = __dirname; this.path = __dirname;
this.package = require("../package.json")
this.logger = require("./util/logger"); this.logger = require("./util/logger");
this.util = new (require("./util/util"))(this); this.util = new (require("./util/util"))(this);
this.messageUtil = new (require("./util/messageUtil"))(this); this.messageUtil = new (require("./util/messageUtil"))(this);
this.db = new (require("./util/redis"))(this) this.db = new (require("./util/redis"))(this);
// Create collections to store loaded commands and aliases in // Create collections to store loaded commands and aliases in
this.commands = new Collection(); this.commands = new Collection();
@ -44,13 +45,15 @@ const init = async () => {
// Initialize client // Initialize client
const client = new Custom(); const client = new Custom();
client.logger.info(`Initializing Woomy v${client.package.version}`)
// Load all commands/events // Load all commands/events
await client.commandHandler.loadAll(); await client.commandHandler.loadAll();
await client.eventHandler.loadAll(); await client.eventHandler.loadAll();
// Connect to Redis database // Connect to Redis database
await client.db.init(); await client.db.init();
client.logger.info("Connected to Redis.") client.logger.info("Connected to Redis DB.")
if (client.dev === true) { if (client.dev === true) {
client.logger.warn("Development mode is on. Some features (such as Sentry) are disabled."); client.logger.warn("Development mode is on. Some features (such as Sentry) are disabled.");