@@ -16,7 +16,7 @@ namespace Discord.Commands | |||||
public Task<PreconditionResult> CheckPreconditionsAsync(ICommandContext context, IDependencyMap map = null) | public Task<PreconditionResult> CheckPreconditionsAsync(ICommandContext context, IDependencyMap map = null) | ||||
=> Command.CheckPreconditionsAsync(context, map); | => Command.CheckPreconditionsAsync(context, map); | ||||
public Task<ParseResult> ParseAsync(ICommandContext context, SearchResult searchResult, PreconditionResult? preconditionResult = null) | |||||
public Task<ParseResult> ParseAsync(ICommandContext context, SearchResult searchResult, PreconditionResult preconditionResult = null) | |||||
=> Command.ParseAsync(context, Alias.Length, searchResult, preconditionResult); | => Command.ParseAsync(context, Alias.Length, searchResult, preconditionResult); | ||||
public Task<ExecuteResult> ExecuteAsync(ICommandContext context, IEnumerable<object> argList, IEnumerable<object> paramList, IDependencyMap map) | public Task<ExecuteResult> ExecuteAsync(ICommandContext context, IEnumerable<object> argList, IEnumerable<object> paramList, IDependencyMap map) | ||||
=> Command.ExecuteAsync(context, argList, paramList, map); | => Command.ExecuteAsync(context, argList, paramList, map); | ||||
@@ -85,12 +85,12 @@ namespace Discord.Commands | |||||
return PreconditionResult.FromSuccess(); | return PreconditionResult.FromSuccess(); | ||||
} | } | ||||
public async Task<ParseResult> ParseAsync(ICommandContext context, int startIndex, SearchResult searchResult, PreconditionResult? preconditionResult = null) | |||||
public async Task<ParseResult> ParseAsync(ICommandContext context, int startIndex, SearchResult searchResult, PreconditionResult preconditionResult = null) | |||||
{ | { | ||||
if (!searchResult.IsSuccess) | if (!searchResult.IsSuccess) | ||||
return ParseResult.FromError(searchResult); | return ParseResult.FromError(searchResult); | ||||
if (preconditionResult != null && !preconditionResult.Value.IsSuccess) | |||||
return ParseResult.FromError(preconditionResult.Value); | |||||
if (preconditionResult != null && !preconditionResult.IsSuccess) | |||||
return ParseResult.FromError(preconditionResult); | |||||
string input = searchResult.Text.Substring(startIndex); | string input = searchResult.Text.Substring(startIndex); | ||||
return await CommandParser.ParseArgs(this, context, input, 0).ConfigureAwait(false); | return await CommandParser.ParseArgs(this, context, input, 0).ConfigureAwait(false); | ||||
@@ -4,7 +4,7 @@ using System.Diagnostics; | |||||
namespace Discord.Commands | namespace Discord.Commands | ||||
{ | { | ||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public struct ExecuteResult : IResult | |||||
public class ExecuteResult : IResult | |||||
{ | { | ||||
public Exception Exception { get; } | public Exception Exception { get; } | ||||
@@ -4,7 +4,7 @@ using System.Diagnostics; | |||||
namespace Discord.Commands | namespace Discord.Commands | ||||
{ | { | ||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public struct ParseResult : IResult | |||||
public class ParseResult : IResult | |||||
{ | { | ||||
public IReadOnlyList<TypeReaderResult> ArgValues { get; } | public IReadOnlyList<TypeReaderResult> ArgValues { get; } | ||||
public IReadOnlyList<TypeReaderResult> ParamValues { get; } | public IReadOnlyList<TypeReaderResult> ParamValues { get; } | ||||
@@ -3,7 +3,7 @@ | |||||
namespace Discord.Commands | namespace Discord.Commands | ||||
{ | { | ||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public struct PreconditionResult : IResult | |||||
public class PreconditionResult : IResult | |||||
{ | { | ||||
public CommandError? Error { get; } | public CommandError? Error { get; } | ||||
public string ErrorReason { get; } | public string ErrorReason { get; } | ||||
@@ -4,7 +4,7 @@ using System.Diagnostics; | |||||
namespace Discord.Commands | namespace Discord.Commands | ||||
{ | { | ||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public struct SearchResult : IResult | |||||
public class SearchResult : IResult | |||||
{ | { | ||||
public string Text { get; } | public string Text { get; } | ||||
public IReadOnlyList<CommandMatch> Commands { get; } | public IReadOnlyList<CommandMatch> Commands { get; } | ||||
@@ -6,7 +6,7 @@ using System.Diagnostics; | |||||
namespace Discord.Commands | namespace Discord.Commands | ||||
{ | { | ||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public struct TypeReaderValue | |||||
public class TypeReaderValue | |||||
{ | { | ||||
public object Value { get; } | public object Value { get; } | ||||
public float Score { get; } | public float Score { get; } | ||||