Class ModalComponentTypeConverter
- Namespace
- Discord.Interactions
- Assembly
- Discord.Net.Interactions.dll
Base class for creating ModalComponentTypeConverters. InteractionService uses ModalComponentTypeConverters to interface with Modal component parameters.
public abstract class ModalComponentTypeConverter
- Inheritance
-
ModalComponentTypeConverter
- Derived
- Inherited Members
Methods
CanConvertTo(Type)
Will be used to search for alternative ModalComponentTypeConverters whenever the Interaction Service encounters an unknown parameter type.
public abstract bool CanConvertTo(Type type)
Parameters
typeTypeType of the modal property.
Returns
- bool
Whether this converter can be used to handle the given type.
ReadAsync(IInteractionContext, IComponentInteractionData, IServiceProvider)
Will be used to read the incoming payload before building the modal instance.
public abstract Task<TypeConverterResult> ReadAsync(IInteractionContext context, IComponentInteractionData option, IServiceProvider services)
Parameters
contextIInteractionContextCommand execution context.
optionIComponentInteractionDataReceived option payload.
servicesIServiceProviderService provider that will be used to initialize the command module.
Returns
- Task<TypeConverterResult>
The result of the read process.
TryGetModalInteractionData(IInteractionContext, out IModalInteractionData)
Tries to get the IModalInteractionData from the provided IInteractionContext.
protected bool TryGetModalInteractionData(IInteractionContext context, out IModalInteractionData modalData)
Parameters
contextIInteractionContextContext containing the IModalInteractionData.
modalDataIModalInteractionDataIModalInteractionData found in the context if successful, null otherwise.
Returns
WriteAsync<TBuilder>(TBuilder, IDiscordInteraction, InputComponentInfo, object)
Will be used to manipulate the outgoing modal component, before the modal gets sent to Discord.
public virtual Task WriteAsync<TBuilder>(TBuilder builder, IDiscordInteraction interaction, InputComponentInfo component, object value) where TBuilder : class, IInteractableComponentBuilder
Parameters
builderTBuilderinteractionIDiscordInteractioncomponentInputComponentInfovalueobject
Returns
Type Parameters
TBuilder