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

186
Visualizações
I can't send a message to a specific user in discord.js

I'm trying to make a system that sends a user a message when a command is called. But whenever I try, it says TypeError: Cannot read property 'send' of undefined.

Here is the code I am using.

 client.users.cache.get("220683253789163520").send("Test")

I am using discord version 12.

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

0

It means the user is not cached, before you need to fetch the user with <Client>.users.fetch method.

Example for your case:

await client.users.fetch('220683253789163520');
client.users.cache.get('220683253789163520').send('Test');
about 4 years ago · Juan Pablo Isaza Relatório

0

Use Client.users.fetch() to get directly from the API

const user = await client.users.fetch("220683253789163520")
await user.send("Test")
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