Class BaseDiscordClient
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
CurrentUser
Gets the logged-in user.
public ISelfUser CurrentUser { get; protected set; }
Property Value
LoginState
Gets the login state of the client.
public LoginState LoginState { get; }
Property Value
TokenType
Gets the token type of the logged-in user.
public TokenType TokenType { get; }
Property Value
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
RequestOptionsThe 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
RequestOptionsThe 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
Returns
LogoutAsync()
public Task LogoutAsync()
Returns
Events
Log
public event Func<LogMessage, Task> Log
Event Type
LoggedIn
public event Func<Task> LoggedIn
Event Type
LoggedOut
public event Func<Task> LoggedOut
Event Type
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