1
0
Fork 0

fixes for client path resolve

refactor/models
Matthew 2020-06-29 17:17:08 -04:00
parent 07d13f38a7
commit 9e72e02e78
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 4 additions and 4 deletions

View File

@ -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 });