Table of Contents

Class CommandInfo<TParameter>

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

The base information class for InteractionService commands.

public abstract class CommandInfo<TParameter> : ICommandInfo where TParameter : class, IParameterInfo

Type Parameters

TParameter

The type of IParameterInfo that is used by this command type.

Inheritance
CommandInfo<TParameter>
Implements
Derived
Inherited Members

Properties

Attributes

Gets a collection of the attributes of this command.

public IReadOnlyCollection<Attribute> Attributes { get; }

Property Value

IReadOnlyCollection<Attribute>

CommandService

Gets the the underlying command service.

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

public virtual 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.

public bool IsTopLevelCommand { get; }

Property Value

bool

MethodName

Gets the name of the command handler method.

public string MethodName { get; }

Property Value

string

Module

Gets the module that the method belongs to.

public ModuleInfo Module { get; }

Property Value

ModuleInfo

Name

Gets the name of the command.

public string Name { get; }

Property Value

string

Parameters

Gets a collection of the parameters of this command.

public abstract IReadOnlyList<TParameter> Parameters { get; }

Property Value

IReadOnlyList<TParameter>

Preconditions

Gets a collection of the preconditions of this command.

public IReadOnlyCollection<PreconditionAttribute> Preconditions { get; }

Property Value

IReadOnlyCollection<PreconditionAttribute>

RunMode

Get the run mode this command gets executed with.

public RunMode RunMode { get; }

Property Value

RunMode

SupportsWildCards

Gets whether this command supports wild card patterns.

public abstract bool SupportsWildCards { get; }

Property Value

bool

TreatNameAsRegex

public bool TreatNameAsRegex { get; }

Property Value

bool

Methods

CheckPreconditionsAsync(IInteractionContext, IServiceProvider)

Check if an execution context meets the command precondition requirements.

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

public virtual 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.

GetLogString(IInteractionContext)

protected abstract string GetLogString(IInteractionContext context)

Parameters

context IInteractionContext

Returns

string

InvokeEventAndReturn<T>(IInteractionContext, T)

protected Task<T> InvokeEventAndReturn<T>(IInteractionContext context, T result) where T : IResult

Parameters

context IInteractionContext
result T

Returns

Task<T>

Type Parameters

T

InvokeModuleEvent(IInteractionContext, IResult)

protected abstract Task InvokeModuleEvent(IInteractionContext context, IResult result)

Parameters

context IInteractionContext
result IResult

Returns

Task

ParseArgumentsAsync(IInteractionContext, IServiceProvider)

protected abstract Task<IResult> ParseArgumentsAsync(IInteractionContext context, IServiceProvider services)

Parameters

context IInteractionContext
services IServiceProvider

Returns

Task<IResult>

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.