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

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

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 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!