Class RegexCommandInstance
Represents a regex command instance.
Implements
Inherited Members
Namespace: TehGM.Wolfringo.Commands.Initialization
Assembly: Wolfringo.Commands.dll
Syntax
public class RegexCommandInstance : CommandInstanceBase, ICommandInstance
Constructors
| Improve this Doc View SourceRegexCommandInstance(String, RegexOptions, TimeSpan, MethodInfo, IEnumerable<ICommandRequirement>, String, Nullable<PrefixRequirement>, Nullable<Boolean>, Int32)
Creates a new command instance.
Declaration
public RegexCommandInstance(string pattern, RegexOptions regexOptions, TimeSpan regexTimeout, MethodInfo method, IEnumerable<ICommandRequirement> requirements, string prefixOverride, PrefixRequirement? prefixRequirementOverride, bool? caseSensitivityOverride, int timeout)
Parameters
Type | Name | Description |
---|---|---|
String | pattern | Regex pattern that triggers this command. |
RegexOptions | regexOptions | Regex options to build Regex with. |
TimeSpan | regexTimeout | Timeout for regex engine. |
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 SourcePattern
Regex pattern that triggers this command.
Declaration
public string Pattern { 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. |