Class DiscordClient
- Namespace
- DSharpPlus
- Assembly
- DSharpPlus.dll
A Discord API wrapper.
public sealed class DiscordClient : BaseDiscordClient
- Inheritance
-
objectDiscordClient
- Inherited Members
Constructors
Properties
- AllShardsConnected
Gets whether this client is connected to the gateway.
- Guilds
Gets a dictionary of guilds that this client is in. The dictionary's key is the guild ID. Note that the guild objects in this dictionary will not be filled in if the specific guilds aren't available (the
GuildAvailable
orGuildDownloadCompleted
events haven't been fired yet)
- Presences
Gets the collection of presences held by this client.
- PrivateChannels
Gets a dictionary of DM channels that have been cached by this client. The dictionary's key is the channel ID.
- ServiceProvider
Gets the service provider used within this Discord application.
Methods
- BulkOverwriteGlobalApplicationCommandsAsync(IEnumerable<DiscordApplicationCommand>)
Overwrites the existing global application commands. New commands are automatically created and missing commands are automatically deleted.
- BulkOverwriteGuildApplicationCommandsAsync(ulong, IEnumerable<DiscordApplicationCommand>)
Overwrites the existing application commands in a guild. New commands are automatically created and missing commands are automatically deleted.
- ConnectAsync(DiscordActivity, DiscordUserStatus?, DateTimeOffset?)
Connects to the gateway
- CreateApplicationEmojiAsync(string, Stream)
Creates a new emoji owned by the current application.
- CreateGlobalApplicationCommandAsync(DiscordApplicationCommand)
Creates or overwrites a global application command.
- CreateGuildApplicationCommandAsync(ulong, DiscordApplicationCommand)
Creates or overwrites a guild application command.
- CreateGuildAsync(string, string?, Optional<Stream>, DiscordVerificationLevel?, DiscordDefaultMessageNotifications?, DiscordSystemChannelFlags?)
Creates a guild. This requires the bot to be in less than 10 guilds total.
- CreateGuildFromTemplateAsync(string, string, Optional<Stream>)
Creates a guild from a template. This requires the bot to be in less than 10 guilds total.
- DeleteApplicationEmojiAsync(ulong)
Deletes an emoji.
- DeleteGlobalApplicationCommandAsync(ulong)
Deletes a global application command.
- DeleteGuildApplicationCommandAsync(ulong, ulong)
Deletes a application command in a guild.
- DisconnectAsync()
Disconnects from the gateway
- Dispose()
Disposes your DiscordClient.
- EditGlobalApplicationCommandAsync(ulong, Action<ApplicationCommandEditModel>)
Edits a global application command.
- EditGuildApplicationCommandAsync(ulong, ulong, Action<ApplicationCommandEditModel>)
Edits a application command in a guild.
- GetApplicationEmojiAsync(ulong)
Gets an emoji owned by the current application.
- GetApplicationEmojisAsync()
Gets all emojis created or owned by the current application.
- GetChannelAsync(ulong)
Gets a channel
- GetConnectionLatency(ulong)
Gets the latency in the connection to a specific guild.
- GetConnectionsAsync()
Gets a list of connections
- GetGlobalApplicationCommandAsync(string, bool)
Gets a global application command by its name.
- GetGlobalApplicationCommandAsync(ulong)
Gets a global application command by its id.
- GetGlobalApplicationCommandsAsync(bool)
Gets all the global application commands for this application.
- GetGuildApplicationCommandAsync(ulong, ulong)
Gets a application command in a guild by its ID.
- GetGuildApplicationCommandsAsync(ulong, bool)
Gets all the application commands for a guild.
- GetGuildAsync(ulong, bool?)
Gets a guild.
Setting
withCounts
to true will make a REST request.
- GetGuildPreviewAsync(ulong)
Gets a guild preview
- GetGuildsAfterAsync(ulong, int, bool?, CancellationToken)
Returns a list of guilds after a certain guild. This will execute one API request per 200 guilds.
The amount of guilds to fetch.The ID of the guild after which we fetch the guilds.Whether to include approximate member and presence counts in the returned guilds.Cancels the enumeration before doing the next api request
- GetGuildsAsync(int, bool?, CancellationToken)
Returns a list of guilds the bot is in. This will execute one API request per 200 guilds.
The amount of guilds to fetch.Whether to include approximate member and presence counts in the returned guilds.Cancels the enumeration before doing the next api request
- GetGuildsBeforeAsync(ulong, int, bool?, CancellationToken)
Returns a list of guilds before a certain guild. This will execute one API request per 200 guilds.
The amount of guilds to fetch.The ID of the guild before which we fetch the guildsWhether to include approximate member and presence counts in the returned guilds.Cancels the enumeration before doing the next api request
- GetInviteByCodeAsync(string, bool?, bool?)
Gets an invite.
- GetStickerAsync(ulong)
Gets a sticker.
- GetStickerPacksAsync()
Gets a collection of sticker packs that may be used by nitro users.
- GetTemplateAsync(string)
Gets a guild template by the code.
- GetUserAsync(ulong, bool)
Gets a user
- GetWebhookAsync(ulong)
Gets a webhook
- GetWebhookWithTokenAsync(ulong, string)
Gets a webhook
- ModifyApplicationEmojiAsync(ulong, string)
Modifies an existing application emoji.
- ModifyCurrentUserAsync(string, Optional<Stream>, Optional<Stream>)
Edits current user.
- ReconnectAsync()
Reconnects all shards to the gateway.
- SendMessageAsync(DiscordChannel, DiscordEmbed)
Sends a message
- SendMessageAsync(DiscordChannel, DiscordMessageBuilder)
Sends a message
- SendMessageAsync(DiscordChannel, Action<DiscordMessageBuilder>)
Sends a message
- SendMessageAsync(DiscordChannel, string)
Sends a message
- SendMessageAsync(DiscordChannel, string, DiscordEmbed)
Sends a message
- SendPayloadAsync(GatewayOpCode, object?, ulong)
Sends a raw payload to the gateway. This method is not recommended for use unless you know what you're doing.
- UpdateStatusAsync(DiscordActivity, DiscordUserStatus?, DateTimeOffset?, int?)
Updates current user's activity and status.