From a62fb5e17b603a0bf958622d6918a97996898df8 Mon Sep 17 00:00:00 2001 From: 8au <54277586+8auu@users.noreply.github.com> Date: Mon, 26 May 2025 05:40:11 +0100 Subject: [PATCH] fix(gateway): remove 'offline' status from DiscordUpdatePresence, as Discord only supports 'invisible' and not 'offline' (#4205) * fix: the 'color' type on role is set to 'undefined' when its value is '0' * fix: ensure role color is correctly assigned when value is 0 * fix: revert color type change * fix(docs): fixed typo in big bot guide * fix(gateway): fixed an issue which would cause bot status to appear as online if the user used 'offline' as the status * Update settings.json * remove offline status in DiscordUpdatePresence.status * Apply suggestions from code review --------- Co-authored-by: Awesome Stickz --- packages/types/src/discord/gateway.ts | 3 ++- website/docs/bigbot/step-3-gateway.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/types/src/discord/gateway.ts b/packages/types/src/discord/gateway.ts index 81606300a..7edd9054b 100644 --- a/packages/types/src/discord/gateway.ts +++ b/packages/types/src/discord/gateway.ts @@ -299,7 +299,7 @@ export interface DiscordUpdatePresence { /** The user's activities */ activities: DiscordBotActivity[] /** The user's new status */ - status: keyof typeof PresenceStatus + status: Exclude /** Whether or not the client is afk */ afk: boolean } @@ -309,6 +309,7 @@ export enum PresenceStatus { online, dnd, idle, + invisible, offline, } diff --git a/website/docs/bigbot/step-3-gateway.md b/website/docs/bigbot/step-3-gateway.md index d50bd10d3..b29a692c5 100644 --- a/website/docs/bigbot/step-3-gateway.md +++ b/website/docs/bigbot/step-3-gateway.md @@ -99,7 +99,7 @@ Now let's break it down. ### Worker & Server Confusion -The `shardsPerWorker` property represents how many shards we will run per **server** in this eaxmple. This property is called `perWorker` because for mid sized bots that don't require separate dedicated servers, it can use _worker threads_ to mitigate the load in that single server. Here, we are going to be aiming to scale much much larger so we need to think bigger. In our case, what we are telling our gateway manager is that it should create 500 shards per **server**. Sounds like a lot? Yes, but no problem! Those shards will then be split across _worker threads_ on each server. +The `shardsPerWorker` property represents how many shards we will run per **server** in this example. This property is called `perWorker` because for mid sized bots that don't require separate dedicated servers, it can use _worker threads_ to mitigate the load in that single server. Here, we are going to be aiming to scale much much larger so we need to think bigger. In our case, what we are telling our gateway manager is that it should create 500 shards per **server**. Sounds like a lot? Yes, but no problem! Those shards will then be split across _worker threads_ on each server. The `totalWorkers` property represents the number of **servers** we have available for shards. For example, if we have 10 dedicated servers available to us, this will allow the manager to spread out the load across 10 total **servers**.