Table of Contents

Class PreconditionResult

Namespace
Discord.Commands
Assembly
Discord.Net.Commands.dll

Represents a result type for command preconditions.

public class PreconditionResult : IResult
Inheritance
PreconditionResult
Implements
Derived
Inherited Members

Constructors

PreconditionResult(CommandError?, string)

Initializes a new PreconditionResult class with the command error type and reason.

protected PreconditionResult(CommandError? error, string errorReason)

Parameters

error CommandError?

The type of failure.

errorReason string

The reason of failure.

Properties

Error

Describes the error type that may have occurred during the operation.

public CommandError? Error { get; }

Property Value

CommandError?

A CommandError indicating the type of error that may have occurred during the operation; null if the operation was successful.

ErrorReason

Describes the reason for the error.

public string ErrorReason { get; }

Property Value

string

A string containing the error reason.

IsSuccess

Indicates whether the operation was successful or not.

public bool IsSuccess { get; }

Property Value

bool

true if the result is positive; otherwise false.

Methods

FromError(IResult)

Returns a PreconditionResult with the specified result type.

public static PreconditionResult FromError(IResult result)

Parameters

result IResult

The result of failure.

Returns

PreconditionResult

FromError(Exception)

public static PreconditionResult FromError(Exception ex)

Parameters

ex Exception

Returns

PreconditionResult

FromError(string)

Returns a PreconditionResult with UnmetPrecondition and the specified reason.

public static PreconditionResult FromError(string reason)

Parameters

reason string

The reason of failure.

Returns

PreconditionResult

FromSuccess()

Returns a PreconditionResult with no errors.

public static PreconditionResult FromSuccess()

Returns

PreconditionResult

ToString()

Returns a string indicating whether the PreconditionResult is successful.

public override string ToString()

Returns

string