Table of Contents

Class RestApplicationCommand

Namespace
Discord.Rest
Assembly
Discord.Net.Rest.dll

Represents a Rest-based implementation of the IApplicationCommand.

public abstract class RestApplicationCommand : RestEntity<ulong>, IApplicationCommand, ISnowflakeEntity, IEntity<ulong>, IDeletable
Inheritance
RestApplicationCommand
Implements
Derived
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.

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.

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 options for this command.

public IReadOnlyCollection<RestApplicationCommandOption> Options { get; }

Property Value

IReadOnlyCollection<RestApplicationCommandOption>

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 abstract 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 abstract 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.