Table of Contents

Class DiscordConfiguration

Namespace
DisCatSharp
Assembly
DisCatSharp.dll

Represents configuration for DiscordClient and DiscordShardedClient.

public sealed class DiscordConfiguration
Inheritance
DiscordConfiguration
Inherited Members

Constructors

DiscordConfiguration()

Creates a new configuration with default values.

DiscordConfiguration(DiscordConfiguration)

Creates a clone of another discord configuration.

DiscordConfiguration(IServiceProvider)

Utilized via dependency injection pipeline.

Properties

ActivityHandlerType

If HasActivitiesEnabled is true, determines which handler type we use..

Defaults to DiscordLaunchActivity.

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.

ApiChannel

Which api channel to use.

Defaults to Stable.

ApiVersion

Overwrites the api version. Defaults to 10.

AttachRecentLogEntries

Whether to attach recent log entris.

Defaults to false.

AttachUserInfo

Whether to attach the bots username and id to sentry reports.

This helps us to pinpoint problems.

Defaults to false.

AutoFetchApplicationEmojis

Defines that the client should attempt to fetch application emojis on startup.

Defaults to false.

AutoFetchSkuIds

Whether to autofetch the sku ids.

Mutually exclusive to SkuId.

AutoReconnect

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

Defaults to true.

AutoRefreshChannelCache

Refresh full guild channel cache.

Defaults to false.

DeveloperUserId

Your discord user id we can reach out when your bot encounters library bugs.

Will only be transmitted if AttachUserInfo is true.

Defaults to null.

DisableUpdateCheck

Whether to disable the update check.

EnableDiscordIdScrubber

Whether to replace every discord-based id with {DISCORD_ID}.

Defaults to false.

EnablePayloadReceivedEvent

Causes the PayloadReceived event to be fired.

Useful if you want to work with raw events.

Defaults to false.

EnableSentry

Whether to enable sentry.

This helps us to track missing data and library bugs better.

Defaults to false.

note

Please refer to the docs for more information.

FeedbackEmail

Your email address we can reach out when your bot encounters library bugs.

Will only be transmitted if AttachUserInfo is true.

Defaults to null.

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.

HasActivitiesEnabled

Whether this app uses activities.

Defaults to false.

HttpTimeout

Sets the timeout for HTTP requests.

Set to InfiniteTimeSpan to disable timeouts.

Defaults to 20 seconds.

IncludePrereleaseInUpdateCheck

Whether to include prerelease versions in the update check.

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.

Locale

Sets your preferred API language. See DiscordLocales for valid locales.

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.

LoggerFactory

Sets the logger implementation to use.

To create your own logger, implement the ILoggerFactory 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.

MinimumLogLevel

Sets the minimum logging level for messages.

Defaults to Information.

MobileStatus

Sets if the bot's status should show the mobile icon.

Defaults to false.

Override

Do not use, this is meant for DisCatSharp Devs.

Defaults to null.

Proxy

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

Defaults to null.

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.

ReportMissingFields

Whether to report missing fields for discord object.

Useful for library development.

Defaults to false.

ServiceProvider

Sets the service provider.

This allows passing data around without resorting to static members.

Defaults to an empty service provider.

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.

ShowReleaseNotesInUpdateCheck

Whether to show release notes in the update check.

Defaults to false.

SkuId

The applications sku id for premium apps.

Mutually exclusive to AutoFetchSkuIds.

Timezone

Sets your timezone.

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 DisCatSharp.Net.Udp.DcsUdpClient.CreateNew() and equivalents on other implementations to switch out client implementations.

Defaults to DisCatSharp.Net.Udp.DcsUdpClient.CreateNew().

UpdateCheckGitHubToken

Sets the GitHub token to use for the update check.

Only useful if extensions are private and UpdateCheckMode is GitHub.

UpdateCheckMode

Against which channel to check for updates.

Defaults to NuGet.

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.

WebSocketClientFactory

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

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

Defaults to CreateNew(IWebProxy, IServiceProvider).