Table of Contents

Class SlashCommandParameterBuilder

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

Represents a builder for creating SlashCommandParameterInfo.

public sealed class SlashCommandParameterBuilder : ParameterBuilder<SlashCommandParameterInfo, SlashCommandParameterBuilder>, IParameterBuilder
Inheritance
SlashCommandParameterBuilder
Implements
Inherited Members

Constructors

SlashCommandParameterBuilder(ICommandBuilder, string, Type, ComplexParameterInitializer?)

Initializes a new SlashCommandParameterBuilder.

public SlashCommandParameterBuilder(ICommandBuilder command, string name, Type type, ComplexParameterInitializer? complexParameterInitializer = null)

Parameters

command ICommandBuilder

Parent command of this parameter.

name string

Name of this command.

type Type

Type of this parameter.

complexParameterInitializer ComplexParameterInitializer

Initializer delegate for this parameter.

Properties

Autocomplete

Gets or sets whether this parameter should be configured for Autocomplete Interactions.

public bool Autocomplete { get; set; }

Property Value

bool

ChannelTypes

Gets a collection of the channel types of this command.

public IReadOnlyCollection<ChannelType> ChannelTypes { get; }

Property Value

IReadOnlyCollection<ChannelType>

Choices

Gets a collection of the choices of this command.

public IReadOnlyCollection<ParameterChoice> Choices { get; }

Property Value

IReadOnlyCollection<ParameterChoice>

ComplexParameterFields

Gets the constructor parameters of this parameter, if IsComplexParameter is true.

public IReadOnlyCollection<SlashCommandParameterBuilder> ComplexParameterFields { get; }

Property Value

IReadOnlyCollection<SlashCommandParameterBuilder>

ComplexParameterInitializer

Gets the initializer delegate for this parameter, if IsComplexParameter is true.

public ComplexParameterInitializer? ComplexParameterInitializer { get; }

Property Value

ComplexParameterInitializer

Description

Gets or sets the description of this parameter.

public string? Description { get; set; }

Property Value

string

Instance

获取生成器实例。

protected override SlashCommandParameterBuilder Instance { get; }

Property Value

SlashCommandParameterBuilder

IsComplexParameter

Gets whether this type should be treated as a complex parameter.

public bool IsComplexParameter { get; }

Property Value

bool

MaxLength

Gets or sets the maximum length allowed for a string type parameter.

public int? MaxLength { get; set; }

Property Value

int?

MaxValue

Gets or sets the max value of this parameter.

public double? MaxValue { get; set; }

Property Value

double?

MinLength

Gets or sets the minimum length allowed for a string type parameter.

public int? MinLength { get; set; }

Property Value

int?

MinValue

Gets or sets the min value of this parameter.

public double? MinValue { get; set; }

Property Value

double?

TypeConverter

Gets or sets the TypeConverter of this parameter.

public TypeConverter? TypeConverter { get; }

Property Value

TypeConverter

Methods

AddComplexParameterField(Action<SlashCommandParameterBuilder>)

Adds a parameter builders to ComplexParameterFields.

public SlashCommandParameterBuilder AddComplexParameterField(Action<SlashCommandParameterBuilder> configure)

Parameters

configure Action<SlashCommandParameterBuilder>

SlashCommandParameterBuilder factory.

Returns

SlashCommandParameterBuilder

The builder instance.

Exceptions

InvalidOperationException

Thrown if the added field has a ComplexParameterAttribute.

AddComplexParameterFields(params SlashCommandParameterBuilder[])

Adds parameter builders to ComplexParameterFields.

public SlashCommandParameterBuilder AddComplexParameterFields(params SlashCommandParameterBuilder[] fields)

Parameters

fields SlashCommandParameterBuilder[]

New parameter builders to be added to ComplexParameterFields.

Returns

SlashCommandParameterBuilder

The builder instance.

Exceptions

InvalidOperationException

Thrown if the added field has a ComplexParameterAttribute.

SetParameterType(Type)

设置 ParameterType

public override SlashCommandParameterBuilder SetParameterType(Type type)

Parameters

type Type

ParameterType 的新值。

Returns

SlashCommandParameterBuilder

生成器实例。

SetParameterType(Type, IServiceProvider?)

public SlashCommandParameterBuilder SetParameterType(Type type, IServiceProvider? services)

Parameters

type Type

New value of the ParameterType.

services IServiceProvider

Service container to be used to resolve the dependencies of this parameters TypeConverter.

Returns

SlashCommandParameterBuilder

The builder instance.

WithChannelTypes(params ChannelType[])

Adds channel types to ChannelTypes.

public SlashCommandParameterBuilder WithChannelTypes(params ChannelType[] channelTypes)

Parameters

channelTypes ChannelType[]

New channel types to be added to ChannelTypes.

Returns

SlashCommandParameterBuilder

The builder instance.

WithChannelTypes(IEnumerable<ChannelType>)

Adds channel types to ChannelTypes.

public SlashCommandParameterBuilder WithChannelTypes(IEnumerable<ChannelType> channelTypes)

Parameters

channelTypes IEnumerable<ChannelType>

New channel types to be added to ChannelTypes.

Returns

SlashCommandParameterBuilder

The builder instance.

WithChoices(params ParameterChoice[])

Adds parameter choices to Choices.

public SlashCommandParameterBuilder WithChoices(params ParameterChoice[] options)

Parameters

options ParameterChoice[]

New choices to be added to Choices.

Returns

SlashCommandParameterBuilder

The builder instance.

WithDescription(string)

public SlashCommandParameterBuilder WithDescription(string description)

Parameters

description string

New value of the Description.

Returns

SlashCommandParameterBuilder

The builder instance.

WithMaxLength(int)

Sets MaxLength.

public SlashCommandParameterBuilder WithMaxLength(int length)

Parameters

length int

New value of the MaxLength.

Returns

SlashCommandParameterBuilder

The builder instance.

WithMaxValue(double)

Sets MaxValue.

public SlashCommandParameterBuilder WithMaxValue(double value)

Parameters

value double

New value of the MaxValue.

Returns

SlashCommandParameterBuilder

The builder instance.

WithMinLength(int)

Sets MinLength.

public SlashCommandParameterBuilder WithMinLength(int length)

Parameters

length int

New value of the MinLength.

Returns

SlashCommandParameterBuilder

The builder instance.

WithMinValue(double)

Sets MinValue.

public SlashCommandParameterBuilder WithMinValue(double value)

Parameters

value double

New value of the MinValue.

Returns

SlashCommandParameterBuilder

The builder instance.