Browse Source

Update v2_to_v3_guide.md

pull/1987/head
Armano den Boef GitHub 3 years ago
parent
commit
34ad7915eb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 52 additions and 0 deletions
  1. +52
    -0
      docs/guides/v2_v3_guide/v2_to_v3_guide.md

+ 52
- 0
docs/guides/v2_v3_guide/v2_to_v3_guide.md View File

@@ -10,6 +10,58 @@ and more flexible library than any previous version.


Below are the most notable breaking changes that you would need to update your code to work with V3. Below are the most notable breaking changes that you would need to update your code to work with V3.


### GatewayIntents

As Discord.NET has upgraded from Discord API v6 to API v9,
`GatewayIntents` must now be specified in the socket config, as well as on the [developer portal].

```cs

// Where ever you declared your websocket client.
DiscordSocketClient _client;

...

var config = new DiscordSocketConfig()
{
.. // Other config options can be presented here.
GatewayIntents = GatewayIntents.All
}

_client = new DiscordSocketClient(config);

```
#### Common intents:

- AllUnprivileged: This is a group of most common intents, that do NOT require any [developer portal] intents to be enabled.
This includes intents that receive messages such as: `GatewayIntents.GuildMessages, GatewayIntents.DirectMessages`
- GuildMembers: An intent disabled by default, as you need to enable it in the [developer portal].
- GuildPresences: Also disabled by default, this intent together with `GuildMembers` are the only intents not included in `AllUnprivileged`.
- All: All intents, it is ill adviced to use this without care, as it *can* cause a memory leak from presence.
The library will give responsive warnings if you specify unnecessary intents.


> [!NOTE]
> All gateway intents, their Discord API counterpart and their enum value are listed
> [HERE](xref:Discord.GatewayIntents)

#### Stacking intents:

It is common that you require several intents together.
The example below shows how this can be done.

```cs

GatewayIntents = GatewayIntents.AllUnprivileged | GatewayIntents.GuildMembers | ..

```

> [!NOTE]
> Further documentation on the ` | ` operator can be found
> [HERE](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators)

[developer portal]: https://discord.com/developers/

### ReactionAdded Event ### ReactionAdded Event


The reaction added event has been changed to have both parameters cacheable. The reaction added event has been changed to have both parameters cacheable.


Loading…
Cancel
Save