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

674
Visualizações
How do I mention a person using Discord.js with only the user id?

I'm trying to build a bot which mentions people on discord. I already have the usernames of people, and I've been trying to mention users with this :

function discordsend(usern)
{ 
string = "$add-money"+usern+"1";
const channel = client.channels.cache.get('channelid');
channel.send(string)
console.log(channel);
}

However, it just sends the message plainly to the channel without actually mentioning the user. Is there any way I could mention a user just using their user id ? (Username with Discriminator)

I've also heard I can mention users if I have their IDs, but I only have their User IDs. If there is a way to obtain IDs from UserIDs, please let me know !

FYI, UserID is in the form user#discriminator

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Discord uses a special syntax to embed mentions in a message. For user mentions, it is the user's ID with <@ at the start and > at the end, like this:

<@12345678912345678>

If they have a nickname, there will also be a ! after the @.

about 4 years ago · Juan Pablo Isaza Relatório

0

If I read your question correctly, you wanted to mention a member using their ID only, to use their ID you need to cache.get:

const member = message.guild.members.cache.get(args[0])

if you're familiar with args functions then you can use it too with channels and roles

If you wanted to ping them in bot's messages. you can use ${member} for example:

message.channel.send(`${member}`)
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