Search Results for

    Show / Hide Table of Contents

    Struct AutocompletionResult

    Contains the information of a Autocomplete Interaction result.

    Implements
    IResult
    Namespace: Discord.Interactions
    Assembly: Discord.Net.Interactions.dll
    Syntax
    public struct AutocompletionResult : IResult

    Properties

    | Improve this Doc View Source

    Error

    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.

    | Improve this Doc View Source

    ErrorReason

    Gets the reason for the error.

    Declaration
    public readonly string ErrorReason { get; }
    Property Value
    Type Description
    String

    A string containing the error reason.

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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 Source

    FromError(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.

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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 as well as the exception message as the reason.

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    ToString()

    Gets a string that indicates the autocompletion result.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    Success if IsSuccess is true; otherwise "Error: ErrorReason".

    Implements

    IResult

    Theme

    • Improve this Doc
    • View Source
    In This Article
    Back to top Discord.Net (c) 2015-2022 3.7.2