Struct TypeConverterResult
Represents a result type for ReadAsync(IInteractionContext, IApplicationCommandInteractionDataOption, IServiceProvider).
Implements
Namespace: Discord.Interactions
Assembly: Discord.Net.Interactions.dll
Syntax
public struct TypeConverterResult : IResult
Properties
| Improve this Doc View SourceError
Gets the error type that may have occurred during the operation.
Declaration
public readonly InteractionCommandError? Error { get; }
Property Value
Type | Description |
---|---|
Nullable<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.
Declaration
public readonly string ErrorReason { get; }
Property Value
Type | Description |
---|---|
String | A string containing the error reason. |
IsSuccess
Indicates whether the operation was successful or not.
Declaration
public readonly bool IsSuccess { get; }
Property Value
Type | Description |
---|---|
Boolean | true if the result is positive; otherwise false. |
Value
Gets the result of the conversion if the operation was successful.
Declaration
public readonly object Value { get; }
Property Value
Type | Description |
---|---|
Object |
Methods
| Improve this Doc View SourceFromError(InteractionCommandError, String)
Returns a PreconditionResult with the specified error and the reason.
Declaration
public static TypeConverterResult FromError(InteractionCommandError error, string reason)
Parameters
Type | Name | Description |
---|---|---|
InteractionCommandError | error | The type of error. |
String | reason | The reason of failure. |
Returns
Type | Description |
---|---|
TypeConverterResult |
FromError(IResult)
Returns a PreconditionResult with the specified result
type.
Declaration
public static TypeConverterResult FromError(IResult result)
Parameters
Type | Name | Description |
---|---|---|
IResult | result | The result of failure. |
Returns
Type | Description |
---|---|
TypeConverterResult |
FromError(Exception)
Returns a TypeConverterResult with Exception and the
Declaration
public static TypeConverterResult FromError(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | The exception that caused the type conversion to fail. |
Returns
Type | Description |
---|---|
TypeConverterResult |
FromSuccess(Object)
Returns a TypeConverterResult with no errors.
Declaration
public static TypeConverterResult FromSuccess(object value)
Parameters
Type | Name | Description |
---|---|---|
Object | value |
Returns
Type | Description |
---|---|
TypeConverterResult |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |