Skip to main content

Struct ExecuteResult

Contains information of the command's overall execution result.

Assembly: Discord.Net.Commands.dll​
View Source​
Declaration
public struct ExecuteResult : IResult

Properties​

Exception​

Gets the exception that may have occurred during the command execution.

View Source​
Declaration
public readonly Exception Exception { get; }

Error​

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

View Source​
Declaration
public readonly CommandError? Error { get; }

ErrorReason​

Describes the reason for the error.

View Source​
Declaration
public readonly string ErrorReason { get; }

IsSuccess​

Indicates whether the operation was successful or not.

View Source​
Declaration
public readonly bool IsSuccess { get; }

Methods​

FromSuccess()​

Initializes a new Discord.Commands.ExecuteResult with no error, indicating a successful execution.

View Source​
Declaration
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​
Declaration
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​
TypeNameDescription
Discord.Commands.CommandErrorerrorThe type of error.
System.StringreasonThe reason behind the error.

FromError(Exception)​

Initializes a new Discord.Commands.ExecuteResult with a specified exception, indicating an unsuccessful execution.

View Source​
Declaration
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​
TypeNameDescription
System.ExceptionexThe 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​
Declaration
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​
TypeNameDescription
Discord.Commands.IResultresultThe result to inherit from.

ToString()​

Gets a string that indicates the execution result.

View Source​
Declaration
public override string ToString()
Returns​

System.String: Success if Discord.Commands.ExecuteResult.IsSuccess is true; otherwise "Discord.Commands.ExecuteResult.Error: Discord.Commands.ExecuteResult.ErrorReason".

Implements​