Class StandardCommandInstance
Represents a standard command instance.
Implements
Inherited Members
Namespace: TehGM.Wolfringo.Commands.Initialization
Assembly: Wolfringo.Commands.dll
Syntax
public class StandardCommandInstance : CommandInstanceBase, ICommandInstance
Constructors
| Improve this Doc View SourceStandardCommandInstance(String, MethodInfo, IEnumerable<ICommandRequirement>, String, Nullable<PrefixRequirement>, Nullable<Boolean>, Int32)
Creates a new command instance.
Declaration
public StandardCommandInstance(string text, MethodInfo method, IEnumerable<ICommandRequirement> requirements, string prefixOverride, PrefixRequirement? prefixRequirementOverride, bool? caseSensitivityOverride, int timeout)
Parameters
Type | Name | Description |
---|---|---|
String | text | Text that triggers this command. |
MethodInfo | method | Method that will be executed. |
IEnumerable<ICommandRequirement> | requirements | Execution requirements. |
String | prefixOverride | Prefix override; null for no overriding. |
Nullable<PrefixRequirement> | prefixRequirementOverride | Prefix requireent override; null for no overriding. |
Nullable<Boolean> | caseSensitivityOverride | Case sensitivity override; null for no overriding. |
Int32 | timeout | Timeout value for command execution. -1 for no timeout. |
Properties
| Improve this Doc View SourceText
Text that triggers this command.
Declaration
public string Text { get; }
Property Value
Type | Description |
---|---|
String |
Methods
| Improve this Doc View SourceCheckMatchAsync(ICommandContext, IServiceProvider, CancellationToken)
Determines whether the command should execute.
Declaration
public Task<ICommandResult> CheckMatchAsync(ICommandContext context, IServiceProvider services, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ICommandContext | context | Context of the command. |
IServiceProvider | services | Service provider that can be used during the checks. |
CancellationToken | cancellationToken | Cancellation token to cancel the checks. |
Returns
Type | Description |
---|---|
Task<ICommandResult> | Result of the check. |
ExecuteAsync(ICommandContext, IServiceProvider, ICommandResult, Object, CancellationToken)
Executes the command.
Declaration
public async Task<ICommandResult> ExecuteAsync(ICommandContext context, IServiceProvider services, ICommandResult matchResult, object handler, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ICommandContext | context | Context of the command. |
IServiceProvider | services | Services provider for injecting parameters into command method. |
ICommandResult | matchResult | Result of the pre-run check. |
Object | handler | Handler object to execute the command method in. |
CancellationToken | cancellationToken | Cancellation token to cancel the execution. |
Returns
Type | Description |
---|---|
Task<ICommandResult> | Result of the execution. |