“Cómo leer si una persona ha enviado un mensaje a Discord.js” Código de respuesta

Cómo verificar si un usuario envió un mensaje en Discord JS

if(message.author.id === client.user.id) return;
Naughty Nightingale

Cómo leer si una persona ha enviado un mensaje a Discord.js

client.on('message', message => {
  // this function can check whether the content of the message you pass is the same as this message
  let filter = msg => {
    return msg.content.toLowerCase() == message.content.toLowerCase() && // check if the content is the same (sort of)
           msg.author == message.author; // check if the author is the same
  }

  message.channel.awaitMessages(filter, {
    maxMatches: 1, // you only need that to happen once
    time: 5 * 1000 // time is in milliseconds
  }).then(collected => {
    // this function will be called when a message matches you filter
  }).catch(console.error);
});
Crossed Face

Respuestas similares a “Cómo leer si una persona ha enviado un mensaje a Discord.js”

Preguntas similares a “Cómo leer si una persona ha enviado un mensaje a Discord.js”

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código