Class SlashCommandBuilder
- Namespace
- NetCord.Services.ApplicationCommands
- Assembly
- NetCord.Services.dll
Slash commands are application commands that are invoked by typing a slash (/) in the chat input box. They allow users to interact with your application.
public class SlashCommandBuilder : ApplicationCommandBuilder
- Inheritance
-
SlashCommandBuilder
- Inherited Members
Constructors
SlashCommandBuilder(string, string, Delegate)
Slash commands are application commands that are invoked by typing a slash (/) in the chat input box. They allow users to interact with your application.
public SlashCommandBuilder(string name, string description, Delegate handler)
Parameters
namestringName of the command (1-32 characters). Must be lowercase.descriptionstringDescription of the command (1-100 characters). handlerDelegateHandler that represents the body of the command.
Properties
Description
Description of the command (1-100 characters).
public string Description { get; }
Property Value
Handler
Handler that represents the body of the command.
public Delegate Handler { get; }
Property Value
Methods
AddContexts(params IEnumerable<InteractionContextType>)
Interaction context(s) where the command can be used.
public SlashCommandBuilder AddContexts(params IEnumerable<InteractionContextType> contexts)
Parameters
contextsIEnumerable<InteractionContextType>
Returns
AddIntegrationTypes(params IEnumerable<ApplicationIntegrationType>)
Installation context(s) where the command is available.
public SlashCommandBuilder AddIntegrationTypes(params IEnumerable<ApplicationIntegrationType> integrationTypes)
Parameters
integrationTypesIEnumerable<ApplicationIntegrationType>
Returns
WithContexts(IEnumerable<InteractionContextType>?)
Interaction context(s) where the command can be used.
public SlashCommandBuilder WithContexts(IEnumerable<InteractionContextType>? contexts)
Parameters
contextsIEnumerable<InteractionContextType>
Returns
WithDefaultGuildPermissions(Permissions?)
Default required permissions to use the command.
public SlashCommandBuilder WithDefaultGuildPermissions(Permissions? defaultGuildPermissions)
Parameters
defaultGuildPermissionsPermissions?
Returns
WithIntegrationTypes(IEnumerable<ApplicationIntegrationType>?)
Installation context(s) where the command is available.
public SlashCommandBuilder WithIntegrationTypes(IEnumerable<ApplicationIntegrationType>? integrationTypes)
Parameters
integrationTypesIEnumerable<ApplicationIntegrationType>
Returns
WithNsfw(bool)
Indicates whether the command is age-restricted.
public SlashCommandBuilder WithNsfw(bool nsfw = true)
Parameters
nsfwbool
Returns
WithRegister(bool)
Whether the application command should be registered by the service.
public SlashCommandBuilder WithRegister(bool register = true)
Parameters
registerbool