* Update client-basics.md * Update v2_to_v3_guide.mdpull/1989/head
@@ -9,6 +9,58 @@ In the following section, you will find commonly asked questions and | |||
answers about common issues that you may face when utilizing the | |||
various clients offered by the library. | |||
## I keep having trouble with intents! | |||
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/ | |||
## My client keeps returning 401 upon logging in! | |||
> [!WARNING] | |||
@@ -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. | |||
### 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 | |||
The reaction added event has been changed to have both parameters cacheable. | |||