Table of Contents

Class CommandBuilder<TInfo, TBuilder, TParamBuilder>

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

Represents the base builder class for creating CommandInfo<TParameter>.

public abstract class CommandBuilder<TInfo, TBuilder, TParamBuilder> : ICommandBuilder where TInfo : class, ICommandInfo where TBuilder : CommandBuilder<TInfo, TBuilder, TParamBuilder> where TParamBuilder : class, IParameterBuilder

Type Parameters

TInfo

The CommandInfo<TParameter> this builder yields when built.

TBuilder

Inherited CommandBuilder<TInfo, TBuilder, TParamBuilder> type.

TParamBuilder

Builder type for this commands parameters.

Inheritance
CommandBuilder<TInfo, TBuilder, TParamBuilder>
Implements
Derived
Inherited Members

Constructors

CommandBuilder(ModuleBuilder, string, ExecuteCallback)

protected CommandBuilder(ModuleBuilder module, string name, ExecuteCallback callback)

Parameters

module ModuleBuilder
name string
callback ExecuteCallback

Properties

Attributes

Gets a collection of the attributes of this command.

public IReadOnlyList<Attribute> Attributes { get; }

Property Value

IReadOnlyList<Attribute>

Callback

Gets the execution delegate of this command.

public ExecuteCallback Callback { get; }

Property Value

ExecuteCallback

IgnoreGroupNames

Gets or sets true if this command will be registered and executed as a standalone command, unaffected by the GroupAttributes of of the commands parents.

public bool IgnoreGroupNames { get; set; }

Property Value

bool

Instance

protected abstract TBuilder Instance { get; }

Property Value

TBuilder

MethodName

Gets or sets the method name of this command.

public string MethodName { get; set; }

Property Value

string

Module

Gets the parent module of this command.

public ModuleBuilder Module { get; }

Property Value

ModuleBuilder

Name

Gets the name of this command.

public string Name { get; }

Property Value

string

Parameters

public IReadOnlyList<TParamBuilder> Parameters { get; }

Property Value

IReadOnlyList<TParamBuilder>

Preconditions

Gets a collection of the preconditions of this command.

public IReadOnlyList<PreconditionAttribute> Preconditions { get; }

Property Value

IReadOnlyList<PreconditionAttribute>

RunMode

Gets or sets the run mode this command gets executed with.

public RunMode RunMode { get; set; }

Property Value

RunMode

TreatNameAsRegex

Gets or sets whether the Name should be directly used as a Regex pattern.

public bool TreatNameAsRegex { get; set; }

Property Value

bool

Methods

AddParameter(Action<TParamBuilder>)

public abstract TBuilder AddParameter(Action<TParamBuilder> configure)

Parameters

configure Action<TParamBuilder>

Returns

TBuilder

AddParameters(params TParamBuilder[])

Adds parameter builders to Parameters.

public TBuilder AddParameters(params TParamBuilder[] parameters)

Parameters

parameters TParamBuilder[]

New parameter builders to be added to Parameters.

Returns

TBuilder

The builder instance.

SetRunMode(RunMode)

Sets RunMode.

public TBuilder SetRunMode(RunMode runMode)

Parameters

runMode RunMode

New value of the RunMode.

Returns

TBuilder

The builder instance.

WithAttributes(params Attribute[])

Adds attributes to Attributes.

public TBuilder WithAttributes(params Attribute[] attributes)

Parameters

attributes Attribute[]

New attributes to be added to Attributes.

Returns

TBuilder

The builder instance.

WithMethodName(string)

Sets MethodName.

public TBuilder WithMethodName(string name)

Parameters

name string

New value of the MethodName.

Returns

TBuilder

The builder instance.

WithName(string)

Sets Name.

public TBuilder WithName(string name)

Parameters

name string

New value of the Name.

Returns

TBuilder

The builder instance.

WithNameAsRegex(bool)

public TBuilder WithNameAsRegex(bool value)

Parameters

value bool

New value of the TreatNameAsRegex.

Returns

TBuilder

The builder instance.

WithPreconditions(params PreconditionAttribute[])

Adds preconditions to Preconditions.

public TBuilder WithPreconditions(params PreconditionAttribute[] preconditions)

Parameters

preconditions PreconditionAttribute[]

New preconditions to be added to Preconditions.

Returns

TBuilder

The builder instance.