From 9e72e02e78e20159415af63519835fee9fcfba89 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Mon, 29 Jun 2020 17:17:08 -0400 Subject: [PATCH] fixes for client path resolve --- src/class/Client.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/class/Client.ts b/src/class/Client.ts index 256a352..8564287 100644 --- a/src/class/Client.ts +++ b/src/class/Client.ts @@ -65,11 +65,11 @@ export default class Client extends Eris.Client { } public async loadFunctions() { - const functions = await fs.readdir('../functions'); + const functions = await fs.readdir(`${__dirname}/../functions`); functions.forEach(async (func) => { if (func === 'index.ts' || func === 'index.js') return; try { - const funcRequire: Function = require(`../functions/${func}`).default; + const funcRequire: Function = require(`${__dirname}/../functions/${func}`).default; this.functions.set(func.split('.')[0], funcRequire); } catch (error) { this.signale.error(`Error occured loading ${func}`); @@ -121,11 +121,11 @@ export default class Client extends Eris.Client { this.on('ready', () => { this.signale.info(`Connected to Discord as ${this.user.username}#${this.user.discriminator}`); }); - const intervals = await fs.readdir('../intervals'); + const intervals = await fs.readdir(`${__dirname}/../intervals`); intervals.forEach((interval) => { // eslint-disable-next-line if (interval === 'index.js') return; - require(`../intervals/${interval}`).default(this); + require(`${__dirname}/../intervals/${interval}`).default(this); this.signale.complete(`Loaded interval ${interval.split('.')[0]}`); }); this.server = new Server(this, { port: this.config.port });