Show / Hide Table of Contents

Class BaseDiscordClient

Inheritance
System.Object
BaseDiscordClient
DiscordRestClient
BaseSocketClient
Implements
IDiscordClient
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Discord.Rest
Assembly: Discord.Net.Rest.dll
Syntax
public abstract class BaseDiscordClient : IDiscordClient, IDisposable

Properties

| Improve this Doc View Source

CurrentUser

Gets the logged-in user.

Declaration
public ISelfUser CurrentUser { get; protected set; }
Property Value
Type Description
ISelfUser
| Improve this Doc View Source

LoginState

Gets the login state of the client.

Declaration
public LoginState LoginState { get; }
Property Value
Type Description
LoginState
| Improve this Doc View Source

TokenType

Gets the token type of the logged-in user.

Declaration
public TokenType TokenType { get; }
Property Value
Type Description
TokenType

Methods

| Improve this Doc View Source

Dispose()

Declaration
public void Dispose()
| Improve this Doc View Source

GetRecommendedShardCountAsync(RequestOptions)

Gets the recommended shard count as suggested by Discord.

Declaration
public Task<int> GetRecommendedShardCountAsync(RequestOptions options = null)
Parameters
Type Name Description
RequestOptions options

The options to be used when sending the request.

Returns
Type Description
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.

| Improve this Doc View Source

LoginAsync(TokenType, String, Boolean)

Declaration
public Task LoginAsync(TokenType tokenType, string token, bool validateToken = true)
Parameters
Type Name Description
TokenType tokenType
System.String token
System.Boolean validateToken
Returns
Type Description
System.Threading.Tasks.Task
| Improve this Doc View Source

LogoutAsync()

Declaration
public Task LogoutAsync()
Returns
Type Description
System.Threading.Tasks.Task

Events

| Improve this Doc View Source

Log

Declaration
public event Func<LogMessage, Task> Log
Event Type
Type Description
System.Func<LogMessage, System.Threading.Tasks.Task>
| Improve this Doc View Source

LoggedIn

Declaration
public event Func<Task> LoggedIn
Event Type
Type Description
System.Func<System.Threading.Tasks.Task>
| Improve this Doc View Source

LoggedOut

Declaration
public event Func<Task> LoggedOut
Event Type
Type Description
System.Func<System.Threading.Tasks.Task>

Explicit Interface Implementations

| Improve this Doc View Source

IDiscordClient.ConnectionState

Gets the current state of connection.

Declaration
ConnectionState IDiscordClient.ConnectionState { get; }
Returns
Type Description
ConnectionState
| Improve this Doc View Source

IDiscordClient.CreateGuildAsync(String, IVoiceRegion, Stream, RequestOptions)

Creates a guild for the logged-in user who is in less than 10 active guilds.

Declaration
Task<IGuild> IDiscordClient.CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon, RequestOptions options)
Parameters
Type Name Description
System.String name

The name of the new guild.

IVoiceRegion region

The voice region to create the guild with.

System.IO.Stream jpegIcon

The icon of the guild.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<IGuild>

A task that represents the asynchronous creation operation. The task result contains the created guild.

Remarks

This method creates a new guild on behalf of the logged-in user.

warning

Due to Discord's limitation, this method will only work for users that are in less than 10 guilds.

Exceptions
Type Condition
System.NotSupportedException

Creating a guild is not supported with the base client.

| Improve this Doc View Source

IDiscordClient.CurrentUser

Gets the currently logged-in user.

Declaration
ISelfUser IDiscordClient.CurrentUser { get; }
Returns
Type Description
ISelfUser
| Improve this Doc View Source

IDiscordClient.GetApplicationInfoAsync(RequestOptions)

Gets a Discord application information for the logged-in user.

Declaration
Task<IApplication> IDiscordClient.GetApplicationInfoAsync(RequestOptions options)
Parameters
Type Name Description
RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<IApplication>

A task that represents the asynchronous get operation. The task result contains the application information.

Remarks

This method reflects your application information you submitted when creating a Discord application via the Developer Portal.

| Improve this Doc View Source

IDiscordClient.GetChannelAsync(UInt64, CacheMode, RequestOptions)

Gets a generic channel.

Declaration
Task<IChannel> IDiscordClient.GetChannelAsync(ulong id, CacheMode mode, RequestOptions options)
Parameters
Type Name Description
System.UInt64 id

The snowflake identifier of the channel (e.g. 381889909113225237).

CacheMode mode

The CacheMode that determines whether the object should be fetched from cache.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<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.

| Improve this Doc View Source

IDiscordClient.GetConnectionsAsync(RequestOptions)

Gets the connections that the user has set up.

Declaration
Task<IReadOnlyCollection<IConnection>> IDiscordClient.GetConnectionsAsync(RequestOptions options)
Parameters
Type Name Description
RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IConnection>>

A task that represents the asynchronous get operation. The task result contains a read-only collection of connections.

| Improve this Doc View Source

IDiscordClient.GetDMChannelsAsync(CacheMode, RequestOptions)

Gets a collection of direct message channels opened in this session.

Declaration
Task<IReadOnlyCollection<IDMChannel>> IDiscordClient.GetDMChannelsAsync(CacheMode mode, RequestOptions options)
Parameters
Type Name Description
CacheMode mode

