Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

269
Visualizações
How to create a slash command with spacing in the name?

I've seen some bots that have space in the name of their slash commands, ex: /admin ban

afk on command along with afk off command

But when I try to implement it, I get an error saying that the name of the slash command does not match a validation regex.

My code:

guild.commands.create({
    name: 'foo bar',
    description: 'random description here'
});

Error:

DiscordAPIError: Invalid Form Body
name: String value did not match validation regex.
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

These are called subcommands. They are a good way to sort commands. For example, instead of using setsomething and deletesomething commands, you could use something delete and something set.

You can do this with the options property, and setting the type to SUB_COMMAND

guild.commands.create({
  name: "foo",
  description: "random description here",
  options: [
    {
      type: "SUB_COMMAND",
      name: "bar",
      description: "some description"
    }
  ]
})

You can get this in the interactionCreate event through .getSubcommand()

const subcommand = interaction.options.getSubcommand() // "bar"
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda