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
TypeAn 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
IInteractionContextCommand execution context.
option
stringReceived option payload.
services
IServiceProviderService 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
objectObject to be serialized.
services
IServiceProvider