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

196
Visualizações
(discord.js) TypeError: Cannot read property 'send' of undefined when trying to send a direct message

I have two text files, one with discord usernames with #, and another with the same amount of unique urls. I'm trying to make a discord bot to send each person one of the unique urls. I have run into an issue trying to send a test dm to one person. I keep getting the error.

TypeError: Cannot read property 'send' of undefined

    // Require the necessary discord.js classes
    const { Client, Intents } = require('discord.js');
    const { token } = require('./config.json');

    // Create a new client instance
    const client = new Client({ intents: [Intents.FLAGS.GUILDS] });

    // When the client is ready, run this code (only once)
    client.once('ready', () => {
        console.log('Ready');
        client.users.cache.get('877248726085828720').send('yo');
    });

    // Login to Discord with your client's token
    client.login(token);

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

0

Soo at the begining I think that you lose one intend so search them in API Documentation Discord.js Second I don't really understand where yiu want to send message but it should look like this

client.channels.cache.get('idhere').send('message');

I hope that helps you. Give me feedback if it does.

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