1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-09-29 08:20:59 -04:00

Improvement idk

This commit is contained in:
AnxietyisReal 2023-04-21 16:20:01 +10:00
parent eea00ccd1f
commit 9f29fcd9f1

View File

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