The CacheMode that determines whether the object should be fetched from cache.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<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.

Remarks

This method returns a collection of currently opened direct message channels.

warning

This method will not return previously opened DM channels outside of the current session! If you have just started the client, this may return an empty collection.

| Improve this Doc View Source

IDiscordClient.GetGroupChannelsAsync(CacheMode, RequestOptions)

Gets a collection of group channels opened in this session.

Declaration
Task<IReadOnlyCollection<IGroupChannel>> IDiscordClient.GetGroupChannelsAsync(CacheMode mode, RequestOptions options)
Parameters
Type Name Description
CacheMode mode

The CacheMode that determines whether the object should be fetched from cache.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<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.

Remarks

This method returns a collection of currently opened group channels.

warning

This method will not return previously opened group channels outside of the current session! If you have just started the client, this may return an empty collection.

| Improve this Doc View Source

IDiscordClient.GetGuildAsync(UInt64, CacheMode, RequestOptions)

Gets a guild.

Declaration
Task<IGuild> IDiscordClient.GetGuildAsync(ulong id, CacheMode mode, RequestOptions options)
Parameters
Type Name Description
System.UInt64 id

The guild snowflake identifier.

CacheMode mode

The CacheMode that determines whether the object should be fetched from cache.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<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.

| Improve this Doc View Source

IDiscordClient.GetGuildsAsync(CacheMode, RequestOptions)

Gets a collection of guilds that the user is currently in.

Declaration
Task<IReadOnlyCollection<IGuild>> IDiscordClient.GetGuildsAsync(CacheMode mode, RequestOptions options)
Parameters
Type Name Description
CacheMode mode

The CacheMode that determines whether the object should be fetched from cache.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<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.

| Improve this Doc View Source

IDiscordClient.GetInviteAsync(String, RequestOptions)

Gets an invite.

Declaration
Task<IInvite> IDiscordClient.GetInviteAsync(string inviteId, RequestOptions options)
Parameters
Type Name Description
System.String inviteId

The invitation identifier.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<IInvite>

A task that represents the asynchronous get operation. The task result contains the invite information.

| Improve this Doc View Source

IDiscordClient.GetPrivateChannelsAsync(CacheMode, RequestOptions)

Gets a collection of private channels opened in this session.

Declaration
Task<IReadOnlyCollection<IPrivateChannel>> IDiscordClient.GetPrivateChannelsAsync(CacheMode mode, RequestOptions options)
Parameters
Type Name Description
CacheMode mode

The CacheMode that determines whether the object should be fetched from cache.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<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.

Remarks

This method will retrieve all private channels (including direct-message, group channel and such) that are currently opened in this session.

warning

This method will not return previously opened private channels outside of the current session! If you have just started the client, this may return an empty collection.

| Improve this Doc View Source

IDiscordClient.GetUserAsync(String, String, RequestOptions)

Gets a user.

Declaration
Task<IUser> IDiscordClient.GetUserAsync(string username, string discriminator, RequestOptions options)
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).

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<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.

| Improve this Doc View Source

IDiscordClient.GetUserAsync(UInt64, CacheMode, RequestOptions)

Gets a user.

Declaration
Task<IUser> IDiscordClient.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
Parameters
Type Name Description
System.UInt64 id

The snowflake identifier of the user (e.g. 168693960628371456).

CacheMode mode

The CacheMode that determines whether the object should be fetched from cache.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<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.

| Improve this Doc View Source

IDiscordClient.GetVoiceRegionAsync(String, RequestOptions)

Gets a voice region.

Declaration
Task<IVoiceRegion> IDiscordClient.GetVoiceRegionAsync(string id, RequestOptions options)
Parameters
Type Name Description
System.String id

The identifier of the voice region (e.g. eu-central ).

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<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.

| Improve this Doc View Source

IDiscordClient.GetVoiceRegionsAsync(RequestOptions)

Gets a collection of the available voice regions.

Declaration
Task<IReadOnlyCollection<IVoiceRegion>> IDiscordClient.GetVoiceRegionsAsync(RequestOptions options)
Parameters
Type Name Description
RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<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.

| Improve this Doc View Source

IDiscordClient.GetWebhookAsync(UInt64, RequestOptions)

Gets a webhook available.

Declaration
Task<IWebhook> IDiscordClient.GetWebhookAsync(ulong id, RequestOptions options)
Parameters
Type Name Description
System.UInt64 id

The identifier of the webhook.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task<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.

| Improve this Doc View Source

IDiscordClient.StartAsync()

Starts the connection between Discord and the client..

Declaration
Task IDiscordClient.StartAsync()
Returns
Type Description
System.Threading.Tasks.Task

A task that represents the asynchronous start operation.

Remarks

This method will initialize the connection between the client and Discord.

important

This method will immediately return after it is called, as it will initialize the connection on another thread.

| Improve this Doc View Source

IDiscordClient.StopAsync()

Stops the connection between Discord and the client.

Declaration
Task IDiscordClient.StopAsync()
Returns
Type Description
System.Threading.Tasks.Task

A task that represents the asynchronous stop operation.

Implements

IDiscordClient
System.IDisposable

Extension Methods

ClientExtensions.AddGuildUserAsync(BaseDiscordClient, UInt64, UInt64, String, Action<AddGuildUserProperties>, RequestOptions)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX