Struct AutocompletionResult
Contains the information of a Autocomplete Interaction result.
Implements
Namespace: Discord.Interactions
Assembly: Discord.Net.Interactions.dll
Syntax
public struct AutocompletionResult : 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. |
Suggestions
Get the collection of Autocomplete suggestions to be displayed to the user.
Declaration
public readonly IReadOnlyCollection<AutocompleteResult> Suggestions { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<AutocompleteResult> |
Methods
| Improve this Doc View SourceFromError(InteractionCommandError, String)
Initializes a new AutocompletionResult with a specified InteractionCommandError and its reason, indicating an unsuccessful execution.
Declaration
public static AutocompletionResult FromError(InteractionCommandError error, string reason)
Parameters
Type | Name | Description |
---|---|---|
InteractionCommandError | error | The type of error. |
String | reason | The reason behind the error. |
Returns
Type | Description |
---|---|
AutocompletionResult | A AutocompletionResult that contains a InteractionCommandError and reason. |
FromError(IResult)
Initializes a new AutocompletionResult with a specified result; this may or may not be an successful execution depending on the Error and ErrorReason specified.
Declaration
public static AutocompletionResult FromError(IResult result)
Parameters
Type | Name | Description |
---|---|---|
IResult | result | The result to inherit from. |
Returns
Type | Description |
---|---|
AutocompletionResult | A AutocompletionResult that inherits the IResult error type and reason. |
FromError(Exception)
Initializes a new AutocompletionResult with a specified exception, indicating an unsuccessful execution.
Declaration
public static AutocompletionResult FromError(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | The exception that caused the autocomplete process to fail. |
Returns
Type | Description |
---|---|
AutocompletionResult | A AutocompletionResult that contains the exception that caused the unsuccessful execution, along
with a InteractionCommandError of type |
FromSuccess()
Initializes a new AutocompletionResult with no error and without any AutocompleteResult indicating the command service shouldn't return any suggestions.
Declaration
public static AutocompletionResult FromSuccess()
Returns
Type | Description |
---|---|
AutocompletionResult | A AutocompletionResult that does not contain any errors. |
FromSuccess(IEnumerable<AutocompleteResult>)
Initializes a new AutocompletionResult with no error.
Declaration
public static AutocompletionResult FromSuccess(IEnumerable<AutocompleteResult> suggestions)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<AutocompleteResult> | suggestions | Autocomplete suggestions to be displayed to the user |
Returns
Type | Description |
---|---|
AutocompletionResult | A AutocompletionResult that does not contain any errors. |
ToString()
Gets a string that indicates the autocompletion result.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
|