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
CommandService
Gets the the underlying command service.
public InteractionService CommandService { get; }
Property Value
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
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
MethodName
Gets the name of the command handler method.
public string MethodName { get; }
Property Value
Module
Gets the module that the method belongs to.
public ModuleInfo Module { get; }
Property Value
Name
Gets the name of the command.
public string Name { get; }
Property Value
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
RunMode
Get the run mode this command gets executed with.
public RunMode RunMode { get; }
Property Value
SupportsWildCards
Gets whether this command supports wild card patterns.
public abstract bool SupportsWildCards { get; }
Property Value
TreatNameAsRegex
public bool TreatNameAsRegex { get; }
Property Value
Methods
CheckPreconditionsAsync(IInteractionContext, IServiceProvider)
Check if an execution context meets the command precondition requirements.
public Task<PreconditionResult> CheckPreconditionsAsync(IInteractionContext context, IServiceProvider services)
Parameters
context
IInteractionContextservices
IServiceProvider
Returns
ExecuteAsync(IInteractionContext, IServiceProvider)
Executes the command with the provided context.
public virtual Task<IResult> ExecuteAsync(IInteractionContext context, IServiceProvider services)
Parameters
context
IInteractionContextThe execution context.
services
IServiceProviderDependencies 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
InvokeEventAndReturn<T>(IInteractionContext, T)
protected Task<T> InvokeEventAndReturn<T>(IInteractionContext context, T result) where T : IResult
Parameters
context
IInteractionContextresult
T
Returns
- Task<T>
Type Parameters
T
InvokeModuleEvent(IInteractionContext, IResult)
protected abstract Task InvokeModuleEvent(IInteractionContext context, IResult result)
Parameters
context
IInteractionContextresult
IResult
Returns
ParseArgumentsAsync(IInteractionContext, IServiceProvider)
protected abstract Task<IResult> ParseArgumentsAsync(IInteractionContext context, IServiceProvider services)
Parameters
context
IInteractionContextservices
IServiceProvider
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.