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 <awesome@stickz.dev>
This commit is contained in:
8au
2025-05-26 10:10:11 +05:30
committed by GitHub
co-authored by Awesome Stickz
parent 5cb7c1d1d2
commit a62fb5e17b
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -299,7 +299,7 @@ export interface DiscordUpdatePresence {
/** The user's activities */ /** The user's activities */
activities: DiscordBotActivity[] activities: DiscordBotActivity[]
/** The user's new status */ /** The user's new status */
status: keyof typeof PresenceStatus status: Exclude<keyof typeof PresenceStatus, 'offline'>
/** Whether or not the client is afk */ /** Whether or not the client is afk */
afk: boolean afk: boolean
} }
@@ -309,6 +309,7 @@ export enum PresenceStatus {
online, online,
dnd, dnd,
idle, idle,
invisible,
offline, offline,
} }
+1 -1
View File
@@ -99,7 +99,7 @@ Now let's break it down.
### Worker & Server Confusion ### 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**. 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**.