Skip to content

Commit

Permalink
Fix: Client#guilds has no guilds on "ready" event
Browse files Browse the repository at this point in the history
The "ready" event was sent before Client#guilds being updated, that is because we did not await the method to getUserGuilds to optimize connection latency, though it is no longer necessary as it is only the connection process taking a small additional time and TouchGuild is recognized to be blazing fast enough to handle this properly without feeling "slow".
  • Loading branch information
pakkographic committed Jul 29, 2024
1 parent 870d38c commit 1c5ce00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/structures/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ export class Client extends TypedEmitter<ClientEvents> {
connect(): void {
void this.checkForUpdate();
this.ws.connect();
this.ws.on("GATEWAY_WELCOME", data => {
this.ws.on("GATEWAY_WELCOME", async data => {
this.user = new UserClient(data, this);
if (this.params.connectionMessage) console.log("> Connection established.");
void this.rest.misc.getUserGuilds("@me").catch(() => [])
await this.rest.misc.getUserGuilds("@me").catch(() => [])
.then(guilds => {
if (!guilds) guilds = [];
for (const guild of guilds) this.guilds.add(guild);
Expand Down

0 comments on commit 1c5ce00

Please sign in to comment.