Table of Contents

Class ParameterBuilder<TInfo, TBuilder>

Namespace
Discord.Interactions.Builders
Assembly
Discord.Net.Interactions.dll

Represents the base builder class for creating IParameterInfo.

public abstract class ParameterBuilder<TInfo, TBuilder> : IParameterBuilder where TInfo : class, IParameterInfo where TBuilder : ParameterBuilder<TInfo, TBuilder>

Type Parameters

TInfo

The IParameterInfo this builder yields when built.

TBuilder

Inherited ParameterBuilder<TInfo, TBuilder> type.

Inheritance
ParameterBuilder<TInfo, TBuilder>
Implements
Derived
Inherited Members

Constructors

ParameterBuilder(ICommandBuilder, string, Type)

protected ParameterBuilder(ICommandBuilder command, string name, Type type)

Parameters

command ICommandBuilder
name string
type Type

Properties

Attributes

Gets a collection of the attributes of this command.

public IReadOnlyCollection<Attribute> Attributes { get; }

Property Value

IReadOnlyCollection<Attribute>

Command

Gets the parent command of this parameter.

public ICommandBuilder Command { get; }

Property Value

ICommandBuilder

DefaultValue

Gets the default value of this parameter.

public object DefaultValue { get; set; }

Property Value

object

Instance

protected abstract TBuilder Instance { get; }

Property Value

TBuilder

IsParameterArray

Gets whether this parameter is params.

public bool IsParameterArray { get; set; }

Property Value

bool

IsRequired

Gets whether this parameter is required.

public bool IsRequired { get; set; }

Property Value

bool

Name

Gets the name of this parameter.

public string Name { get; }

Property Value

string

ParameterType

Gets the type of this parameter.

public Type ParameterType { get; }

Property Value

Type

Preconditions

Gets a collection of the preconditions of this command.

public IReadOnlyCollection<ParameterPreconditionAttribute> Preconditions { get; }

Property Value

IReadOnlyCollection<ParameterPreconditionAttribute>

Methods

AddAttributes(params Attribute[])

Adds attributes to Attributes

public virtual TBuilder AddAttributes(params Attribute[] attributes)

Parameters

attributes Attribute[]

New attributes to be added to Attributes.

Returns

TBuilder

The builder instance.

AddPreconditions(params ParameterPreconditionAttribute[])

Adds preconditions to Preconditions

public virtual TBuilder AddPreconditions(params ParameterPreconditionAttribute[] attributes)

Parameters

attributes ParameterPreconditionAttribute[]

New attributes to be added to Preconditions.

Returns

TBuilder

The builder instance.

SetDefaultValue(object)

public virtual TBuilder SetDefaultValue(object defaultValue)

Parameters

defaultValue object

New value of the DefaultValue.

Returns

TBuilder

The builder instance.

SetParameterType(Type)

public virtual TBuilder SetParameterType(Type type)

Parameters

type Type

New value of the ParameterType.

Returns

TBuilder

The builder instance.

SetRequired(bool)

Sets IsRequired.

public virtual TBuilder SetRequired(bool isRequired)

Parameters

isRequired bool

New value of the IsRequired.

Returns

TBuilder

The builder instance.

WithName(string)

Sets Name.

public virtual TBuilder WithName(string name)

Parameters

name string

New value of the Name.

Returns

TBuilder

The builder instance.