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

249
Visualizações
Is there a way to get user information by pinging someone in Discord.js?

I have a command in my discord.js file that allows users to vote for someone using a !vote @user command. Whenever I print out @user, I get <@!user_id>. Is there a way to turn that value into something manipulatable to for example, get @users's username or mute them in a voice call like when using msg.user?

client.on('message', msg) {
   if (msg.content.startsWith('!')) {
      let command = msg.content.substring('!'.length);
      let ping = command.split(' ');

      if(command == 'vote') {
         // Convert <@!user_id> into a manipulatable user?
         let user_information = ping[1]
      }
    }
 }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You could use message.mentions.users

Like this:

const mention = message.mentions.users.first();

Or if you wanted the member you could use message.mentions.members.first() like:

const mention = message.mentions.members.first();

If you don't want to use that you could use discord.js's guide on parsing mentions

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