Interface IDiscordClient
Represents a generic Discord client.
Assembly: Discord.Net.Core.dll​
View Source​
public interface IDiscordClient : IDisposable
Properties​
ConnectionState​
Gets the current state of connection.
View Source​
ConnectionState ConnectionState { get; }
CurrentUser​
Gets the currently logged-in user.
View Source​
ISelfUser CurrentUser { get; }
TokenType​
Gets the token type of the logged-in user.
View Source​
TokenType TokenType { get; }
Methods​
StartAsync()​
Starts the connection between Discord and the client..
View Source​
Task StartAsync()
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous start operation.
StopAsync()​
Stops the connection between Discord and the client.
View Source​
Task StopAsync()
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous stop operation.
GetApplicationInfoAsync(RequestOptions)​
Gets a Discord application information for the logged-in user.
View Source​
Task<IApplication> GetApplicationInfoAsync(RequestOptions options = null)
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. |
GetChannelAsync(UInt64, CacheMode, RequestOptions)​
Gets a generic channel.
View Source​
Task<IChannel> GetChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
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. |
GetPrivateChannelsAsync(CacheMode, RequestOptions)​
Gets a collection of private channels opened in this session.
View Source​
Task<IReadOnlyCollection<IPrivateChannel>> GetPrivateChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
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. |
GetDMChannelsAsync(CacheMode, RequestOptions)​
Gets a collection of direct message channels opened in this session.
View Source​
Task<IReadOnlyCollection<IDMChannel>> GetDMChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
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. |
GetGroupChannelsAsync(CacheMode, RequestOptions)​
Gets a collection of group channels opened in this session.
View Source​
Task<IReadOnlyCollection<IGroupChannel>> GetGroupChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
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. |
GetConnectionsAsync(RequestOptions)​
Gets the connections that the user has set up.
View Source​
Task<IReadOnlyCollection<IConnection>> GetConnectionsAsync(RequestOptions options = null)
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. |
GetGlobalApplicationCommandAsync(UInt64, RequestOptions)​
Gets a global application command.
View Source​
Task<IApplicationCommand> GetGlobalApplicationCommandAsync(ulong id, RequestOptions options = null)
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. |
GetGlobalApplicationCommandsAsync(RequestOptions)​
Gets a collection of all global commands.
View Source​
Task<IReadOnlyCollection<IApplicationCommand>> GetGlobalApplicationCommandsAsync(RequestOptions options = null)
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. |
CreateGlobalApplicationCommand(ApplicationCommandProperties, RequestOptions)​
Creates a global application command.
View Source​
Task<IApplicationCommand> CreateGlobalApplicationCommand(ApplicationCommandProperties properties, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task<Discord.IApplicationCommand>
:
A task that represents the asynchronous creation operation. The task result contains the created application command.
Parameters​
Type | Name | Description |
---|---|---|
Discord.ApplicationCommandProperties | properties | The properties to use when creating the command. |
Discord.RequestOptions | options | The options to be used when sending the request. |
BulkOverwriteGlobalApplicationCommand(ApplicationCommandProperties[], RequestOptions)​
Bulk overwrites all global application commands.
View Source​
Task<IReadOnlyCollection<IApplicationCommand>> BulkOverwriteGlobalApplicationCommand(ApplicationCommandProperties[] properties, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.IApplicationCommand>>
:
A task that represents the asynchronous creation operation. The task result contains a collection of application commands that were created.
Parameters​
Type | Name | Description |
---|---|---|
Discord.ApplicationCommandProperties[] | properties | A collection of properties to use when creating the commands. |
Discord.RequestOptions | options | The options to be used when sending the request. |
GetGuildAsync(UInt64, CacheMode, RequestOptions)​
Gets a guild.
View Source​
Task<IGuild> GetGuildAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
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. |
GetGuildsAsync(CacheMode, RequestOptions)​
Gets a collection of guilds that the user is currently in.
View Source​
Task<IReadOnlyCollection<IGuild>> GetGuildsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
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. |
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> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null, RequestOptions options = null)
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. |
GetInviteAsync(String, RequestOptions)​
Gets an invite.
View Source​
Task<IInvite> GetInviteAsync(string inviteId, RequestOptions options = null)
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. |
GetUserAsync(UInt64, CacheMode, RequestOptions)​
Gets a user.
View Source​
Task<IUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
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. |
GetUserAsync(String, String, RequestOptions)​
Gets a user.
View Source​
Task<IUser> GetUserAsync(string username, string discriminator, RequestOptions options = null)
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. |
GetVoiceRegionsAsync(RequestOptions)​
Gets a collection of the available voice regions.
View Source​
Task<IReadOnlyCollection<IVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null)
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. |
GetVoiceRegionAsync(String, RequestOptions)​
Gets a voice region.
View Source​
Task<IVoiceRegion> GetVoiceRegionAsync(string id, RequestOptions options = null)
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. |
GetWebhookAsync(UInt64, RequestOptions)​
Gets a webhook available.
View Source​
Task<IWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
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. |
GetRecommendedShardCountAsync(RequestOptions)​
Gets the recommended shard count as suggested by Discord.
View Source​
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​
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. |
Extension Methods​
- Discord.IDiscordClient.Discord.DiscordClientExtensions.GetPrivateChannelAsync(System.UInt64)
- Discord.IDiscordClient.Discord.DiscordClientExtensions.GetDMChannelAsync(System.UInt64)
- Discord.DiscordClientExtensions.GetDMChannelsAsync(Discord.IDiscordClient)
- Discord.IDiscordClient.Discord.DiscordClientExtensions.GetGroupChannelAsync(System.UInt64)
- Discord.DiscordClientExtensions.GetGroupChannelsAsync(Discord.IDiscordClient)
- Discord.DiscordClientExtensions.GetOptimalVoiceRegionAsync(Discord.IDiscordClient)