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

235
Visualizações
Discordbot with Javascript not reacting

im currently learning to code discordbots with node.js. For some reason the bot goes online but dont react to the commands ive coded. To test reasons ive even took the solution from a tutorial but still the same problem. Does anybody know a solution?

const client = new Discord.Client();
const prefix = '-';
client.once('ready', () => {
    console.log('BOT ist online');
});

client.on('Message', (message) => {
    if(!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if(command === 'ping'){
        message.channel.send('pong!');}
    else if(command == 'youtube'){
        message.channel.send('TEST');}
    });
client.login('Here goes the token');
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

This is a small fix so I would just comment if I could but I’m not able to yet.

Where you’re doing:

client.on('Message', …)

It should be a lowercase "m" on message like this:

client.on('message', msg => {
  if (msg.content === 'ping') {
     msg.reply('Pong!');
  }
});
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