Class DiscordConfiguration
Represents configuration for DiscordClient and DiscordShardedClient.
Inheritance
Namespace: DSharpPlus
Assembly: cs.temp.dll.dll
Syntax
public sealed class DiscordConfiguration
Constructors
DiscordConfiguration()
Creates a new configuration with default values.
Declaration
public DiscordConfiguration()
DiscordConfiguration(DiscordConfiguration)
Creates a clone of another discord configuration.
Declaration
public DiscordConfiguration(DiscordConfiguration other)
Parameters
Type | Name | Description |
---|---|---|
DiscordConfiguration | other | Client configuration to clone. |
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.
Declaration
public bool AlwaysCacheMembers { set; }
Property Value
Type | Description |
---|---|
System.Boolean |
AutoReconnect
Sets whether to automatically reconnect in case a connection is lost.
Defaults to true.
Declaration
public bool AutoReconnect { set; }
Property Value
Type | Description |
---|---|
System.Boolean |
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.
Declaration
public GatewayCompressionLevel GatewayCompressionLevel { set; }
Property Value
Type | Description |
---|---|
GatewayCompressionLevel |
HttpTimeout
Sets the timeout for HTTP requests.
Set to System.Threading.Timeout.InfiniteTimeSpan to disable timeouts.
Defaults to 10 seconds.
Declaration
public TimeSpan HttpTimeout { set; }
Property Value
Type | Description |
---|---|
TimeSpan |
Intents
Sets the gateway intents for this client.
If set, the client will only receive events that they specify with intents.
Defaults to AllUnprivileged.
Declaration
public DiscordIntents Intents { set; }
Property Value
Type | Description |
---|---|
DiscordIntents |
LargeThreshold
Sets the member count threshold at which guilds are considered large.
Defaults to 250.
Declaration
public int LargeThreshold { set; }
Property Value
Type | Description |
---|---|
System.Int32 |
LoggerFactory
Sets the logger implementation to use.
To create your own logger, implement the
Defaults to built-in implementation.
Declaration
public ILoggerFactory LoggerFactory { set; }
Property Value
Type | Description |
---|---|
ILoggerFactory |
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.
Declaration
public string LogTimestampFormat { set; }
Property Value
Type | Description |
---|---|
System.String |
MessageCacheSize
Sets the size of the global message cache.
Setting this to 0 will disable message caching entirely. Defaults to 1024.
Declaration
public int MessageCacheSize { set; }
Property Value
Type | Description |
---|---|
System.Int32 |
MinimumLogLevel
Sets the minimum logging level for messages.
Typically, the default value of
Declaration
public LogLevel MinimumLogLevel { set; }
Property Value
Type | Description |
---|---|
LogLevel |
Proxy
Sets the proxy to use for HTTP and WebSocket connections to Discord.
Defaults to null.
Declaration
public IWebProxy Proxy { set; }
Property Value
Type | Description |
---|---|
IWebProxy |
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.
Declaration
public bool ReconnectIndefinitely { set; }
Property Value
Type | Description |
---|---|
System.Boolean |
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.
Declaration
public int ShardCount { set; }
Property Value
Type | Description |
---|---|
System.Int32 |
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.
Declaration
public int ShardId { set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Token
Sets the token used to identify the client.
Declaration
public string Token { set; }
Property Value
Type | Description |
---|---|
System.String |
TokenType
Sets the type of the token used to identify the client.
Defaults to Bot.
Declaration
public TokenType TokenType { set; }
Property Value
Type | Description |
---|---|
TokenType |
UdpClientFactory
Sets the factory method used to create instances of UDP clients.
Use
Defaults to
Declaration
public UdpClientFactoryDelegate UdpClientFactory { set; }
Property Value
Type | Description |
---|---|
UdpClientFactoryDelegate |
UseRelativeRatelimit
Sets whether to rely on Discord for NTP (Network Time Protocol) synchronization with the "X-Ratelimit-Reset-After" header.
If the system clock is unsynced, setting this to true will ensure ratelimits are synced with Discord and reduce the risk of hitting one.
This should only be set to false if the system clock is synced with NTP.
Defaults to true.
Declaration
public bool UseRelativeRatelimit { set; }
Property Value
Type | Description |
---|---|
System.Boolean |
WebSocketClientFactory
Sets the factory method used to create instances of WebSocket clients.
Use
Defaults to
Declaration
public WebSocketClientFactoryDelegate WebSocketClientFactory { set; }
Property Value
Type | Description |
---|---|
WebSocketClientFactoryDelegate |