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
ModuleBuildername
stringcallback
ExecuteCallback
Properties
Attributes
Gets a collection of the attributes of this command.
public IReadOnlyList<Attribute> Attributes { get; }
Property Value
Callback
Gets the execution delegate of this command.
public ExecuteCallback Callback { get; }
Property Value
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
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
Module
Gets the parent module of this command.
public ModuleBuilder Module { get; }
Property Value
Name
Gets the name of this command.
public string Name { get; }
Property Value
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
RunMode
Gets or sets the run mode this command gets executed with.
public RunMode RunMode { get; set; }
Property Value
TreatNameAsRegex
Gets or sets whether the Name should be directly used as a Regex pattern.
public bool TreatNameAsRegex { get; set; }
Property Value
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
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
stringNew value of the MethodName.
Returns
- TBuilder
The builder instance.
WithName(string)
Sets Name.
public TBuilder WithName(string name)
Parameters
Returns
- TBuilder
The builder instance.
WithNameAsRegex(bool)
Sets TreatNameAsRegex.
public TBuilder WithNameAsRegex(bool value)
Parameters
value
boolNew 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.