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
ICommandBuildername
stringtype
Type
Properties
Attributes
Gets a collection of the attributes of this command.
public IReadOnlyCollection<Attribute> Attributes { get; }
Property Value
Command
Gets the parent command of this parameter.
public ICommandBuilder Command { get; }
Property Value
DefaultValue
Gets the default value of this parameter.
public object DefaultValue { get; set; }
Property Value
Instance
protected abstract TBuilder Instance { get; }
Property Value
- TBuilder
IsParameterArray
Gets whether this parameter is params.
public bool IsParameterArray { get; set; }
Property Value
IsRequired
Gets whether this parameter is required.
public bool IsRequired { get; set; }
Property Value
Name
Gets the name of this parameter.
public string Name { get; }
Property Value
ParameterType
Gets the type of this parameter.
public Type ParameterType { get; }
Property Value
Preconditions
Gets a collection of the preconditions of this command.
public IReadOnlyCollection<ParameterPreconditionAttribute> Preconditions { get; }
Property Value
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)
Sets DefaultValue.
public virtual TBuilder SetDefaultValue(object defaultValue)
Parameters
defaultValue
objectNew value of the DefaultValue.
Returns
- TBuilder
The builder instance.
SetParameterType(Type)
Sets ParameterType.
public virtual TBuilder SetParameterType(Type type)
Parameters
type
TypeNew value of the ParameterType.
Returns
- TBuilder
The builder instance.
SetRequired(bool)
Sets IsRequired.
public virtual TBuilder SetRequired(bool isRequired)
Parameters
isRequired
boolNew value of the IsRequired.
Returns
- TBuilder
The builder instance.
WithName(string)
Sets Name.
public virtual TBuilder WithName(string name)
Parameters
Returns
- TBuilder
The builder instance.