From 329c8e297c1d8ac6b8eae397cc8c05ee47c83d9f Mon Sep 17 00:00:00 2001 From: MARCROCK22 Date: Fri, 13 Dec 2024 22:15:40 -0400 Subject: [PATCH] feat: client.latency --- src/client/client.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client/client.ts b/src/client/client.ts index f3b03dc..50bc1cc 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -54,8 +54,16 @@ export class Client extends BaseClient { } } + get latency() { + let acc = 0; + + this.gateway.forEach(s => (acc += s.latency)); + + return acc / this.gateway.size; + } + async loadEvents(dir?: string) { - dir ??= await this.getRC().then(x => ('events' in x.locations ? x.locations.events : undefined)); + dir ??= await this.getRC().then(x => x.locations.events); if (dir) { await this.events.load(dir); this.logger.info('EventHandler loaded');