Browse Source

Update client-basics.md

pull/1987/head
Armano den Boef GitHub 3 years ago
parent
commit
584cf5bec2
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/faq/basics/client-basics.md

+ 52
- 0
docs/faq/basics/client-basics.md View File

@@ -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 answers about common issues that you may face when utilizing the
various clients offered by the library. 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! ## My client keeps returning 401 upon logging in!


> [!WARNING] > [!WARNING]


Loading…
Cancel
Save