Table of Contents

Class DiscordConfiguration

Namespace
DSharpPlus
Assembly
DSharpPlus.dll

Represents configuration for DiscordClient and DiscordShardedClient.

public sealed class DiscordConfiguration
Inheritance
DiscordConfiguration

Constructors

DiscordConfiguration()

Creates a new configuration with default values.

DiscordConfiguration(DiscordConfiguration)

Creates a clone of another discord configuration.

Properties

AlwaysCacheMembers

Sets whether the client should attempt to cache members if exclusively using unprivileged intents.

This will only take effect if there are no GuildMembers or GuildPresences intents specified. Otherwise, this will always be overwritten to true.

Defaults to true.

AutoReconnect

Sets whether to automatically reconnect in case a connection is lost.

Defaults to true.

GatewayCompressionLevel

Sets the level of compression for WebSocket traffic.

Disabling this option will increase the amount of traffic sent via WebSocket. Setting Payload will enable compression for READY and GUILD_CREATE payloads. Setting Stream will enable compression for the entire WebSocket stream, drastically reducing amount of traffic.

Defaults to Stream.

HttpTimeout

Sets the timeout for HTTP requests.

Set to InfiniteTimeSpan to disable timeouts.

Defaults to 10 seconds.

Intents

Sets the gateway intents for this client.

If set, the client will only receive events that they specify with intents.

Defaults to AllUnprivileged.

LargeThreshold

Sets the member count threshold at which guilds are considered large.

Defaults to 250.

LogTimestampFormat

Allows you to overwrite the time format used by the internal debug logger.

Only applicable when LoggerFactory is set left at default value. Defaults to ISO 8601-like format.

LogUnknownAuditlogs

Whether to log unknown auditlog types and change keys or not. Defaults to true.

LogUnknownEvents

Whether to log unknown events or not. Defaults to true.

LoggerFactory

Sets the logger implementation to use.

To create your own logger, implement the ILoggerFactory instance.

Defaults to built-in implementation.

MaximumRatelimitRetries

Specifies the maximum amount of retries to attempt when ratelimited. Retries will still try to respect the ratelimit.

MaximumRestRequestsPerSecond

Specifies the maximum rest requests to attempt per second. Defaults to 15.

MessageCacheProvider

Sets the message cache implementation to use.

To create your own implementation, implement the IMessageCacheProvider instance.

Defaults to built-in implementation.

MessageCacheSize

Sets the size of the global message cache.

Setting this to 0 will disable message caching entirely. Defaults to 1024.

This is only applied if the default message cache implementation is used.

MinimumLogLevel

Sets the minimum logging level for messages.

Typically, the default value of Information is ok for most uses.

Proxy

Sets the proxy to use for HTTP and WebSocket connections to Discord.

Defaults to null.

RatelimitRetryDelayFallback

Specifies the delay to use when there was no delay information passed to the rest client. Defaults to 2.5 seconds.

ReconnectIndefinitely

Defines that the client should attempt to reconnect indefinitely.

This is typically a very bad idea to set to true, as it will swallow all connection errors.

Defaults to false.

ShardCount

Sets the total number of shards the bot is on. If not sharding, this value should be left with a default value of 1.

If sharding automatically, this value will indicate how many shards to boot. If left default for automatic sharding, the client will determine the shard count automatically.

ShardId

Sets the ID of the shard to connect to.

If not sharding, or sharding automatically, this value should be left with the default value of 0.

TimeoutForInitialApiRequest

Specifies the probing interval in ms to use when first making requests to the API. This should be slightly higher than your average ping to the discord rest api.
Defaults to 200 ms

Token

Sets the token used to identify the client.

TokenType

Sets the type of the token used to identify the client.

Defaults to Bot.

UdpClientFactory

Sets the factory method used to create instances of UDP clients.

Use CreateNew() and equivalents on other implementations to switch out client implementations.

Defaults to CreateNew().

WebSocketClientFactory

Sets the factory method used to create instances of WebSocket clients.

Use CreateNew(IWebProxy) and equivalents on other implementations to switch out client implementations.

Defaults to CreateNew(IWebProxy).