Search Results for

    Show / Hide Table of Contents

    Class TypeReader

    Base class for creating TypeConverters. InteractionService uses TypeConverters to interface with Slash Command parameters.

    Inheritance
    Object
    TypeReader
    TypeReader<T>
    Namespace: Discord.Interactions
    Assembly: Discord.Net.Interactions.dll
    Syntax
    public abstract class TypeReader : object, ITypeConverter<string>

    Methods

    | Improve this Doc View Source

    CanConvertTo(Type)

    Will be used to search for alternative TypeReaders whenever the Command Service encounters an unknown parameter type.

    Declaration
    public abstract bool CanConvertTo(Type type)
    Parameters
    Type Name Description
    Type type

    An object type.

    Returns
    Type Description
    Boolean

    The boolean result.

    | Improve this Doc View Source

    ReadAsync(IInteractionContext, String, IServiceProvider)

    Will be used to read the incoming payload before executing the method body.

    Declaration
    public abstract Task<TypeConverterResult> ReadAsync(IInteractionContext context, string option, IServiceProvider services)
    Parameters
    Type Name Description
    IInteractionContext context

    Command execution context.

    String option

    Received option payload.

    IServiceProvider services

    Service provider that will be used to initialize the command module.

    Returns
    Type Description
    Task<TypeConverterResult>

    The result of the read process.

    | Improve this Doc View Source

    SerializeAsync(Object, IServiceProvider)

    Will be used to serialize objects into strings.

    Declaration
    public virtual Task<string> SerializeAsync(object obj, IServiceProvider services)
    Parameters
    Type Name Description
    Object obj

    Object to be serialized.

    IServiceProvider services
    Returns
    Type Description
    Task<String>

    A task representing the conversion process. The result of the task contains the conversion result.

    Theme

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