Table of Contents

Class TypeReader

Namespace
Discord.Interactions
Assembly
Discord.Net.Interactions.dll

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

public abstract class TypeReader
Inheritance
TypeReader
Derived
Inherited Members

Methods

CanConvertTo(Type)

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

public abstract bool CanConvertTo(Type type)

Parameters

type Type

An object type.

Returns

bool

The boolean result.

ReadAsync(IInteractionContext, string, IServiceProvider)

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

public abstract Task<TypeConverterResult> ReadAsync(IInteractionContext context, string option, IServiceProvider services)

Parameters

context IInteractionContext

Command execution context.

option string

Received option payload.

services IServiceProvider

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

Returns

Task<TypeConverterResult>

The result of the read process.

SerializeAsync(object, IServiceProvider)

Will be used to serialize objects into strings.

public virtual Task<string> SerializeAsync(object obj, IServiceProvider services)

Parameters

obj object

Object to be serialized.

services IServiceProvider

Returns

Task<string>

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