Skip to content

Commit 9b2b8d6

Browse files
committed
feat: More WebSocket changes
1 parent e088310 commit 9b2b8d6

File tree

1 file changed

+60
-4
lines changed

1 file changed

+60
-4
lines changed

Diff for: guide/additional-info/updating-from-v14.md

+60-4
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,61 @@ Make sure you're using the latest LTS version of Node. To check your Node versio
1616

1717
### Client
1818

19+
#### Ping
20+
21+
`Client#ping` has been added to replace the old `WebSocketManager#ping`. This will be `null` when the heartbeat from the gateway is yet to be received.
22+
1923
#### Premium sticker packs
2024

2125
`Client#fetchPremiumStickerPacks()` has been removed. Use `Client#fetchStickerPacks()` instead.
2226

23-
#### "Webhook update"
27+
#### Ready event
28+
29+
`client.on("ready")` has been removed. `"clientReady"` is the replacement. If you used `client.on(Events.ClientReady)`, you do not need to change anything.
30+
31+
#### Shard disonnect event
32+
33+
`client.on("shardDisconnect")` has been removed as the WebSocket manager replaces this functionality.
34+
35+
#### Shard error event
36+
37+
`client.on("shardError")` has been removed as the WebSocket manager replaces this functionality.
38+
39+
#### Shard ready event
40+
41+
`client.on("shardReady")` has been removed as the WebSocket manager replaces this functionality.
42+
43+
#### Shard reconnecting event
44+
45+
`client.on("shardReconnecting")` has been removed as the WebSocket manager replaces this functionality.
46+
47+
#### Shard resume event
48+
49+
`client.on("shardResume")` has been removed as the WebSocket manager replaces this functionality.
50+
51+
#### Webhook update event
2452

2553
`client.on("webhookUpdate")` has been removed. `"webhooksUpdate"` is the replacement. If you used `client.on(Events.WebhooksUpdate)`, you do not need to change anything.
2654

2755
#### WebSocket
2856

29-
The underlying WebSocket behaviour has changed. In version 14, this was a non-breaking implementation of @discordjs/ws. Now, it is fully integrated with @discordjs/ws. See these pull requests for more information:
57+
The underlying WebSocket behaviour has changed. In version 14, this was a non-breaking implementation of <DocsLink section="ws" />. Now, it is fully integrated. See these pull requests for more information:
3058

3159
- [discordjs/discord.js#10420](https://github.com/discordjs/discord.js/pull/10420)
3260
- [discordjs/discord.js#10556](https://github.com/discordjs/discord.js/pull/10556)
3361

62+
### ClientOptions
63+
64+
Removed `ClientOptions#shards` and `ClientOptions#shardCount` in favor of `ClientOptions#ws#shardIds` and `ClientOptions#ws#shardCount`.
65+
66+
### ClientUser
67+
68+
`ClientUser#setPresence()` now returns a promise which resolves when the gateway call was sent successfully.
69+
70+
### ClientPresence
71+
72+
`ClientPresence#set()` now returns a promise which resolves when the gateway call was sent successfully.
73+
3474
### CommandInteractionOptionResolver
3575

3676
`CommandInteractionOptionResolver#getFocused()`'s parameter has been removed. `AutocompleteFocusedOption` will always be returned.
@@ -78,8 +118,12 @@ The following error codes have been removed as they either have no use or are ha
78118

79119
### Events
80120

81-
`Events.WebhooksUpdate` now returns a string of `"webhooksUpdate"`. Previously, it returned `"webhookUpdate"`. This is to bring it in line with the name of Discord's gateway event (`WEBHOOKS_UPDATE`).
82-
121+
- `Events.ShardError` has been removed.
122+
- `Events.ShardReady` has been remvoved.
123+
- `Events.ShardReconnecting` has been removed.
124+
- `Events.ShardResume` has been removed.
125+
- `Events.WebhooksUpdate` now returns a string of `"webhooksUpdate"`. Previously, it returned `"webhookUpdate"`. This is to bring it in line with the name of Discord's gateway event (`WEBHOOKS_UPDATE`).
126+
- `Events.ClientReady` now returns a string of `"clientReady"`. Previously, it returned `"ready"`. This is to ensure there's no confusion with Discord's `READY` gateway event.
83127

84128
### Formatters
85129

@@ -93,6 +137,10 @@ This utility has been removed. Everything in this class is redundant as all meth
93137
+ userMention("123456789012345678");
94138
```
95139

140+
### Guild
141+
142+
Removed `Guild#shard` as WebSocket shards are now handled by @discordjs/ws.
143+
96144
### GuildAuditLogs
97145

98146
`GuildAuditLogsEntry.Targets.All` has been removed. It was not being used.
@@ -169,6 +217,10 @@ However, you would have already noticed that this no longer works, so this metho
169217

170218
`SelectMenuOptionBuilder` has been removed. Use `StringSelectMenuOptionBuilder` instead.
171219

220+
### ShardClientUtil
221+
222+
`ShardClientUtil#ids` and `ShardClientUtil#count` hav been removed in favor of `Client#ws#getShardIds()` and `Client#ws#getShardCount()`.
223+
172224
### StageInstance
173225

174226
`StageInstance#discoverableDisabled` has been removed.
@@ -206,3 +258,7 @@ Discord no longer sends avatar decoration data via `User#avatarDecoration`, so t
206258
### UserManager
207259

208260
`UserManager#fetchFlags()` has been removed. All this did was fetch the user and return only its `flags` property. It was quite redundant.
261+
262+
### WebSocketShardEvents
263+
264+
`WebSocketShardEvents` has been replaced with `WebSocketShardEvents` from @discordjs/ws.

0 commit comments

Comments
 (0)