Table of Contents

Class SlashCommandInfo

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

表示基于特性的方法信息类,适用于 Slash 类型的命令。

public class SlashCommandInfo : CommandInfo<SlashCommandParameterInfo>, ICommandInfo, IApplicationCommandInfo
Inheritance
SlashCommandInfo
Implements
Inherited Members

Properties

CommandType

获取此命令的类型。

public ApplicationCommandType CommandType { get; }

Property Value

ApplicationCommandType

ContextTypes

获取此命令可执行的上下文类型。

public IReadOnlyCollection<InteractionContextType> ContextTypes { get; }

Property Value

IReadOnlyCollection<InteractionContextType>

Description

获取将在黑盒语音上显示的命令描述。

public string? Description { get; }

Property Value

string

FlattenedParameters

获取命令参数及复杂参数字段的扁平集合。

public IReadOnlyList<SlashCommandParameterInfo> FlattenedParameters { get; }

Property Value

IReadOnlyList<SlashCommandParameterInfo>

Parameters

获取此命令的参数集合。

public override IReadOnlyList<SlashCommandParameterInfo> Parameters { get; }

Property Value

IReadOnlyList<SlashCommandParameterInfo>

Methods

ExecuteAsync(IInteractionContext, IServiceProvider?)

使用提供的上下文执行命令。

public override Task<IResult> ExecuteAsync(IInteractionContext context, IServiceProvider? services)

Parameters

context IInteractionContext

执行上下文。

services IServiceProvider

用于创建模块实例的依赖项。

Returns

Task<IResult>

表示执行过程的任务。任务结果包含执行结果。

GetLogString(IInteractionContext)

获取斜线命令的日志字符串。

protected override string GetLogString(IInteractionContext context)

Parameters

context IInteractionContext

命令上下文。

Returns

string

日志字符串。

InvokeModuleEvent(IInteractionContext, IResult)

调用斜线命令事件。

protected override Task InvokeModuleEvent(IInteractionContext context, IResult result)

Parameters

context IInteractionContext

命令上下文。

result IResult

命令执行结果。

Returns

Task

异步任务。

ParseArgumentsAsync(IInteractionContext, IServiceProvider?)

解析斜线命令参数。

protected override Task<IResult> ParseArgumentsAsync(IInteractionContext context, IServiceProvider? services)

Parameters

context IInteractionContext

命令上下文。

services IServiceProvider

服务集合。

Returns

Task<IResult>

解析结果。