From 9f29fcd9f1f2335a1dfbee8fa2bf8140a9600365 Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Fri, 21 Apr 2023 16:20:01 +1000 Subject: [PATCH] Improvement idk --- src/client.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/client.ts b/src/client.ts index f557f6e..0344a5f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -100,18 +100,17 @@ export default class TClient extends Client { waitQueueTimeoutMS: 50000, socketTimeoutMS: 30000, family: 4 - }).then(()=>console.log(this.logTime(), 'Successfully connected to MongoDB')).catch((err)=>{console.error(this.logTime(), `Failed to connect to MongoDB\n${err.reason}`); exec('pm2 stop Daggerbot')}) + }).then(()=>console.log(this.logTime(), 'Successfully connected to MongoDB')).catch(err=>{console.error(this.logTime(), `Failed to connect to MongoDB\n${err.reason}`); exec('pm2 stop Daggerbot')}) await this.login(this.tokens.main); - fs.readdirSync('dist/events').forEach(async file=>{ + for await (const file of fs.readdirSync('dist/events')){ const eventFile = await import(`./events/${file}`); - this.on(file.replace('.js', ''), async(...args)=>eventFile.default.run(this,...args)); - }); - const commandFiles = fs.readdirSync('dist/commands').filter(file=>file.endsWith('.js')); - for (const file of commandFiles){ + this.on(file.replace('.js',''), async(...args)=>eventFile.default.run(this,...args)) + }; + for await (const file of fs.readdirSync('dist/commands')){ const command = await import(`./commands/${file}`); - this.commands.set(command.default.data.name, {command, uses: 0}) + this.commands.set(command.default.data.name,{command, uses: 0}); this.registry.push(command.default.data.toJSON()) - } + }; } formatTime(integer: number, accuracy = 1, options?: formatTimeOpt){ let achievedAccuracy = 0;