Interface ICommandInfo
Represent a command information object that can be executed.
Namespace: Discord.Interactions
Assembly: Discord.Net.Interactions.dll
Syntax
public interface ICommandInfo
Properties
| Improve this Doc View SourceAttributes
Gets a collection of the attributes of this command.
Declaration
IReadOnlyCollection<Attribute> Attributes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<Attribute> |
CommandService
Gets the the underlying command service.
Declaration
InteractionService CommandService { get; }
Property Value
Type | Description |
---|---|
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.
Declaration
bool IgnoreGroupNames { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsTopLevelCommand
Gets true if this command is a top level command and none of its parents have a GroupAttribute.
Declaration
bool IsTopLevelCommand { get; }
Property Value
Type | Description |
---|---|
Boolean |
MethodName
Gets the name of the command handler method.
Declaration
string MethodName { get; }
Property Value
Type | Description |
---|---|
String |
Module
Gets the module that the method belongs to.
Declaration
ModuleInfo Module { get; }
Property Value
Type | Description |
---|---|
ModuleInfo |
Name
Gets the name of the command.
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
String |
Parameters
Gets a collection of the parameters of this command.
Declaration
IReadOnlyCollection<IParameterInfo> Parameters { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<IParameterInfo> |
Preconditions
Gets a collection of the preconditions of this command.
Declaration
IReadOnlyCollection<PreconditionAttribute> Preconditions { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<PreconditionAttribute> |
RunMode
Get the run mode this command gets executed with.
Declaration
RunMode RunMode { get; }
Property Value
Type | Description |
---|---|
RunMode |
SupportsWildCards
Gets whether this command supports wild card patterns.
Declaration
bool SupportsWildCards { get; }
Property Value
Type | Description |
---|---|
Boolean |
TreatNameAsRegex
Declaration
bool TreatNameAsRegex { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceCheckPreconditionsAsync(IInteractionContext, IServiceProvider)
Check if an execution context meets the command precondition requirements.
Declaration
Task<PreconditionResult> CheckPreconditionsAsync(IInteractionContext context, IServiceProvider services)
Parameters
Type | Name | Description |
---|---|---|
IInteractionContext | context | |
IServiceProvider | services |
Returns
Type | Description |
---|---|
Task<PreconditionResult> |
ExecuteAsync(IInteractionContext, IServiceProvider)
Executes the command with the provided context.
Declaration
Task<IResult> ExecuteAsync(IInteractionContext context, IServiceProvider services)
Parameters
Type | Name | Description |
---|---|---|
IInteractionContext | context | The execution context. |
IServiceProvider | services | Dependencies that will be used to create the module instance. |
Returns
Type | Description |
---|---|
Task<IResult> | A task representing the execution process. The task result contains the execution result. |