Class ModuleBuilder
Represents a builder for creating ModuleInfo.
Namespace: Discord.Interactions.Builders
Assembly: Discord.Net.Interactions.dll
Syntax
public class ModuleBuilder : object
Constructors
| Improve this Doc View SourceModuleBuilder(InteractionService, String, ModuleBuilder)
Initializes a new ModuleBuilder.
Declaration
public ModuleBuilder(InteractionService interactionService, string name, ModuleBuilder parent = null)
Parameters
Type | Name | Description |
---|---|---|
InteractionService | interactionService | The underlying Interaction Service. |
String | name | Name of this module. |
ModuleBuilder | parent | Parent module of this sub-module. |
Properties
| Improve this Doc View SourceAttributes
Gets a collection of the attributes of this module.
Declaration
public IReadOnlyList<Attribute> Attributes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<Attribute> |
AutocompleteCommands
Gets a collection of the Autocomplete Commands of this module.
Declaration
public IReadOnlyList<AutocompleteCommandBuilder> AutocompleteCommands { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<AutocompleteCommandBuilder> |
ComponentCommands
Gets a collection of the Component Commands of this module.
Declaration
public IReadOnlyList<ComponentCommandBuilder> ComponentCommands { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<ComponentCommandBuilder> |
ContextCommands
Gets a collection of the Context Commands of this module.
Declaration
public IReadOnlyList<ContextCommandBuilder> ContextCommands { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<ContextCommandBuilder> |
DefaultMemberPermissions
Gets the default permissions needed for executing this command.
Declaration
public GuildPermission? DefaultMemberPermissions { get; set; }
Property Value
Type | Description |
---|---|
Nullable<GuildPermission> |
DefaultPermission
Gets and sets the default permission of this module.
Declaration
public bool DefaultPermission { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Description
Gets and sets the description of this module.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
String |
DontAutoRegister
Gets and sets whether this has a DontAutoRegisterAttribute.
Declaration
public bool DontAutoRegister { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
InteractionService
Gets the underlying Interaction Service.
Declaration
public InteractionService InteractionService { get; }
Property Value
Type | Description |
---|---|
InteractionService |
IsEnabledInDm
Gets whether this command can be used in DMs.
Declaration
public bool IsEnabledInDm { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsNsfw
Gets whether this command is age restricted.
Declaration
public bool IsNsfw { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsSlashGroup
Gets whether this has a GroupAttribute.
Declaration
public bool IsSlashGroup { get; }
Property Value
Type | Description |
---|---|
Boolean |
ModalCommands
Gets a collection of the Modal Commands of this module.
Declaration
public IReadOnlyList<ModalCommandBuilder> ModalCommands { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<ModalCommandBuilder> |
Name
Gets the name of this module.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
String |
Parent
Gets the parent module if this module is a sub-module.
Declaration
public ModuleBuilder Parent { get; }
Property Value
Type | Description |
---|---|
ModuleBuilder |
Preconditions
Gets a collection of the preconditions of this module.
Declaration
public IReadOnlyCollection<PreconditionAttribute> Preconditions { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<PreconditionAttribute> |
SlashCommands
Gets a collection of the Slash Commands of this module.
Declaration
public IReadOnlyList<SlashCommandBuilder> SlashCommands { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<SlashCommandBuilder> |
SlashGroupName
Gets and sets the group name of this module.
Declaration
public string SlashGroupName { get; set; }
Property Value
Type | Description |
---|---|
String |
SubModules
Gets a collection of the sub-modules of this module.
Declaration
public IReadOnlyList<ModuleBuilder> SubModules { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<ModuleBuilder> |
Methods
| Improve this Doc View SourceAddAttributes(Attribute[])
Adds attributes to Attributes.
Declaration
public ModuleBuilder AddAttributes(params Attribute[] attributes)
Parameters
Type | Name | Description |
---|---|---|
Attribute[] | attributes | New attributes to be added to Attributes. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
AddAutocompleteCommand(Action<AutocompleteCommandBuilder>)
Adds autocomplete command builder to AutocompleteCommands.
Declaration
public ModuleBuilder AddAutocompleteCommand(Action<AutocompleteCommandBuilder> configure)
Parameters
Type | Name | Description |
---|---|---|
Action<AutocompleteCommandBuilder> | configure | AutocompleteCommands factory. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
AddComponentCommand(Action<ComponentCommandBuilder>)
Adds component command builder to ComponentCommands.
Declaration
public ModuleBuilder AddComponentCommand(Action<ComponentCommandBuilder> configure)
Parameters
Type | Name | Description |
---|---|---|
Action<ComponentCommandBuilder> | configure | ComponentCommandBuilder factory. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
AddComponentCommand(String, ExecuteCallback, Action<ComponentCommandBuilder>)
Adds component command builder to ComponentCommands.
Declaration
public ModuleBuilder AddComponentCommand(string name, ExecuteCallback callback, Action<ComponentCommandBuilder> configure)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the command. |
ExecuteCallback | callback | Command callback to be executed. |
Action<ComponentCommandBuilder> | configure | ComponentCommandBuilder factory. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
AddContextCommand(Action<ContextCommandBuilder>)
Adds context command builder to ContextCommands.
Declaration
public ModuleBuilder AddContextCommand(Action<ContextCommandBuilder> configure)
Parameters
Type | Name | Description |
---|---|---|
Action<ContextCommandBuilder> | configure | ContextCommandBuilder factory. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
AddContextCommand(String, ExecuteCallback, Action<ContextCommandBuilder>)
Adds context command builder to ContextCommands.
Declaration
public ModuleBuilder AddContextCommand(string name, ExecuteCallback callback, Action<ContextCommandBuilder> configure)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the command. |
ExecuteCallback | callback | Command callback to be executed. |
Action<ContextCommandBuilder> | configure | ContextCommandBuilder factory. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
AddModalCommand(Action<ModalCommandBuilder>)
Adds a modal command builder to ModalCommands.
Declaration
public ModuleBuilder AddModalCommand(Action<ModalCommandBuilder> configure)
Parameters
Type | Name | Description |
---|---|---|
Action<ModalCommandBuilder> | configure | ModalCommands factory. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
AddModalCommand(String, ExecuteCallback, Action<ModalCommandBuilder>)
Adds a modal command builder to ModalCommands.
Declaration
public ModuleBuilder AddModalCommand(string name, ExecuteCallback callback, Action<ModalCommandBuilder> configure)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the command. |
ExecuteCallback | callback | Command callback to be executed. |
Action<ModalCommandBuilder> | configure | ModalCommands factory. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
AddModule(Action<ModuleBuilder>)
Adds sub-module builder to SubModules.
Declaration
public ModuleBuilder AddModule(Action<ModuleBuilder> configure)
Parameters
Type | Name | Description |
---|---|---|
Action<ModuleBuilder> | configure | ModuleBuilder factory. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
AddPreconditions(PreconditionAttribute[])
Adds preconditions to Preconditions.
Declaration
public ModuleBuilder AddPreconditions(params PreconditionAttribute[] preconditions)
Parameters
Type | Name | Description |
---|---|---|
PreconditionAttribute[] | preconditions | New preconditions to be added to Preconditions. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
AddSlashCommand(Action<SlashCommandBuilder>)
Adds slash command builder to SlashCommands.
Declaration
public ModuleBuilder AddSlashCommand(Action<SlashCommandBuilder> configure)
Parameters
Type | Name | Description |
---|---|---|
Action<SlashCommandBuilder> | configure | SlashCommandBuilder factory. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
AddSlashCommand(String, ExecuteCallback, Action<AutocompleteCommandBuilder>)
Adds autocomplete command builder to AutocompleteCommands.
Declaration
public ModuleBuilder AddSlashCommand(string name, ExecuteCallback callback, Action<AutocompleteCommandBuilder> configure)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the command. |
ExecuteCallback | callback | Command callback to be executed. |
Action<AutocompleteCommandBuilder> | configure | AutocompleteCommandBuilder factory. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
AddSlashCommand(String, ExecuteCallback, Action<SlashCommandBuilder>)
Adds slash command builder to SlashCommands.
Declaration
public ModuleBuilder AddSlashCommand(string name, ExecuteCallback callback, Action<SlashCommandBuilder> configure)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the command. |
ExecuteCallback | callback | Command callback to be executed. |
Action<SlashCommandBuilder> | configure | SlashCommandBuilder factory. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
SetEnabledInDm(Boolean)
Sets IsEnabledInDm.
Declaration
public ModuleBuilder SetEnabledInDm(bool isEnabled)
Parameters
Type | Name | Description |
---|---|---|
Boolean | isEnabled | New value of the IsEnabledInDm. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
SetNsfw(Boolean)
Sets IsNsfw.
Declaration
public ModuleBuilder SetNsfw(bool isNsfw)
Parameters
Type | Name | Description |
---|---|---|
Boolean | isNsfw | New value of the IsNsfw. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
WithDefaultMemberPermissions(GuildPermission)
Sets DefaultMemberPermissions.
Declaration
public ModuleBuilder WithDefaultMemberPermissions(GuildPermission permissions)
Parameters
Type | Name | Description |
---|---|---|
GuildPermission | permissions | New value of the DefaultMemberPermissions. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
WithDefaultPermission(Boolean)
Sets DefaultPermission.
Declaration
public ModuleBuilder WithDefaultPermission(bool permission)
Parameters
Type | Name | Description |
---|---|---|
Boolean | permission | New value of the DefaultPermission. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
WithDescription(String)
Sets Description.
Declaration
public ModuleBuilder WithDescription(string description)
Parameters
Type | Name | Description |
---|---|---|
String | description | New value of the Description. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |
WithGroupName(String)
Sets SlashGroupName.
Declaration
public ModuleBuilder WithGroupName(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | New value of the SlashGroupName. |
Returns
Type | Description |
---|---|
ModuleBuilder | The builder instance. |