Table of Contents

Class SlashCommandBuilder

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

表示用于创建 SlashCommandInfo 的生成器。

public sealed class SlashCommandBuilder : CommandBuilder<SlashCommandInfo, SlashCommandBuilder, SlashCommandParameterBuilder>, ICommandBuilder
Inheritance
SlashCommandBuilder
Implements
Inherited Members

Constructors

SlashCommandBuilder(ModuleBuilder, string, ExecuteCallback)

初始化一个新的 SlashCommandBuilder

public SlashCommandBuilder(ModuleBuilder module, string name, ExecuteCallback callback)

Parameters

module ModuleBuilder

此命令的父模块。

name string

此命令的名称。

callback ExecuteCallback

此命令的执行回调。

Properties

ContextTypes

获取或设置此命令可在哪些上下文类型中执行。

public HashSet<InteractionContextType>? ContextTypes { get; set; }

Property Value

HashSet<InteractionContextType>

Description

获取或设置此命令的描述。

public string? Description { get; set; }

Property Value

string

Instance

获取生成器实例。

protected override SlashCommandBuilder Instance { get; }

Property Value

SlashCommandBuilder

Methods

AddParameter(Action<SlashCommandParameterBuilder>)

向参数集合添加命令参数。

public override SlashCommandBuilder AddParameter(Action<SlashCommandParameterBuilder> configure)

Parameters

configure Action<SlashCommandParameterBuilder>

SlashCommandParameterBuilder 工厂方法。

Returns

SlashCommandBuilder

生成器实例。

WithContextTypes(params InteractionContextType[])

public SlashCommandBuilder WithContextTypes(params InteractionContextType[] contextTypes)

Parameters

contextTypes InteractionContextType[]

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

Returns

SlashCommandBuilder

生成器实例。

WithDescription(string)

设置 Description

public SlashCommandBuilder WithDescription(string description)

Parameters

description string

Description 的新值。

Returns

SlashCommandBuilder

生成器实例。