Table of Contents

Class BaseDiscordClient

Namespace
Discord.Rest
Assembly
Discord.Net.Rest.dll
public abstract class BaseDiscordClient : IDiscordClient, IDisposable, IAsyncDisposable
Inheritance
BaseDiscordClient
Implements
Derived
Inherited Members
Extension Methods

Properties

ConnectionState

Gets the current state of connection.

public virtual ConnectionState ConnectionState { get; }

Property Value

ConnectionState

CurrentUser

Gets the logged-in user.

public ISelfUser CurrentUser { get; protected set; }

Property Value

ISelfUser

LoginState

Gets the login state of the client.

public LoginState LoginState { get; }

Property Value

LoginState

TokenType

Gets the token type of the logged-in user.

public TokenType TokenType { get; }

Property Value

TokenType

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

GetBotGatewayAsync(RequestOptions)

Gets the gateway information related to the bot.

public Task<BotGateway> GetBotGatewayAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<BotGateway>

A task that represents the asynchronous get operation. The task result contains a BotGateway that represents the gateway information related to the bot.

GetRecommendedShardCountAsync(RequestOptions)

Gets the recommended shard count as suggested by Discord.

public Task<int> GetRecommendedShardCountAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<int>

A task that represents the asynchronous get operation. The task result contains an int that represents the number of shards that should be used with this account.

LoginAsync(TokenType, string, bool)

public Task LoginAsync(TokenType tokenType, string token, bool validateToken = true)

Parameters

tokenType TokenType
token string
validateToken bool

Returns

Task

LogoutAsync()

public Task LogoutAsync()

Returns

Task

Events

Log

public event Func<LogMessage, Task> Log

Event Type

Func<LogMessage, Task>

LoggedIn

public event Func<Task> LoggedIn

Event Type

Func<Task>

LoggedOut

public event Func<Task> LoggedOut

Event Type

Func<Task>

SentRequest

Fired when a REST request is sent to the API. First parameter is the HTTP method, second is the endpoint, and third is the time taken to complete the request.

public event Func<string, string, double, Task> SentRequest

Event Type

Func<string, string, double, Task>