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

258
Visualizações
Discord bot not responding/reacting to anything (JS)

So I am new to the world of discord bots and wanted to try myself on this new challenge. I got the foundation running after watching a few tutorials and reading a few posts but now my problem is that the bot doesn't react to anything after starting up...

const Discord = require('discord.js');
const { token } = require('./config.json');

const intents = new Discord.Intents('GUILDS', 'GUILDS_MESSAGES');
const client = new Discord.Client({ intents });

const prefix = '-';

const fs = require('fs');

client.commands = new Discord.Collection();

const commandFiles = fs
  .readdirSync('./commands/')
  .filter((file) => file.endsWith('.js'));
for (const file of commandFiles) {
  const command = require(`./commands/${file}`);

  client.commands.set(command.name, command);
}

client.once('ready', () => {
  console.log('Ready!');
});

client.on('message', (message) => {
  console.log('made it!');
  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') {
    client.commands.get('ping').execute(message, args);
  }
});

client.login(token);

All it does is displaying: 'Ready!' in the console. After that, it doesn't react to anything anymore. Not on discord and not in the console.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It might be because you set up Intents the wrong way.

Try and replace:

const Discord = require('discord.js');

const intents = new Discord.Intents('GUILDS', 'GUILDS_MESSAGES');
const client = new Discord.Client({ intents });

with:

const { Client, Intents } = require('discord.js');
const client = new Client({
    intents: [
       Intents.FLAGS.GUILDS,
       Intents.FLAGS.GUILD_MESSAGES,
    ]
});

You can also use an intents calculator

Also, use messageCreate instead of message

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