Merge pull request #68 from Vylpes/bug/67-type-error
Fix issue where event files existing would crash the bot
This commit is contained in:
commit
7861829f5d
1 changed files with 3 additions and 3 deletions
|
@ -95,11 +95,11 @@ export class Util {
|
||||||
|
|
||||||
for (let i = 0; i < eventFiles.length; i++) {
|
for (let i = 0; i < eventFiles.length; i++) {
|
||||||
if (eventFiles[i].includes('.ts')) {
|
if (eventFiles[i].includes('.ts')) {
|
||||||
const eventName = eventFiles[i].split('.')[0];
|
const eventName = eventFiles[i].split('.')[0];
|
||||||
|
|
||||||
const file = require(`${process.cwd()}/${folder}/${eventName}.ts`);
|
const file = require(`${process.cwd()}/${folder}/${eventName}.ts`).default;
|
||||||
|
|
||||||
const event = new file[eventName]() as Event;
|
const event = new file() as Event;
|
||||||
|
|
||||||
// Load events
|
// Load events
|
||||||
client.on('channelCreate', event.channelCreate);
|
client.on('channelCreate', event.channelCreate);
|
||||||
|
|
Reference in a new issue