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

528
Views
ReferenceError: el mensaje no está definido. Error del robot de discordia

Recibo este error cuando intento ejecutar mi código ReferenceError: el mensaje no está definido

 at Client.<anonymous> (C:\Users\Diego M\Desktop\DiscordBot\index.js:14:1) at Client.emit (node:events:390:28) at MessageCreateAction.handle (C:\Users\Diego M\Desktop\DiscordBot\node_modules\discord.js\src\client\actions\MessageCreate.js:33:18) at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Diego M\Desktop\DiscordBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) at WebSocketManager.handlePacket (C:\Users\Diego M\Desktop\DiscordBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:350:31) at WebSocketShard.onPacket (C:\Users\Diego M\Desktop\DiscordBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:443:22) at WebSocketShard.onMessage (C:\Users\Diego M\Desktop\DiscordBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:300:10) at WebSocket.onMessage (C:\Users\Diego M\Desktop\DiscordBot\node_modules\ws\lib\event-target.js:199:18) at WebSocket.emit (node:events:390:28) at Receiver.receiverOnMessage (C:\Users\Diego M\Desktop\DiscordBot\node_modules\ws\lib\websocket.js:1022:20)
 const { Client, Intents } = require('discord.js'); const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); const prefix = '!'; client.on("ready", () => { console.log("Im Ready!"); }); client.on('message', messageCreate => { if (!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.lenght).split(/ +/); const command = args.shift().toLowerCase(); if (command === 'ping') { message.channel.send('pong'); } }); client.login("Token");
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Está recibiendo el error porque no está proporcionando el evento y el parámetro adecuados para la función. 'messageCreate' es un evento que se emite cada vez que se crea un mensaje seguido de un parámetro. Echa un vistazo aquí

El código debería verse así:

 const { Client, Intents } = require('discord.js'); const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES], }); const prefix = '!'; client.on('ready', () => { console.log('Im Ready!'); }); client.on('messageCreate', (message) => { if (!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.lenght).split(/ +/); const command = args.shift().toLowerCase(); if (command === 'ping') { message.channel.send('pong'); } }); client.login('Token');
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!