Class PreconditionResult
Represents a result type for command preconditions.
Assembly: Discord.Net.Commands.dll​
View Source​
public class PreconditionResult : IResult
Properties​
Error​
Describes the error type that may have occurred during the operation.
View Source​
public CommandError? Error { get; }
ErrorReason​
Describes the reason for the error.
View Source​
public string ErrorReason { get; }
IsSuccess​
Indicates whether the operation was successful or not.
View Source​
public bool IsSuccess { get; }
Methods​
FromSuccess()​
Returns a Discord.Commands.PreconditionResult with no errors.
View Source​
public static PreconditionResult FromSuccess()
Returns​
Discord.Commands.PreconditionResult
FromError(String)​
Returns a Discord.Commands.PreconditionResult with Discord.Commands.CommandError.UnmetPrecondition and the specified reason.
View Source​
public static PreconditionResult FromError(string reason)
Returns​
Discord.Commands.PreconditionResult
Parameters​
Type | Name | Description |
---|---|---|
System.String | reason | The reason of failure. |
FromError(Exception)​
View Source​
public static PreconditionResult FromError(Exception ex)
Returns​
Discord.Commands.PreconditionResult
Parameters​
Type | Name |
---|---|
System.Exception | ex |
FromError(IResult)​
Returns a Discord.Commands.PreconditionResult with the specified <code data-dev-comment-type="paramref" class="paramref">result</code> type.
View Source​
public static PreconditionResult FromError(IResult result)
Returns​
Discord.Commands.PreconditionResult
Parameters​
Type | Name | Description |
---|---|---|
Discord.Commands.IResult | result | The result of failure. |
ToString()​
Returns a string indicating whether the Discord.Commands.PreconditionResult is successful.
View Source​
public override string ToString()
Returns​
System.String