Table of Contents

Class SocketApplicationCommand

Namespace
Discord.WebSocket
Assembly
Discord.Net.WebSocket.dll

Represents a Websocket-based IApplicationCommand.

public class SocketApplicationCommand : SocketEntity<ulong>, IApplicationCommand, ISnowflakeEntity, IEntity<ulong>, IDeletable
Inheritance
SocketApplicationCommand
Implements
Inherited Members

Properties

ApplicationId

Gets the unique id of the parent application.

public ulong ApplicationId { get; }

Property Value

ulong

ContextTypes

Gets context types the command can be used in; null if not specified.

public IReadOnlyCollection<InteractionContextType> ContextTypes { get; }

Property Value

IReadOnlyCollection<InteractionContextType>

CreatedAt

Gets when the snowflake was created.

public DateTimeOffset CreatedAt { get; }

Property Value

DateTimeOffset

A DateTimeOffset representing when the entity was first created.

DefaultMemberPermissions

Set of default GuildPermission required to invoke the command.

public GuildPermissions DefaultMemberPermissions { get; }

Property Value

GuildPermissions

Description

Gets the description of the command.

public string Description { get; }

Property Value

string

DescriptionLocalizations

Gets the localization dictionary for the description field of this command.

public IReadOnlyDictionary<string, string> DescriptionLocalizations { get; }

Property Value

IReadOnlyDictionary<string, string>

DescriptionLocalized

Gets the localized description of this command.

public string DescriptionLocalized { get; }

Property Value

string

Remarks

Only returned when the withLocalizations query parameter is set to false when requesting the command.

Guild

Gets the guild this command resides in; if this command is a global command then it will return null

public SocketGuild Guild { get; }

Property Value

SocketGuild

IntegrationTypes

Gets the install method for the command; null if not specified.

public IReadOnlyCollection<ApplicationIntegrationType> IntegrationTypes { get; }

Property Value

IReadOnlyCollection<ApplicationIntegrationType>

IsDefaultPermission

Gets whether the command is enabled by default when the app is added to a guild.

public bool IsDefaultPermission { get; }

Property Value

bool

IsEnabledInDm

Indicates whether the command is available in DMs with the app.

[Obsolete("This property will be deprecated soon. Use ContextTypes instead.")]
public bool IsEnabledInDm { get; }

Property Value

bool

Remarks

Only for globally-scoped commands.

IsGlobalCommand

Gets whether or not this command is a global application command.

public bool IsGlobalCommand { get; }

Property Value

bool

IsNsfw

Indicates whether the command is age restricted.

public bool IsNsfw { get; }

Property Value

bool

Name

Gets the name of the command.

public string Name { get; }

Property Value

string

NameLocalizations

Gets the localization dictionary for the name field of this command.

public IReadOnlyDictionary<string, string> NameLocalizations { get; }

Property Value

IReadOnlyDictionary<string, string>

NameLocalized

Gets the localized name of this command.

public string NameLocalized { get; }

Property Value

string

Remarks

Only returned when the withLocalizations query parameter is set to false when requesting the command.

Options

Gets a collection of SocketApplicationCommandOptions for this command.

public IReadOnlyCollection<SocketApplicationCommandOption> Options { get; }

Property Value

IReadOnlyCollection<SocketApplicationCommandOption>

Remarks

If the Type is not a slash command, this field will be an empty collection.

Type

Gets the type of the command.

public ApplicationCommandType Type { get; }

Property Value

ApplicationCommandType

Methods

DeleteAsync(RequestOptions)

Deletes this object and all its children.

public Task DeleteAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

ModifyAsync(Action<ApplicationCommandProperties>, RequestOptions)

Modifies the current application command.

public Task ModifyAsync(Action<ApplicationCommandProperties> func, RequestOptions options = null)

Parameters

func Action<ApplicationCommandProperties>

The new properties to use when modifying the command.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous modification operation.

ModifyAsync<TArg>(Action<TArg>, RequestOptions)

Modifies the current application command.

public Task ModifyAsync<TArg>(Action<TArg> func, RequestOptions options = null) where TArg : ApplicationCommandProperties

Parameters

func Action<TArg>

The new properties to use when modifying the command.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous modification operation.

Type Parameters

TArg

Exceptions

InvalidOperationException

Thrown when you pass in an invalid ApplicationCommandProperties type.