Fix issue where event files existing would crash the bot

This commit is contained in:
Ethan Lane 2021-12-02 15:28:36 +00:00
parent 6d030737fc
commit c526423607
Signed by: Vylpes
GPG key ID: EED233CC06D12504

View file

@ -97,9 +97,9 @@ export class Util {
if (eventFiles[i].includes('.ts')) {
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
client.on('channelCreate', event.channelCreate);