Struct ExecuteResult
Contains information of the command's overall execution result.
Assembly: Discord.Net.Commands.dll​
View Source​
public struct ExecuteResult : IResult
Properties​
Exception​
Gets the exception that may have occurred during the command execution.
View Source​
public readonly Exception Exception { get; }
Error​
Describes the error type that may have occurred during the operation.
View Source​
public readonly CommandError? Error { get; }
ErrorReason​
Describes the reason for the error.
View Source​
public readonly string ErrorReason { get; }
IsSuccess​
Indicates whether the operation was successful or not.
View Source​
public readonly bool IsSuccess { get; }
Methods​
FromSuccess()​
Initializes a new Discord.Commands.ExecuteResult with no error, indicating a successful execution.
View Source​
public static ExecuteResult FromSuccess()
Returns​
Discord.Commands.ExecuteResult: A Discord.Commands.ExecuteResult that does not contain any errors.
FromError(CommandError, String)​
Initializes a new Discord.Commands.ExecuteResult with a specified Discord.Commands.CommandError and its reason, indicating an unsuccessful execution.
View Source​
public static ExecuteResult FromError(CommandError error, string reason)
Returns​
Discord.Commands.ExecuteResult: A Discord.Commands.ExecuteResult that contains a Discord.Commands.CommandError and reason.
Parameters​
Type | Name | Description |
---|---|---|
Discord.Commands.CommandError | error | The type of error. |
System.String | reason | The reason behind the error. |
FromError(Exception)​
Initializes a new Discord.Commands.ExecuteResult with a specified exception, indicating an unsuccessful execution.
View Source​
public static ExecuteResult FromError(Exception ex)
Returns​
Discord.Commands.ExecuteResult:
A Discord.Commands.ExecuteResult that contains the exception that caused the unsuccessful execution, along
with a Discord.Commands.CommandError of type Exception
as well as the exception message as the
reason.
Parameters​
Type | Name | Description |
---|---|---|
System.Exception | ex | The exception that caused the command execution to fail. |
FromError(IResult)​
Initializes a new Discord.Commands.ExecuteResult with a specified result; this may or may not be an successful execution depending on the Discord.Commands.IResult.Error and Discord.Commands.IResult.ErrorReason specified.
View Source​
public static ExecuteResult FromError(IResult result)
Returns​
Discord.Commands.ExecuteResult: A Discord.Commands.ExecuteResult that inherits the Discord.Commands.IResult error type and reason.
Parameters​
Type | Name | Description |
---|---|---|
Discord.Commands.IResult | result | The result to inherit from. |
ToString()​
Gets a string that indicates the execution result.
View Source​
public override string ToString()
Returns​
System.String
:
Success
if Discord.Commands.ExecuteResult.IsSuccess is true
; otherwise "Discord.Commands.ExecuteResult.Error:
Discord.Commands.ExecuteResult.ErrorReason".