Class SlashCommandBuilder
Represents a builder for creating SlashCommandInfo.
Inheritance
Implements
Inherited Members
Namespace: Discord.Interactions.Builders
Assembly: Discord.Net.Interactions.dll
Syntax
public sealed class SlashCommandBuilder : CommandBuilder<SlashCommandInfo, SlashCommandBuilder, SlashCommandParameterBuilder>, ICommandBuilder
Constructors
| Improve this Doc View SourceSlashCommandBuilder(ModuleBuilder, String, ExecuteCallback)
Initializes a new SlashCommandBuilder.
Declaration
public SlashCommandBuilder(ModuleBuilder module, string name, ExecuteCallback callback)
Parameters
Type | Name | Description |
---|---|---|
ModuleBuilder | module | Parent module of this command. |
String | name | Name of this command. |
ExecuteCallback | callback | Execution callback of this command. |
Properties
| Improve this Doc View SourceDefaultMemberPermissions
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 command.
Declaration
public bool DefaultPermission { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Description
Gets and sets the description of this command.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
String |
Instance
Declaration
protected override SlashCommandBuilder Instance { get; }
Property Value
Type | Description |
---|---|
SlashCommandBuilder |
Overrides
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 |
Methods
| Improve this Doc View SourceAddParameter(Action<SlashCommandParameterBuilder>)
Adds a command parameter to the parameters collection.
Declaration
public override SlashCommandBuilder AddParameter(Action<SlashCommandParameterBuilder> configure)
Parameters
Type | Name | Description |
---|---|---|
Action<SlashCommandParameterBuilder> | configure | SlashCommandParameterBuilder factory. |
Returns
Type | Description |
---|---|
SlashCommandBuilder | The builder instance. |
Overrides
SetEnabledInDm(Boolean)
Sets IsEnabledInDm.
Declaration
public SlashCommandBuilder SetEnabledInDm(bool isEnabled)
Parameters
Type | Name | Description |
---|---|---|
Boolean | isEnabled | New value of the IsEnabledInDm. |
Returns
Type | Description |
---|---|
SlashCommandBuilder | The builder instance. |
SetNsfw(Boolean)
Sets IsNsfw.
Declaration
public SlashCommandBuilder SetNsfw(bool isNsfw)
Parameters
Type | Name | Description |
---|---|---|
Boolean | isNsfw | New value of the IsNsfw. |
Returns
Type | Description |
---|---|
SlashCommandBuilder | The builder instance. |
WithDefaultMemberPermissions(GuildPermission)
Sets DefaultMemberPermissions.
Declaration
public SlashCommandBuilder WithDefaultMemberPermissions(GuildPermission permissions)
Parameters
Type | Name | Description |
---|---|---|
GuildPermission | permissions | New value of the DefaultMemberPermissions. |
Returns
Type | Description |
---|---|
SlashCommandBuilder | The builder instance. |
WithDefaultPermission(Boolean)
Sets DefaultPermission.
Declaration
public SlashCommandBuilder WithDefaultPermission(bool permission)
Parameters
Type | Name | Description |
---|---|---|
Boolean | permission | New value of the DefaultPermission. |
Returns
Type | Description |
---|---|
SlashCommandBuilder | The builder instance. |
WithDescription(String)
Sets Description.
Declaration
public SlashCommandBuilder WithDescription(string description)
Parameters
Type | Name | Description |
---|---|---|
String | description | New value of the Description. |
Returns
Type | Description |
---|---|
SlashCommandBuilder | The builder instance. |