Search Results for

    Show / Hide Table of Contents

    Class DiscordConfiguration

    Represents configuration for DiscordClient and DiscordShardedClient.

    Inheritance
    System.Object
    DiscordConfiguration
    Namespace: DisCatSharp
    Assembly: DisCatSharp.dll
    Syntax
    public sealed class DiscordConfiguration

    Constructors

    | Improve this Doc View Source

    DiscordConfiguration()

    Creates a new configuration with default values.

    Declaration
    public DiscordConfiguration()
    | Improve this Doc View Source

    DiscordConfiguration(DiscordConfiguration)

    Creates a clone of another discord configuration.

    Declaration
    public DiscordConfiguration(DiscordConfiguration other)
    Parameters
    Type Name Description
    DiscordConfiguration other

    Client configuration to clone.

    | Improve this Doc View Source

    DiscordConfiguration(IServiceProvider)

    Utilized via Dependency Injection Pipeline

    Declaration
    [ActivatorUtilitiesConstructor]
    public DiscordConfiguration(IServiceProvider provider)
    Parameters
    Type Name Description
    System.IServiceProvider provider

    Properties

    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    ApiVersion

    Overwrites the api version. Defaults to 10.

    Declaration
    public string ApiVersion { set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    AutoRefreshChannelCache

    Refresh full guild channel cache.

    Defaults to false.

    Declaration
    public bool AutoRefreshChannelCache { set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    HttpTimeout

    Sets the timeout for HTTP requests.

    Set to System.Threading.Timeout.InfiniteTimeSpan to disable timeouts.

    Defaults to 20 seconds.

    Declaration
    public TimeSpan HttpTimeout { set; }
    Property Value
    Type Description
    System.TimeSpan
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    LoggerFactory

    Sets the logger implementation to use.

    To create your own logger, implement the Microsoft.Extensions.Logging.ILoggerFactory instance.

    Defaults to built-in implementation.

    Declaration
    public ILoggerFactory LoggerFactory { set; }
    Property Value
    Type Description
    Microsoft.Extensions.Logging.ILoggerFactory
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    MinimumLogLevel

    Sets the minimum logging level for messages.

    Typically, the default value of Microsoft.Extensions.Logging.LogLevel.Information is ok for most uses.

    Declaration
    public LogLevel MinimumLogLevel { set; }
    Property Value
    Type Description
    Microsoft.Extensions.Logging.LogLevel
    | Improve this Doc View Source

    MobileStatus

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

    Defaults to false.

    Declaration
    public bool MobileStatus { set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Override

    Do not use, this is meant for DisCatSharp Devs.

    Defaults to null.

    Declaration
    public string Override { set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    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
    System.Net.IWebProxy
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    ServiceProvider

    Sets the service provider.

    This allows passing data around without resorting to static members.

    Defaults to an empty service provider.

    Declaration
    public IServiceProvider ServiceProvider { set; }
    Property Value
    Type Description
    System.IServiceProvider
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    Token

    Sets the token used to identify the client.

    Declaration
    public string Token { set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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.

    Declaration
    public UdpClientFactoryDelegate UdpClientFactory { set; }
    Property Value
    Type Description
    UdpClientFactoryDelegate
    | Improve this Doc View Source

    UseCanary

    Whether to use canary. UsePtb has to be false.

    Defaults to false.

    Declaration
    public bool UseCanary { set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    UsePtb

    Whether to use ptb. UseCanary has to be false.

    Defaults to false.

    Declaration
    public bool UsePtb { set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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).

    Declaration
    public WebSocketClientFactoryDelegate WebSocketClientFactory { set; }
    Property Value
    Type Description
    WebSocketClientFactoryDelegate

    Extension Methods

    ReflectionUtilities.ToDictionary<T>(T)
    • Improve this Doc
    • View Source
    In This Article
    Back to top © 2021-2022 Aiko IT Systems