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
ContextTypes
获取此命令可执行的上下文类型。
public IReadOnlyCollection<InteractionContextType> ContextTypes { get; }
Property Value
Description
获取将在黑盒语音上显示的命令描述。
public string? Description { get; }
Property Value
FlattenedParameters
获取命令参数及复杂参数字段的扁平集合。
public IReadOnlyList<SlashCommandParameterInfo> FlattenedParameters { get; }
Property Value
Parameters
获取此命令的参数集合。
public override IReadOnlyList<SlashCommandParameterInfo> Parameters { get; }
Property Value
Methods
ExecuteAsync(IInteractionContext, IServiceProvider?)
使用提供的上下文执行命令。
public override Task<IResult> ExecuteAsync(IInteractionContext context, IServiceProvider? services)
Parameters
context
IInteractionContext执行上下文。
services
IServiceProvider用于创建模块实例的依赖项。
Returns
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服务集合。