Table of Contents

Struct TypeConverterResult

Namespace
Discord.Interactions
Assembly
Discord.Net.Interactions.dll
public struct TypeConverterResult : IResult
Implements
Inherited Members

Properties

Error

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

public readonly InteractionCommandError? Error { get; }

Property Value

InteractionCommandError?

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

ErrorReason

Gets the reason for the error.

public readonly 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.

Value

Gets the result of the conversion if the operation was successful.

public readonly object Value { get; }

Property Value

object

Methods

FromError(IResult)

Returns a PreconditionResult with the specified result type.

public static TypeConverterResult FromError(IResult result)

Parameters

result IResult

The result of failure.

Returns

TypeConverterResult

FromError(InteractionCommandError, string)

Returns a PreconditionResult with the specified error and the reason.

public static TypeConverterResult FromError(InteractionCommandError error, string reason)

Parameters

error InteractionCommandError

The type of error.

reason string

The reason of failure.

Returns

TypeConverterResult

FromError(Exception)

Returns a TypeConverterResult with Exception and the Message.

public static TypeConverterResult FromError(Exception exception)

Parameters

exception Exception

The exception that caused the type conversion to fail.

Returns

TypeConverterResult

FromSuccess(object)

Returns a TypeConverterResult with no errors.

public static TypeConverterResult FromSuccess(object value)

Parameters

value object

Returns

TypeConverterResult

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.