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

127
Visualizações
Discord strip_after_prefix is not working

I would like a code where the user can put !play TicTacToe, and the bot will start tictactoe. Currently my bot does not respond, and I see it is due to it having a space after play, and the capitalization in TicTacToe. What am I doing wrong? (p.s. It also says strip_after_prefix:True, ^

ReferenceError: True is not defined

#an example of one of my commands that needs strip_after_prefix
module.exports = {
    name: 'clear',
    description: "Clears x amount of messages",
    strip_after_prefix=True,
    async execute(message, args){
       if(!args[0]) return message.reply('please enter the amount of messages you want to clear');
       if(isNaN(args[0])) return message.reply('please enter a real number')

       if(args[0] > 100) return message.reply('the max amount your can clear is 20')
       if(args[0] < 1) return message.reply('the minimum deletion number is 1')

       await message.channel.messages.fetch({limit: args[0]}).then(messages =>{
            message.channel.bulkDelete(messages);
       });
    }
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Hello fellow wanderers of the world! I have figured out the answer to my own question, and I learned that strip_after_prefix was REMOVED!

Instead if you are trying to do !play tictactoe player1 player2 (for example) you can use the command as a list:

const args = message.content.slice(prefix.length).trim().split(/ +/g); #args is the variable I use
let command = args.toString().toLowerCase().replace(/,/g, ' '); #this makes it so !play TiCtAcToe and normal !play ticatactoe both work

This list should be like [tictactoe, player1, player2] Next to access this list do args[(number)] and use that for functions.

(also I would extremely appreciate it if someone would edit this because I suck at English. Have a wonderful day.)

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