Show / Hide Table of Contents

    Class DiscordClient

    A Discord API wrapper.

    Inheritance
    System.Object
    BaseDiscordClient
    DiscordClient
    Inherited Members
    BaseDiscordClient.ApiClient
    BaseDiscordClient.Configuration
    BaseDiscordClient.Logger
    BaseDiscordClient.VersionString
    BaseDiscordClient.CurrentUser
    BaseDiscordClient.CurrentApplication
    BaseDiscordClient.UserCache
    BaseDiscordClient.VoiceRegions
    BaseDiscordClient.InternalVoiceRegions
    BaseDiscordClient.GetCurrentApplicationAsync()
    BaseDiscordClient.ListVoiceRegionsAsync()
    BaseDiscordClient.InitializeAsync()
    BaseDiscordClient.GetGatewayInfoAsync(String)
    Namespace: DSharpPlus
    Assembly: cs.temp.dll.dll
    Syntax
    public sealed class DiscordClient : BaseDiscordClient

    Constructors

    DiscordClient(DiscordConfiguration)

    Initializes a new instance of DiscordClient.

    Declaration
    public DiscordClient(DiscordConfiguration config)
    Parameters
    Type Name Description
    DiscordConfiguration config

    Specifies configuration parameters.

    Properties

    GatewayInfo

    Gets the gateway session information for this client.

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

    GatewayUri

    Gets the gateway URL.

    Declaration
    public Uri GatewayUri { get; }
    Property Value
    Type Description
    Uri

    GatewayVersion

    Gets the gateway protocol version.

    Declaration
    public int GatewayVersion { get; }
    Property Value
    Type Description
    System.Int32

    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 or GuildDownloadCompleted events haven't been fired yet)

    Declaration
    public override IReadOnlyDictionary<ulong, DiscordGuild> Guilds { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<System.UInt64, DiscordGuild>
    Overrides
    BaseDiscordClient.Guilds

    Intents

    Gets the intents configured for this client.

    Declaration
    public DiscordIntents Intents { get; }
    Property Value
    Type Description
    DiscordIntents

    Ping

    Gets the WS latency for this client.

    Declaration
    public int Ping { get; }
    Property Value
    Type Description
    System.Int32

    Presences

    Gets the collection of presences held by this client.

    Declaration
    public IReadOnlyDictionary<ulong, DiscordPresence> Presences { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<System.UInt64, DiscordPresence>

    PrivateChannels

    Gets a dictionary of DM channels that have been cached by this client. The dictionary's key is the channel ID.

    Declaration
    public IReadOnlyDictionary<ulong, DiscordDmChannel> PrivateChannels { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<System.UInt64, DiscordDmChannel>

    ShardCount

    Gets the total number of shards the bot is connected to.

    Declaration
    public int ShardCount { get; }
    Property Value
    Type Description
    System.Int32

    ShardId

    Gets the currently connected shard ID.

    Declaration
    public int ShardId { get; }
    Property Value
    Type Description
    System.Int32

    Methods

    AddExtension(BaseExtension)

    Registers an extension with this client.

    Declaration
    public void AddExtension(BaseExtension ext)
    Parameters
    Type Name Description
    BaseExtension ext

    Extension to register.

    BulkOverwriteGlobalApplicationCommandsAsync(IEnumerable<DiscordApplicationCommand>)

    Overwrites the existing global slash commands. New commands are automatically created and missing commands are automatically deleted.

    Declaration
    public Task<IReadOnlyList<DiscordApplicationCommand>> BulkOverwriteGlobalApplicationCommandsAsync(IEnumerable<DiscordApplicationCommand> commands)
    Parameters
    Type Name Description
    IEnumerable<DiscordApplicationCommand> commands

    The list of commands to overwrite with.

    Returns
    Type Description
    System.Threading.Tasks.Task<IReadOnlyList<DiscordApplicationCommand>>

    The list of global commands.

    BulkOverwriteGuildApplicationCommandsAsync(UInt64, IEnumerable<DiscordApplicationCommand>)

    Overwrites the existing slash commands in a guild. New commands are automatically created and missing commands are automatically deleted.

    Declaration
    public Task<IReadOnlyList<DiscordApplicationCommand>> BulkOverwriteGuildApplicationCommandsAsync(ulong guildId, IEnumerable<DiscordApplicationCommand> commands)
    Parameters
    Type Name Description
    System.UInt64 guildId

    The id of the guild.

    IEnumerable<DiscordApplicationCommand> commands

    The list of commands to overwrite with.

    Returns
    Type Description
    System.Threading.Tasks.Task<IReadOnlyList<DiscordApplicationCommand>>

    The list of guild commands.

    ConnectAsync(DiscordActivity, Nullable<UserStatus>, Nullable<DateTimeOffset>)

    Connects to the gateway

    Declaration
    public async Task ConnectAsync(DiscordActivity activity = null, UserStatus? status = null, DateTimeOffset? idlesince = null)
    Parameters
    Type Name Description
    DiscordActivity activity
    System.Nullable<UserStatus> status
    System.Nullable<DateTimeOffset> idlesince
    Returns
    Type Description
    System.Threading.Tasks.Task
    Exceptions
    Type Condition
    UnauthorizedException

    Thrown when an invalid token was provided.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    CreateGlobalApplicationCommandAsync(DiscordApplicationCommand)

    Creates or overwrites a global slash command.

    Declaration
    public Task<DiscordApplicationCommand> CreateGlobalApplicationCommandAsync(DiscordApplicationCommand command)
    Parameters
    Type Name Description
    DiscordApplicationCommand command

    The command to create.

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

    The created command.

    CreateGuildApplicationCommandAsync(UInt64, DiscordApplicationCommand)

    Creates or overwrites a guild slash command.

    Declaration
    public Task<DiscordApplicationCommand> CreateGuildApplicationCommandAsync(ulong guildId, DiscordApplicationCommand command)
    Parameters
    Type Name Description
    System.UInt64 guildId

    The id of the guild to create the slash command in.

    DiscordApplicationCommand command

    The command to create.

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

    The created command.

    CreateGuildAsync(String, String, Optional<Stream>, Nullable<VerificationLevel>, Nullable<DefaultMessageNotifications>)

    Creates a guild. This requires the bot to be in less than 10 guilds total.

    Declaration
    public Task<DiscordGuild> CreateGuildAsync(string name, string region = null, Optional<Stream> icon = null, VerificationLevel? verificationLevel = null, DefaultMessageNotifications? defaultMessageNotifications = null)
    Parameters
    Type Name Description
    System.String name

    Name of the guild.

    System.String region

    Voice region of the guild.

    Optional<Stream> icon

    Stream containing the icon for the guild.

    System.Nullable<VerificationLevel> verificationLevel

    Verification level for the guild.

    System.Nullable<DefaultMessageNotifications> defaultMessageNotifications

    Default message notification settings for the guild.

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

    The created guild.

    Exceptions
    Type Condition
    NotFoundException

    Thrown when the channel does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    CreateGuildFromTemplateAsync(String, String, Optional<Stream>)

    Creates a guild from a template. This requires the bot to be in less than 10 guilds total.

    Declaration
    public Task<DiscordGuild> CreateGuildFromTemplateAsync(string code, string name, Optional<Stream> icon = null)
    Parameters
    Type Name Description
    System.String code

    The template code.

    System.String name

    Name of the guild.

    Optional<Stream> icon

    Stream containing the icon for the guild.

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

    The created guild.

    Exceptions
    Type Condition
    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    DeleteGlobalApplicationCommandAsync(UInt64)

    Deletes a global slash command.

    Declaration
    public Task DeleteGlobalApplicationCommandAsync(ulong commandId)
    Parameters
    Type Name Description
    System.UInt64 commandId

    The id of the command to delete.

    Returns
    Type Description
    System.Threading.Tasks.Task

    DeleteGuildApplicationCommandAsync(UInt64, UInt64)

    Deletes a slash command in a guild.

    Declaration
    public Task DeleteGuildApplicationCommandAsync(ulong guildId, ulong commandId)
    Parameters
    Type Name Description
    System.UInt64 guildId

    The id of the guild to delete the slash command in.

    System.UInt64 commandId

    The id of the command.

    Returns
    Type Description
    System.Threading.Tasks.Task

    DisconnectAsync()

    Disconnects from the gateway

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

    Dispose()

    Disposes your DiscordClient.

    Declaration
    public override void Dispose()
    Overrides
    BaseDiscordClient.Dispose()

    EditGlobalApplicationCommandAsync(UInt64, Action<ApplicationCommandEditModel>)

    Edits a global slash command.

    Declaration
    public async Task<DiscordApplicationCommand> EditGlobalApplicationCommandAsync(ulong commandId, Action<ApplicationCommandEditModel> action)
    Parameters
    Type Name Description
    System.UInt64 commandId

    The id of the command to edit.

    Action<ApplicationCommandEditModel> action

    Action to perform.

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

    The edited command.

    EditGuildApplicationCommandAsync(UInt64, UInt64, Action<ApplicationCommandEditModel>)

    Edits a slash command in a guild.

    Declaration
    public async Task<DiscordApplicationCommand> EditGuildApplicationCommandAsync(ulong guildId, ulong commandId, Action<ApplicationCommandEditModel> action)
    Parameters
    Type Name Description
    System.UInt64 guildId

    The id of the guild the slash command is in.

    System.UInt64 commandId

    The id of the command to edit.

    Action<ApplicationCommandEditModel> action

    Action to perform.

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

    The edited command.

    Finalize()

    Declaration
    protected void Finalize()

    GetChannelAsync(UInt64)

    Gets a channel

    Declaration
    public async Task<DiscordChannel> GetChannelAsync(ulong id)
    Parameters
    Type Name Description
    System.UInt64 id

    The id of the channel to get.

    Returns
    Type Description
    System.Threading.Tasks.Task<DiscordChannel>
    Exceptions
    Type Condition
    NotFoundException

    Thrown when the channel does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    GetConnectionsAsync()

    Gets a list of connections

    Declaration
    public Task<IReadOnlyList<DiscordConnection>> GetConnectionsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<IReadOnlyList<DiscordConnection>>
    Exceptions
    Type Condition
    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    GetExtension<T>()

    Retrieves a previously-registered extension from this client.

    Declaration
    public T GetExtension<T>()
        where T : BaseExtension
    Returns
    Type Description
    T

    The requested extension.

    Type Parameters
    Name Description
    T

    Type of extension to retrieve.

    GetGlobalApplicationCommandAsync(UInt64)

    Gets a global slash command by its id.

    Declaration
    public Task<DiscordApplicationCommand> GetGlobalApplicationCommandAsync(ulong commandId)
    Parameters
    Type Name Description
    System.UInt64 commandId

    The id of the command to get.

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

    The command with the id.

    GetGlobalApplicationCommandsAsync()

    Gets all the global slash commands for this application.

    Declaration
    public Task<IReadOnlyList<DiscordApplicationCommand>> GetGlobalApplicationCommandsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<IReadOnlyList<DiscordApplicationCommand>>

    A list of global slash commands.

    GetGuildApplicationCommandAsync(UInt64, UInt64)

    Gets a slash command in a guild by its id.

    Declaration
    public Task<DiscordApplicationCommand> GetGuildApplicationCommandAsync(ulong guildId, ulong commandId)
    Parameters
    Type Name Description
    System.UInt64 guildId

    The id of the guild the slash command is in.

    System.UInt64 commandId

    The id of the command to get.

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

    The command with the id.

    GetGuildApplicationCommandsAsync(UInt64)

    Gets all the slash commands for a guild.

    Declaration
    public Task<IReadOnlyList<DiscordApplicationCommand>> GetGuildApplicationCommandsAsync(ulong guildId)
    Parameters
    Type Name Description
    System.UInt64 guildId

    The id of the guild to get slash commands for.

    Returns
    Type Description
    System.Threading.Tasks.Task<IReadOnlyList<DiscordApplicationCommand>>

    A list of slash commands in the guild.

    GetGuildAsync(UInt64, Nullable<Boolean>)

    Gets a guild.

    Setting withCounts to true will make a REST request.

    Declaration
    public async Task<DiscordGuild> GetGuildAsync(ulong id, bool? withCounts = null)
    Parameters
    Type Name Description
    System.UInt64 id

    The guild ID to search for.

    System.Nullable<System.Boolean> withCounts

    Whether to include approximate presence and member counts in the returned guild.

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

    The requested Guild.

    Exceptions
    Type Condition
    NotFoundException

    Thrown when the guild does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    GetGuildPreviewAsync(UInt64)

    Gets a guild preview

    Declaration
    public Task<DiscordGuildPreview> GetGuildPreviewAsync(ulong id)
    Parameters
    Type Name Description
    System.UInt64 id

    The guild ID.

    Returns
    Type Description
    System.Threading.Tasks.Task<DiscordGuildPreview>
    Exceptions
    Type Condition
    NotFoundException

    Thrown when the guild does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    GetInviteByCodeAsync(String, Nullable<Boolean>, Nullable<Boolean>)

    Gets an invite.

    Declaration
    public Task<DiscordInvite> GetInviteByCodeAsync(string code, bool? withCounts = null, bool? withExpiration = null)
    Parameters
    Type Name Description
    System.String code

    The invite code.

    System.Nullable<System.Boolean> withCounts

    Whether to include presence and total member counts in the returned invite.

    System.Nullable<System.Boolean> withExpiration

    Whether to include the expiration date in the returned invite.

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

    The requested Invite.

    Exceptions
    Type Condition
    NotFoundException

    Thrown when the invite does not exists.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    GetStickerAsync(UInt64)

    Gets a sticker.

    Declaration
    public Task<DiscordMessageSticker> GetStickerAsync(ulong stickerId)
    Parameters
    Type Name Description
    System.UInt64 stickerId

    The Id of the sticker.

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

    The specified sticker

    GetStickerPacksAsync()

    Gets a collection of sticker packs that may be used by nitro users.

    Declaration
    public Task<IReadOnlyList<DiscordMessageStickerPack>> GetStickerPacksAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<IReadOnlyList<DiscordMessageStickerPack>>

    GetTemplateAsync(String)

    Gets a guild template by the code.

    Declaration
    public Task<DiscordGuildTemplate> GetTemplateAsync(string code)
    Parameters
    Type Name Description
    System.String code

    The code of the template.

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

    The guild template for the code.

    Exceptions
    Type Condition
    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    GetUserAsync(UInt64)

    Gets a user

    Declaration
    public async Task<DiscordUser> GetUserAsync(ulong userId)
    Parameters
    Type Name Description
    System.UInt64 userId

    Id of the user

    Returns
    Type Description
    System.Threading.Tasks.Task<DiscordUser>
    Exceptions
    Type Condition
    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    GetWebhookAsync(UInt64)

    Gets a webhook

    Declaration
    public Task<DiscordWebhook> GetWebhookAsync(ulong id)
    Parameters
    Type Name Description
    System.UInt64 id
    Returns
    Type Description
    System.Threading.Tasks.Task<DiscordWebhook>
    Exceptions
    Type Condition
    NotFoundException

    Thrown when the webhook does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    GetWebhookWithTokenAsync(UInt64, String)

    Gets a webhook

    Declaration
    public Task<DiscordWebhook> GetWebhookWithTokenAsync(ulong id, string token)
    Parameters
    Type Name Description
    System.UInt64 id
    System.String token
    Returns
    Type Description
    System.Threading.Tasks.Task<DiscordWebhook>
    Exceptions
    Type Condition
    NotFoundException

    Thrown when the webhook does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    ReconnectAsync(Boolean)

    Declaration
    public Task ReconnectAsync(bool startNewSession = false)
    Parameters
    Type Name Description
    System.Boolean startNewSession
    Returns
    Type Description
    System.Threading.Tasks.Task

    SendMessageAsync(DiscordChannel, Action<DiscordMessageBuilder>)

    Sends a message

    Declaration
    public Task<DiscordMessage> SendMessageAsync(DiscordChannel channel, Action<DiscordMessageBuilder> action)
    Parameters
    Type Name Description
    DiscordChannel channel

    Channel to send to.

    Action<DiscordMessageBuilder> action

    The Discord Message builder.

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

    The Discord Message that was sent.

    Exceptions
    Type Condition
    UnauthorizedException

    Thrown when the client does not have the SendMessages permission if TTS is false and SendTtsMessages if TTS is true.

    NotFoundException

    Thrown when the channel does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    SendMessageAsync(DiscordChannel, DiscordEmbed)

    Sends a message

    Declaration
    public Task<DiscordMessage> SendMessageAsync(DiscordChannel channel, DiscordEmbed embed = null)
    Parameters
    Type Name Description
    DiscordChannel channel

    Channel to send to.

    DiscordEmbed embed

    Embed to attach to the message.

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

    The Discord Message that was sent.

    Exceptions
    Type Condition
    UnauthorizedException

    Thrown when the client does not have the SendMessages permission.

    NotFoundException

    Thrown when the channel does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    SendMessageAsync(DiscordChannel, DiscordMessageBuilder)

    Sends a message

    Declaration
    public Task<DiscordMessage> SendMessageAsync(DiscordChannel channel, DiscordMessageBuilder builder)
    Parameters
    Type Name Description
    DiscordChannel channel

    Channel to send to.

    DiscordMessageBuilder builder

    The Discord Message builder.

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

    The Discord Message that was sent.

    Exceptions
    Type Condition
    UnauthorizedException

    Thrown when the client does not have the SendMessages permission if TTS is false and SendTtsMessages if TTS is true.

    NotFoundException

    Thrown when the channel does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    SendMessageAsync(DiscordChannel, String)

    Sends a message

    Declaration
    public Task<DiscordMessage> SendMessageAsync(DiscordChannel channel, string content = null)
    Parameters
    Type Name Description
    DiscordChannel channel

    Channel to send to.

    System.String content

    Message content to send.

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

    The Discord Message that was sent.

    Exceptions
    Type Condition
    UnauthorizedException

    Thrown when the client does not have the SendMessages permission.

    NotFoundException

    Thrown when the channel does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    SendMessageAsync(DiscordChannel, String, DiscordEmbed)

    Sends a message

    Declaration
    public Task<DiscordMessage> SendMessageAsync(DiscordChannel channel, string content = null, DiscordEmbed embed = null)
    Parameters
    Type Name Description
    DiscordChannel channel

    Channel to send to.

    System.String content

    Message content to send.

    DiscordEmbed embed

    Embed to attach to the message.

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

    The Discord Message that was sent.

    Exceptions
    Type Condition
    UnauthorizedException

    Thrown when the client does not have the SendMessages permission.

    NotFoundException

    Thrown when the channel does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    UpdateCurrentUserAsync(String, Optional<Stream>)

    Edits current user.

    Declaration
    public async Task<DiscordUser> UpdateCurrentUserAsync(string username = null, Optional<Stream> avatar = null)
    Parameters
    Type Name Description
    System.String username

    New username.

    Optional<Stream> avatar

    New avatar.

    Returns
    Type Description
    System.Threading.Tasks.Task<DiscordUser>
    Exceptions
    Type Condition
    NotFoundException

    Thrown when the user does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    UpdateStatusAsync(DiscordActivity, Nullable<UserStatus>, Nullable<DateTimeOffset>)

    Updates current user's activity and status.

    Declaration
    public Task UpdateStatusAsync(DiscordActivity activity = null, UserStatus? userStatus = null, DateTimeOffset? idleSince = null)
    Parameters
    Type Name Description
    DiscordActivity activity

    Activity to set.

    System.Nullable<UserStatus> userStatus

    Status of the user.

    System.Nullable<DateTimeOffset> idleSince

    Since when is the client performing the specified activity.

    Returns
    Type Description
    System.Threading.Tasks.Task

    Events

    ApplicationCommandCreated

    Fired when a new application command is registered.

    Declaration
    public event AsyncEventHandler<DiscordClient, ApplicationCommandEventArgs> ApplicationCommandCreated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, ApplicationCommandEventArgs>

    ApplicationCommandDeleted

    Fired when an application command is deleted.

    Declaration
    public event AsyncEventHandler<DiscordClient, ApplicationCommandEventArgs> ApplicationCommandDeleted
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, ApplicationCommandEventArgs>

    ApplicationCommandUpdated

    Fired when an application command is updated.

    Declaration
    public event AsyncEventHandler<DiscordClient, ApplicationCommandEventArgs> ApplicationCommandUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, ApplicationCommandEventArgs>

    ChannelCreated

    Fired when a new channel is created. For this Event you need the Guilds intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, ChannelCreateEventArgs> ChannelCreated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, ChannelCreateEventArgs>

    ChannelDeleted

    Fired when a channel is deleted For this Event you need the Guilds intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, ChannelDeleteEventArgs> ChannelDeleted
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, ChannelDeleteEventArgs>

    ChannelPinsUpdated

    Fired whenever a channel's pinned message list is updated. For this Event you need the Guilds intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, ChannelPinsUpdateEventArgs> ChannelPinsUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, ChannelPinsUpdateEventArgs>

    ChannelUpdated

    Fired when a channel is updated. For this Event you need the Guilds intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, ChannelUpdateEventArgs> ChannelUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, ChannelUpdateEventArgs>

    ClientErrored

    Fired whenever an error occurs within an event handler.

    Declaration
    public event AsyncEventHandler<DiscordClient, ClientErrorEventArgs> ClientErrored
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, ClientErrorEventArgs>

    ComponentInteractionCreated

    Fired when a component is invoked.

    Declaration
    public event AsyncEventHandler<DiscordClient, ComponentInteractionCreateEventArgs> ComponentInteractionCreated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, ComponentInteractionCreateEventArgs>

    DmChannelDeleted

    Fired when a dm channel is deleted For this Event you need the DirectMessages intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, DmChannelDeleteEventArgs> DmChannelDeleted
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, DmChannelDeleteEventArgs>

    GuildAvailable

    Fired when a guild is becoming available. For this Event you need the Guilds intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildCreateEventArgs> GuildAvailable
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildCreateEventArgs>

    GuildBanAdded

    Fired when a guild ban gets added For this Event you need the GuildBans intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildBanAddEventArgs> GuildBanAdded
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildBanAddEventArgs>

    GuildBanRemoved

    Fired when a guild ban gets removed For this Event you need the GuildBans intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildBanRemoveEventArgs> GuildBanRemoved
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildBanRemoveEventArgs>

    GuildCreated

    Fired when the user joins a new guild. For this Event you need the Guilds intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildCreateEventArgs> GuildCreated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildCreateEventArgs>
    Equivalent names

    GuildJoined, JoinedGuild

    GuildDeleted

    Fired when the user leaves or is removed from a guild. For this Event you need the Guilds intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildDeleteEventArgs> GuildDeleted
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildDeleteEventArgs>

    GuildDownloadCompleted

    Fired when all guilds finish streaming from Discord.

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildDownloadCompletedEventArgs> GuildDownloadCompleted
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildDownloadCompletedEventArgs>

    GuildEmojisUpdated

    Fired when a guilds emojis get updated For this Event you need the GuildEmojis intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildEmojisUpdateEventArgs> GuildEmojisUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildEmojisUpdateEventArgs>

    GuildIntegrationsUpdated

    Fired when a guild integration is updated.

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildIntegrationsUpdateEventArgs> GuildIntegrationsUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildIntegrationsUpdateEventArgs>

    GuildMemberAdded

    Fired when a new user joins a guild. For this Event you need the GuildMembers intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildMemberAddEventArgs> GuildMemberAdded
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildMemberAddEventArgs>

    GuildMemberRemoved

    Fired when a user is removed from a guild (leave/kick/ban). For this Event you need the GuildMembers intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildMemberRemoveEventArgs> GuildMemberRemoved
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildMemberRemoveEventArgs>

    GuildMembersChunked

    Fired in response to Gateway Request Guild Members.

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildMembersChunkEventArgs> GuildMembersChunked
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildMembersChunkEventArgs>

    GuildMemberUpdated

    Fired when a guild member is updated. For this Event you need the GuildMembers intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildMemberUpdateEventArgs> GuildMemberUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildMemberUpdateEventArgs>

    GuildRoleCreated

    Fired when a guild role is created. For this Event you need the Guilds intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildRoleCreateEventArgs> GuildRoleCreated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildRoleCreateEventArgs>

    GuildRoleDeleted

    Fired when a guild role is updated. For this Event you need the Guilds intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildRoleDeleteEventArgs> GuildRoleDeleted
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildRoleDeleteEventArgs>

    GuildRoleUpdated

    Fired when a guild role is updated. For this Event you need the Guilds intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildRoleUpdateEventArgs> GuildRoleUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildRoleUpdateEventArgs>

    GuildStickersUpdated

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildStickersUpdateEventArgs> GuildStickersUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildStickersUpdateEventArgs>

    GuildUnavailable

    Fired when a guild becomes unavailable.

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildDeleteEventArgs> GuildUnavailable
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildDeleteEventArgs>

    GuildUpdated

    Fired when a guild is updated. For this Event you need the Guilds intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, GuildUpdateEventArgs> GuildUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, GuildUpdateEventArgs>

    Heartbeated

    Fired on received heartbeat ACK.

    Declaration
    public event AsyncEventHandler<DiscordClient, HeartbeatEventArgs> Heartbeated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, HeartbeatEventArgs>

    IntegrationCreated

    Fired when an integration is created.

    Declaration
    public event AsyncEventHandler<DiscordClient, IntegrationCreateEventArgs> IntegrationCreated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, IntegrationCreateEventArgs>

    IntegrationDeleted

    Fired when an integration is deleted.

    Declaration
    public event AsyncEventHandler<DiscordClient, IntegrationDeleteEventArgs> IntegrationDeleted
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, IntegrationDeleteEventArgs>

    IntegrationUpdated

    Fired when an integration is updated.

    Declaration
    public event AsyncEventHandler<DiscordClient, IntegrationUpdateEventArgs> IntegrationUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, IntegrationUpdateEventArgs>

    InteractionCreated

    Fired when an interaction is invoked.

    Declaration
    public event AsyncEventHandler<DiscordClient, InteractionCreateEventArgs> InteractionCreated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, InteractionCreateEventArgs>

    InviteCreated

    Fired when an invite is created. For this Event you need the GuildInvites intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, InviteCreateEventArgs> InviteCreated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, InviteCreateEventArgs>

    InviteDeleted

    Fired when an invite is deleted. For this Event you need the GuildInvites intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, InviteDeleteEventArgs> InviteDeleted
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, InviteDeleteEventArgs>

    MessageAcknowledged

    Fired when message is acknowledged by the user. For this Event you need the GuildMessages intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, MessageAcknowledgeEventArgs> MessageAcknowledged
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, MessageAcknowledgeEventArgs>

    MessageCreated

    Fired when a message is created. For this Event you need the GuildMessages intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, MessageCreateEventArgs> MessageCreated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, MessageCreateEventArgs>

    MessageDeleted

    Fired when a message is deleted. For this Event you need the GuildMessages intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, MessageDeleteEventArgs> MessageDeleted
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, MessageDeleteEventArgs>

    MessageReactionAdded

    Fired when a reaction gets added to a message. For this Event you need the GuildMessageReactions intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, MessageReactionAddEventArgs> MessageReactionAdded
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, MessageReactionAddEventArgs>

    MessageReactionRemoved

    Fired when a reaction gets removed from a message. For this Event you need the GuildMessageReactions intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, MessageReactionRemoveEventArgs> MessageReactionRemoved
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, MessageReactionRemoveEventArgs>

    MessageReactionRemovedEmoji

    Fired when all reactions of a specific reaction are removed from a message. For this Event you need the GuildMessageReactions intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, MessageReactionRemoveEmojiEventArgs> MessageReactionRemovedEmoji
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, MessageReactionRemoveEmojiEventArgs>

    MessageReactionsCleared

    Fired when all reactions get removed from a message. For this Event you need the GuildMessageReactions intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, MessageReactionsClearEventArgs> MessageReactionsCleared
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, MessageReactionsClearEventArgs>

    MessagesBulkDeleted

    Fired when multiple messages are deleted at once. For this Event you need the GuildMessages intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, MessageBulkDeleteEventArgs> MessagesBulkDeleted
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, MessageBulkDeleteEventArgs>

    MessageUpdated

    Fired when a message is updated. For this Event you need the GuildMessages intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, MessageUpdateEventArgs> MessageUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, MessageUpdateEventArgs>

    PresenceUpdated

    Fired when a presence has been updated. For this Event you need the GuildPresences intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, PresenceUpdateEventArgs> PresenceUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, PresenceUpdateEventArgs>

    Ready

    Fired when the client enters ready state.

    Declaration
    public event AsyncEventHandler<DiscordClient, ReadyEventArgs> Ready
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, ReadyEventArgs>

    Resumed

    Fired whenever a session is resumed.

    Declaration
    public event AsyncEventHandler<DiscordClient, ReadyEventArgs> Resumed
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, ReadyEventArgs>

    SocketClosed

    Fired whenever WebSocket connection is terminated.

    Declaration
    public event AsyncEventHandler<DiscordClient, SocketCloseEventArgs> SocketClosed
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, SocketCloseEventArgs>

    SocketErrored

    Fired whenever a WebSocket error occurs within the client.

    Declaration
    public event AsyncEventHandler<DiscordClient, SocketErrorEventArgs> SocketErrored
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, SocketErrorEventArgs>

    SocketOpened

    Fired whenever WebSocket connection is established.

    Declaration
    public event AsyncEventHandler<DiscordClient, SocketEventArgs> SocketOpened
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, SocketEventArgs>

    TypingStarted

    Fired when a user starts typing in a channel.

    Declaration
    public event AsyncEventHandler<DiscordClient, TypingStartEventArgs> TypingStarted
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, TypingStartEventArgs>

    UnknownEvent

    Fired when an unknown event gets received.

    Declaration
    public event AsyncEventHandler<DiscordClient, UnknownEventArgs> UnknownEvent
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, UnknownEventArgs>

    UserSettingsUpdated

    Fired when the current user updates their settings. For this Event you need the GuildPresences intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, UserSettingsUpdateEventArgs> UserSettingsUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, UserSettingsUpdateEventArgs>

    UserUpdated

    Fired when properties about the current user change.

    Declaration
    public event AsyncEventHandler<DiscordClient, UserUpdateEventArgs> UserUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, UserUpdateEventArgs>
    Remarks

    NB: This event only applies for changes to the current user, the client that is connected to Discord. For this Event you need the GuildPresences intent specified in Intents

    VoiceServerUpdated

    Fired when a guild's voice server is updated. For this Event you need the GuildVoiceStates intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, VoiceServerUpdateEventArgs> VoiceServerUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, VoiceServerUpdateEventArgs>

    VoiceStateUpdated

    Fired when someone joins/leaves/moves voice channels. For this Event you need the GuildVoiceStates intent specified in Intents

    Declaration
    public event AsyncEventHandler<DiscordClient, VoiceStateUpdateEventArgs> VoiceStateUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, VoiceStateUpdateEventArgs>

    WebhooksUpdated

    Fired whenever webhooks update.

    Declaration
    public event AsyncEventHandler<DiscordClient, WebhooksUpdateEventArgs> WebhooksUpdated
    Event Type
    Type Description
    AsyncEventHandler<DiscordClient, WebhooksUpdateEventArgs>

    Equivalent names

    GuildJoined

    See GuildCreated

    JoinedGuild

    See GuildCreated
    Back to top © 2016-2021 DSharpPlus Contributors