Table of Contents

Class TypeConverter

Namespace
HeyBox.Interactions
Assembly
HeyBox.Net.Interactions.dll

类型转换器基类。InteractionService 使用 TypeConverter 处理斜线命令参数。

public abstract class TypeConverter
Inheritance
TypeConverter
Derived
Inherited Members

Methods

CanConvertTo(Type)

当命令服务遇到未知参数类型时,将用于查找可用的 TypeConverter。

public abstract bool CanConvertTo(Type type)

Parameters

type Type

参数类型。

Returns

bool

是否可以转换。

GetHeyBoxType()

获取应用命令选项类型。

public abstract SlashCommandOptionType GetHeyBoxType()

Returns

SlashCommandOptionType

选项类型。

ReadAsync(IInteractionContext, ISlashCommandInteractionDataOption, IServiceProvider?)

在执行方法体前读取传入的参数。

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

Parameters

context IInteractionContext

命令执行上下文。

option ISlashCommandInteractionDataOption

接收到的选项参数。

services IServiceProvider

用于初始化命令模块的服务提供器。

Returns

Task<TypeConverterResult>

读取过程的结果。

Write(SlashCommandOptionProperties, IParameterInfo)

在命令注册到 HeyBox 前,用于操作输出的命令选项。

public virtual void Write(SlashCommandOptionProperties properties, IParameterInfo parameter)

Parameters

properties SlashCommandOptionProperties
parameter IParameterInfo