Table of Contents

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

name string
Name of the command (1-32 characters). Must be lowercase.
description string
Description of the command (1-100 characters).
handler Delegate
Handler that represents the body of the command.

Properties

Description

Description of the command (1-100 characters).

public string Description { get; }

Property Value

string

Handler

Handler that represents the body of the command.

public Delegate Handler { get; }

Property Value

Delegate

Methods

AddContexts(params IEnumerable<InteractionContextType>)

Interaction context(s) where the command can be used.

public SlashCommandBuilder AddContexts(params IEnumerable<InteractionContextType> contexts)

Parameters

contexts IEnumerable<InteractionContextType>

Returns

SlashCommandBuilder

AddIntegrationTypes(params IEnumerable<ApplicationIntegrationType>)

Installation context(s) where the command is available.

public SlashCommandBuilder AddIntegrationTypes(params IEnumerable<ApplicationIntegrationType> integrationTypes)

Parameters

integrationTypes IEnumerable<ApplicationIntegrationType>

Returns

SlashCommandBuilder

WithContexts(IEnumerable<InteractionContextType>?)

Interaction context(s) where the command can be used.

public SlashCommandBuilder WithContexts(IEnumerable<InteractionContextType>? contexts)

Parameters

contexts IEnumerable<InteractionContextType>

Returns

SlashCommandBuilder

WithDefaultGuildPermissions(Permissions?)

Default required permissions to use the command.

public SlashCommandBuilder WithDefaultGuildPermissions(Permissions? defaultGuildPermissions)

Parameters

defaultGuildPermissions Permissions?

Returns

SlashCommandBuilder

WithIntegrationTypes(IEnumerable<ApplicationIntegrationType>?)

Installation context(s) where the command is available.

public SlashCommandBuilder WithIntegrationTypes(IEnumerable<ApplicationIntegrationType>? integrationTypes)

Parameters

integrationTypes IEnumerable<ApplicationIntegrationType>

Returns

SlashCommandBuilder

WithNsfw(bool)

Indicates whether the command is age-restricted.

public SlashCommandBuilder WithNsfw(bool nsfw = true)

Parameters

nsfw bool

Returns

SlashCommandBuilder

WithRegister(bool)

Whether the application command should be registered by the service.

public SlashCommandBuilder WithRegister(bool register = true)

Parameters

register bool

Returns

SlashCommandBuilder