Table of Contents

Interface ICommandInfo

Namespace
Discord.Interactions
Assembly
Discord.Net.Interactions.dll

Represent a command information object that can be executed.

public interface ICommandInfo

Properties

Attributes

Gets a collection of the attributes of this command.

IReadOnlyCollection<Attribute> Attributes { get; }

Property Value

IReadOnlyCollection<Attribute>

CommandService

Gets the the underlying command service.

InteractionService CommandService { get; }

Property Value

InteractionService

IgnoreGroupNames

Gets true if this command will be registered and executed as a standalone command, unaffected by the GroupAttributes of of the commands parents.

bool IgnoreGroupNames { get; }

Property Value

bool

IsTopLevelCommand

Gets true if this command is a top level command and none of its parents have a GroupAttribute.

bool IsTopLevelCommand { get; }

Property Value

bool

MethodName

Gets the name of the command handler method.

string MethodName { get; }

Property Value

string

Module

Gets the module that the method belongs to.

ModuleInfo Module { get; }

Property Value

ModuleInfo

Name

Gets the name of the command.

string Name { get; }

Property Value

string

Parameters

Gets a collection of the parameters of this command.

IReadOnlyCollection<IParameterInfo> Parameters { get; }

Property Value

IReadOnlyCollection<IParameterInfo>

Preconditions

Gets a collection of the preconditions of this command.

IReadOnlyCollection<PreconditionAttribute> Preconditions { get; }

Property Value

IReadOnlyCollection<PreconditionAttribute>

RunMode

Get the run mode this command gets executed with.

RunMode RunMode { get; }

Property Value

RunMode

SupportsWildCards

Gets whether this command supports wild card patterns.

bool SupportsWildCards { get; }

Property Value

bool

TreatNameAsRegex

bool TreatNameAsRegex { get; }

Property Value

bool

Methods

CheckPreconditionsAsync(IInteractionContext, IServiceProvider)

Check if an execution context meets the command precondition requirements.

Task<PreconditionResult> CheckPreconditionsAsync(IInteractionContext context, IServiceProvider services)

Parameters

context IInteractionContext
services IServiceProvider

Returns

Task<PreconditionResult>

ExecuteAsync(IInteractionContext, IServiceProvider)

Executes the command with the provided context.

Task<IResult> ExecuteAsync(IInteractionContext context, IServiceProvider services)

Parameters

context IInteractionContext

The execution context.

services IServiceProvider

Dependencies that will be used to create the module instance.

Returns

Task<IResult>

A task representing the execution process. The task result contains the execution result.