Struct ExecuteResult
Contains information of the command's overall execution result.
Implements
Namespace: Discord.Interactions
Assembly: Discord.Net.Interactions.dll
Syntax
public struct ExecuteResult : 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. |
Exception
Gets the exception that may have occurred during the command execution.
Declaration
public readonly Exception Exception { get; }
Property Value
Type | Description |
---|---|
Exception |
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. |
Methods
| Improve this Doc View SourceFromError(InteractionCommandError, String)
Initializes a new ExecuteResult with a specified InteractionCommandError and its reason, indicating an unsuccessful execution.
Declaration
public static ExecuteResult FromError(InteractionCommandError commandError, string reason)
Parameters
Type | Name | Description |
---|---|---|
InteractionCommandError | commandError | The type of error. |
String | reason | The reason behind the error. |
Returns
Type | Description |
---|---|
ExecuteResult | A ExecuteResult that contains a InteractionCommandError and reason. |
FromError(IResult)
Initializes a new ExecuteResult with a specified result; this may or may not be an successful execution depending on the Error and ErrorReason specified.
Declaration
public static ExecuteResult FromError(IResult result)
Parameters
Type | Name | Description |
---|---|---|
IResult | result | The result to inherit from. |
Returns
Type | Description |
---|---|
ExecuteResult | A ExecuteResult that inherits the IResult error type and reason. |
FromError(Exception)
Initializes a new ExecuteResult with a specified exception, indicating an unsuccessful execution.
Declaration
public static ExecuteResult FromError(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | The exception that caused the command execution to fail. |
Returns
Type | Description |
---|---|
ExecuteResult | A ExecuteResult that contains the exception that caused the unsuccessful execution, along
with a InteractionCommandError of type |
FromSuccess()
Initializes a new ExecuteResult with no error, indicating a successful execution.
Declaration
public static ExecuteResult FromSuccess()
Returns
Type | Description |
---|---|
ExecuteResult | A ExecuteResult that does not contain any errors. |
ToString()
Gets a string that indicates the execution result.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
|