Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

264
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!