Class BaseDiscordClient
Assembly: Discord.Net.Rest.dll​
View Source​
public abstract class BaseDiscordClient : IDiscordClient, IDisposable
Properties​
LoginState​
Gets the login state of the client.
View Source​
public LoginState LoginState { get; }
CurrentUser​
Gets the logged-in user.
View Source​
public ISelfUser CurrentUser { get; protected set; }
TokenType​
Gets the token type of the logged-in user.
View Source​
public TokenType TokenType { get; }
IDiscordClient.ConnectionState​
Gets the current state of connection.
View Source​
ConnectionState IDiscordClient.ConnectionState { get; }
IDiscordClient.CurrentUser​
Gets the currently logged-in user.
View Source​
ISelfUser IDiscordClient.CurrentUser { get; }
Methods​
LoginAsync(TokenType, String, Boolean)​
View Source​
public async Task LoginAsync(TokenType tokenType, string token, bool validateToken = true)
Returns​
System.Threading.Tasks.Task
Parameters​
Type | Name |
---|---|
Discord.TokenType | tokenType |
System.String | token |
System.Boolean | validateToken |
LogoutAsync()​
View Source​
public async Task LogoutAsync()
Returns​
System.Threading.Tasks.Task
Dispose()​
View Source​
public void Dispose()
GetRecommendedShardCountAsync(RequestOptions)​
Gets the recommended shard count as suggested by Discord.
View Source​
public Task<int> GetRecommendedShardCountAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task<System.Int32>
:
A task that represents the asynchronous get operation. The task result contains an System.Int32
that represents the number of shards that should be used with this account.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
GetBotGatewayAsync(RequestOptions)​
Gets the gateway information related to the bot.
View Source​
public Task<BotGateway> GetBotGatewayAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task<Discord.BotGateway>
:
A task that represents the asynchronous get operation. The task result contains a Discord.BotGateway
that represents the gateway information related to the bot.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetApplicationInfoAsync(RequestOptions)​
Gets a Discord application information for the logged-in user.
View Source​
Task<IApplication> IDiscordClient.GetApplicationInfoAsync(RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IApplication>
:
A task that represents the asynchronous get operation. The task result contains the application
information.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetChannelAsync(UInt64, CacheMode, RequestOptions)​
Gets a generic channel.
View Source​
Task<IChannel> IDiscordClient.GetChannelAsync(ulong id, CacheMode mode, RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IChannel>
:
A task that represents the asynchronous get operation. The task result contains the channel associated
with the snowflake identifier; null
when the channel cannot be found.
Parameters​
Type | Name | Description |
---|---|---|
System.UInt64 | id | The snowflake identifier of the channel (e.g. 381889909113225237 ). |
Discord.CacheMode | mode | The Discord.CacheMode that determines whether the object should be fetched from cache. |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetPrivateChannelsAsync(CacheMode, RequestOptions)​
Gets a collection of private channels opened in this session.
View Source​
Task<IReadOnlyCollection<IPrivateChannel>> IDiscordClient.GetPrivateChannelsAsync(CacheMode mode, RequestOptions options)
Returns​
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.IPrivateChannel>>
:
A task that represents the asynchronous get operation. The task result contains a read-only collection
of private channels that the user currently partakes in.
Parameters​
Type | Name | Description |
---|---|---|
Discord.CacheMode | mode | The Discord.CacheMode that determines whether the object should be fetched from cache. |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetDMChannelsAsync(CacheMode, RequestOptions)​
Gets a collection of direct message channels opened in this session.
View Source​
Task<IReadOnlyCollection<IDMChannel>> IDiscordClient.GetDMChannelsAsync(CacheMode mode, RequestOptions options)
Returns​
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.IDMChannel>>
:
A task that represents the asynchronous get operation. The task result contains a read-only collection
of direct-message channels that the user currently partakes in.
Parameters​
Type | Name | Description |
---|---|---|
Discord.CacheMode | mode | The Discord.CacheMode that determines whether the object should be fetched from cache. |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetGroupChannelsAsync(CacheMode, RequestOptions)​
Gets a collection of group channels opened in this session.
View Source​
Task<IReadOnlyCollection<IGroupChannel>> IDiscordClient.GetGroupChannelsAsync(CacheMode mode, RequestOptions options)
Returns​
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.IGroupChannel>>
:
A task that represents the asynchronous get operation. The task result contains a read-only collection
of group channels that the user currently partakes in.
Parameters​
Type | Name | Description |
---|---|---|
Discord.CacheMode | mode | The Discord.CacheMode that determines whether the object should be fetched from cache. |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetConnectionsAsync(RequestOptions)​
Gets the connections that the user has set up.
View Source​
Task<IReadOnlyCollection<IConnection>> IDiscordClient.GetConnectionsAsync(RequestOptions options)
Returns​
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.IConnection>>
:
A task that represents the asynchronous get operation. The task result contains a read-only collection of connections.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetInviteAsync(String, RequestOptions)​
Gets an invite.
View Source​
Task<IInvite> IDiscordClient.GetInviteAsync(string inviteId, RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IInvite>
:
A task that represents the asynchronous get operation. The task result contains the invite information.
Parameters​
Type | Name | Description |
---|---|---|
System.String | inviteId | The invitation identifier. |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetGuildAsync(UInt64, CacheMode, RequestOptions)​
Gets a guild.
View Source​
Task<IGuild> IDiscordClient.GetGuildAsync(ulong id, CacheMode mode, RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IGuild>
:
A task that represents the asynchronous get operation. The task result contains the guild associated
with the snowflake identifier; null
when the guild cannot be found.
Parameters​
Type | Name | Description |
---|---|---|
System.UInt64 | id | The guild snowflake identifier. |
Discord.CacheMode | mode | The Discord.CacheMode that determines whether the object should be fetched from cache. |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetGuildsAsync(CacheMode, RequestOptions)​
Gets a collection of guilds that the user is currently in.
View Source​
Task<IReadOnlyCollection<IGuild>> IDiscordClient.GetGuildsAsync(CacheMode mode, RequestOptions options)
Returns​
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.IGuild>>
:
A task that represents the asynchronous get operation. The task result contains a read-only collection
of guilds that the current user is in.
Parameters​
Type | Name | Description |
---|---|---|
Discord.CacheMode | mode | The Discord.CacheMode that determines whether the object should be fetched from cache. |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.CreateGuildAsync(String, IVoiceRegion, Stream, RequestOptions)​
Creates a guild for the logged-in user who is in less than 10 active guilds.
View Source​
Task<IGuild> IDiscordClient.CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon, RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IGuild>
:
A task that represents the asynchronous creation operation. The task result contains the created guild.
Parameters​
Type | Name | Description |
---|---|---|
System.String | name | The name of the new guild. |
Discord.IVoiceRegion | region | The voice region to create the guild with. |
System.IO.Stream | jpegIcon | The icon of the guild. |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetUserAsync(UInt64, CacheMode, RequestOptions)​
Gets a user.
View Source​
Task<IUser> IDiscordClient.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IUser>
:
A task that represents the asynchronous get operation. The task result contains the user associated with
the snowflake identifier; null
if the user is not found.
Parameters​
Type | Name | Description |
---|---|---|
System.UInt64 | id | The snowflake identifier of the user (e.g. 168693960628371456 ). |
Discord.CacheMode | mode | The Discord.CacheMode that determines whether the object should be fetched from cache. |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetUserAsync(String, String, RequestOptions)​
Gets a user.
View Source​
Task<IUser> IDiscordClient.GetUserAsync(string username, string discriminator, RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IUser>
:
A task that represents the asynchronous get operation. The task result contains the user associated with
the name and the discriminator; null
if the user is not found.
Parameters​
Type | Name | Description |
---|---|---|
System.String | username | The name of the user (e.g. Still ). |
System.String | discriminator | The discriminator value of the user (e.g. 2876 ). |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetVoiceRegionsAsync(RequestOptions)​
Gets a collection of the available voice regions.
View Source​
Task<IReadOnlyCollection<IVoiceRegion>> IDiscordClient.GetVoiceRegionsAsync(RequestOptions options)
Returns​
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.IVoiceRegion>>
:
A task that represents the asynchronous get operation. The task result contains a read-only collection
with all of the available voice regions in this session.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetVoiceRegionAsync(String, RequestOptions)​
Gets a voice region.
View Source​
Task<IVoiceRegion> IDiscordClient.GetVoiceRegionAsync(string id, RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IVoiceRegion>
:
A task that represents the asynchronous get operation. The task result contains the voice region
associated with the identifier; null
if the voice region is not found.
Parameters​
Type | Name | Description |
---|---|---|
System.String | id | The identifier of the voice region (e.g. eu-central ). |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetWebhookAsync(UInt64, RequestOptions)​
Gets a webhook available.
View Source​
Task<IWebhook> IDiscordClient.GetWebhookAsync(ulong id, RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IWebhook>
:
A task that represents the asynchronous get operation. The task result contains a webhook associated
with the identifier; null
if the webhook is not found.
Parameters​
Type | Name | Description |
---|---|---|
System.UInt64 | id | The identifier of the webhook. |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetGlobalApplicationCommandAsync(UInt64, RequestOptions)​
Gets a global application command.
View Source​
Task<IApplicationCommand> IDiscordClient.GetGlobalApplicationCommandAsync(ulong id, RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IApplicationCommand>
:
A task that represents the asynchronous get operation. The task result contains the application command if found, otherwise
null
.
Parameters​
Type | Name | Description |
---|---|---|
System.UInt64 | id | The id of the command. |
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.GetGlobalApplicationCommandsAsync(RequestOptions)​
Gets a collection of all global commands.
View Source​
Task<IReadOnlyCollection<IApplicationCommand>> IDiscordClient.GetGlobalApplicationCommandsAsync(RequestOptions options)
Returns​
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.IApplicationCommand>>
:
A task that represents the asynchronous get operation. The task result contains a read-only collection of global
application commands.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
IDiscordClient.CreateGlobalApplicationCommand(ApplicationCommandProperties, RequestOptions)​
View Source​
Task<IApplicationCommand> IDiscordClient.CreateGlobalApplicationCommand(ApplicationCommandProperties properties, RequestOptions options)
Returns​
System.Threading.Tasks.Task<Discord.IApplicationCommand>
Parameters​
Type | Name |
---|---|
Discord.ApplicationCommandProperties | properties |
Discord.RequestOptions | options |
IDiscordClient.BulkOverwriteGlobalApplicationCommand(ApplicationCommandProperties[], RequestOptions)​
View Source​
Task<IReadOnlyCollection<IApplicationCommand>> IDiscordClient.BulkOverwriteGlobalApplicationCommand(ApplicationCommandProperties[] properties, RequestOptions options)
Returns​
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.IApplicationCommand>>
Parameters​
Type | Name |
---|---|
Discord.ApplicationCommandProperties[] | properties |
Discord.RequestOptions | options |
IDiscordClient.StartAsync()​
Starts the connection between Discord and the client..
View Source​
Task IDiscordClient.StartAsync()
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous start operation.
IDiscordClient.StopAsync()​
Stops the connection between Discord and the client.
View Source​
Task IDiscordClient.StopAsync()
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous stop operation.
Events​
Log​
View Source​
public event Func<LogMessage, Task> Log
Event Type​
System.Func<Discord.LogMessage,System.Threading.Tasks.Task>
LoggedIn​
View Source​
public event Func<Task> LoggedIn
Event Type​
System.Func<System.Threading.Tasks.Task>
LoggedOut​
View Source​
public event Func<Task> LoggedOut
Event Type​
System.Func<System.Threading.Tasks.Task>
Implements​
- Discord.IDiscordClient
System.IDisposable
Extension Methods​
- Discord.Rest.BaseDiscordClient.Discord.Rest.ClientExtensions.AddGuildUserAsync(System.UInt64,System.UInt64,System.String,System.Action{Discord.AddGuildUserProperties},Discord.RequestOptions)